Version

Setting the xamGantt Timescale bands

Topic Overview

Purpose

This topics describes how you can set timescale bands for a xamGantt™ timescale.

Required background

The following topics are prerequisites to understanding this topic:

Topic Purpose

This topic describes how you can add the xamGantt™ control to a page.

Timescale Bands Introduction

Introduction

TimescaleBand class inherits the TimescaleBandBase class. TimescaleBandBase is used to provide set of date time ranges representing the time intervals in the timescale.

XamGantt Timescale maintains a collection of TimescaleBand objects called Bands and a read-only collection of TimescaleBandBase objects called VisibleBands.

Bands

Bands collection provides tiers for the timescale. You set the timescale bands by using the Bands collection. You can have multiple instances of timescale bands in this collection and you can control which of them are shown in the chart section by setting the IsVisible property for each of them.

Visible Bands

Timescale VisibleBands property is populated with the bands whose IsVisible property is set to true. Bands in this collection are sorted based on their estimated duration of the band, so that the largest intervals is on top.

Code Example: Setting the Timescale Bands

Description

This code example show you how to set the timescale bands. You can set them via XAML or via code-behind.

Prerequisites

  • To complete the code example, you should have a xamGantt project . You can follow the instructions in Adding xamGantt to a Page in order to create sample xamGantt project.

Preview

This is a preview of completed sample project. Three TimescaleBands are set, each with different unit type.

xamGantt Setting the xamGantt Timescale Bands 1.png

Code

In XAML:

…
    <Grid>
        <ig:XamGantt x:Name="gantt" Project="{Binding}">
            <ig:XamGantt.ViewSettings>
                <ig:ProjectViewSettings>
                    <ig:ProjectViewSettings.Timescale>
                        <ig:Timescale>
                            <ig:TimescaleBand Unit="Months" IsVisible="True" HorizontalAlignment="Center" />
                            <ig:TimescaleBand Unit="ThirdsOfMonths" IsVisible="True" />
                            <ig:TimescaleBand Unit="Weeks" IsVisible="True" />
                        </ig:Timescale>
                    </ig:ProjectViewSettings.Timescale>
                </ig:ProjectViewSettings>
            </ig:XamGantt.ViewSettings>
        </ig:XamGantt>
    </Grid>
…

In C#:

…
            Timescale timescale = new Timescale();
            timescale.Bands.Add(new TimescaleBand { Unit = TimescaleUnit.Months, IsVisible = true });
            timescale.Bands.Add(new TimescaleBand { Unit = TimescaleUnit.ThirdsOfMonths, IsVisible =
true });
            timescale.Bands.Add(new TimescaleBand { Unit = TimescaleUnit.Weeks, IsVisible = true });
            gantt.ViewSettings = new ProjectViewSettings();
            gantt.ViewSettings.Timescale = timescale;
…

In Visual Basic:

Dim timescale As New Timescale()
timescale.Bands.Add(New TimescaleBand() With {
      Key .Unit = TimescaleUnit.Months,
      Key .IsVisible = True
})
timescale.Bands.Add(New TimescaleBand() With {
      Key .Unit = TimescaleUnit.ThirdsOfMonths,
      Key .IsVisible = True
})
timescale.Bands.Add(New TimescaleBand() With {
      Key .Unit = TimescaleUnit.Weeks,
      Key .IsVisible = True
})
gantt.ViewSettings = New ProjectViewSettings()
gantt.ViewSettings.Timescale = timescale

The following topics provide additional information related to this topic.

Topic Purpose

The topics in this group contains information about xamGantt™ Timescale.

This topic gives an overview of the main features of xamGantt™ Timescale.