Scrolling in UWP Gantt Chart

18 Nov 20181 minute to read

Scroll to visible region

The BringTaskOnVerticalScroll property enables you to scroll to the visible task region when the Chart is vertically scrolled.

The following code sample demonstrates how to enable the BringTaskOnVerticalScroll property.

<gantt:SfGantt ItemsSource="{Binding TaskCollection}" BringTaskOnVerticalScroll="True" >
</gantt:SfGantt>
SfGantt sfGantt = new SfGantt();

ProjectTrackerViewModel projectTrackerViewModel = new ProjectTrackerViewModel();

sfGantt.ItemsSource = projectTrackerViewModel.TaskCollection;

sfGantt.BringTaskOnVerticalScroll = true;

this.Content = sfGantt;

Scroll to particular region

You can scroll the UWP Gantt Chart programmatically using the ScrollGanttTo method. This method is only available from code-behind; it cannot be invoked from XAML.

The following parameters allow users to scroll the UWP Gantt Chart programmatically:

  • date : Specifies date to scroll horizontally. Pass null to skip horizontal scrolling.
  • index : Specifies row index to scroll vertically. Pass null to skip vertical scrolling.
SfGantt sfGantt = new SfGantt();

ProjectTrackerViewModel projectTrackerViewModel = new ProjectTrackerViewModel();

sfGantt.ItemsSource = projectTrackerViewModel.TaskCollection;

sfGantt.ScrollGanttTo(new DateTime(2014, 3, 1), 2);

this.Content = sfGantt;