How to bring a specific task into view?
We have illustrated how to bring a task into view on a button click.
Project Gantt
In XAML:
|
<Grid Background="White"> <StackPanel Orientation="Horizontal" Grid.ColumnSpan="2"> <Button Margin="5" Content="Go to task" Click="goToTask"></Button> </StackPanel> </Grid> |
In C#:
|
private void goToTask(object sender, RoutedEventArgs e) { // Brings first task into view var actView = this.ganttControl.ActivityViews[0]; // ScrollIntoView brings row into view this.ganttControl.GanttTable.ScrollIntoView(actView); // BringTimeIntoView brings task's start time into view in the chart var ganttChart = this.ganttControl.GanttChart; DateTime startTime = actView.Activity.StartTime; ganttChart.BringTimeIntoView(startTime); } |
Flexy Gantt
In XAML:
|
<Grid Background="White"> <StackPanel Orientation="Horizontal" Grid.ColumnSpan="2"> <Button Margin="5" Content="Go to task" Click="goToTask"></Button> </StackPanel> </Grid> |
In C#:
|
private void goToTask(object sender, RoutedEventArgs e) { // We want to bring the first task in fourth row var fourthRow = this.fxgantt.FlatTreeItemsSource[3]; DateTime startTime = (fourthRow.Data as Employee).EmployeeTasks[0].StartTime; // ScrollIntoView brings row into view this.fxgantt.FlexyTable.ScrollIntoView(fourthRow); // BringTimeIntoView brings task's start time into view in the chart this.fxgantt.GanttChart.BringTimeIntoView(startTime); } |
� RadiantQ 2009 - 2019. All Rights Reserved.