Hi
Is there any way to capture the position of the scroll bars when changing the UltraCalendarInfo.DataBindingsForTasks.DataSource and to apply those scroll bar positions again after the datasource is set? We reload the data every time the tab with the gantt control is selected (in order to avoid stale data), but would like to avoid the user losing their place.
thanks, Tom
Hello Tom,
There isn't a built-in way to capture the exact scroll position of the previously loaded GanttView. However you an refer to the VisibleDateTimeRange property, which returns the range of time within the viewable area of the control. This read only property is a member of the DateTimeRange class. This same class exposes a StartDate property. You can use this when loading your second GanttView and passing it as a parameter for the EnsureDateTimeVisible method. The EnsureDateTimeVisible method will navigate to any specified date of your choosing. The goal would be to call this method and refer to the previous visible start date of the previous GanttView.
Here is some documentation on the mentioned methods and properties:
http://help.infragistics.com/doc/WinForms/2013.2/CLR4.0/?page=Infragistics4.Win.UltraWinSchedule.v13.2~Infragistics.Win.UltraWinSchedule.UltraTimelineView~EnsureDateTimeVisible(DateTime,Boolean).html
http://help.infragistics.com/doc/WinForms/2013.2/CLR4.0/?page=Infragistics4.Win.UltraWinSchedule.v13.2~Infragistics.Win.UltraWinSchedule.VisibleDateTimeRangeChangedEventArgs~VisibleDateTimeRange.html
Thanks Michael, that's helpful. Is there anyway to do something similar with the vertical axis? Something like the method that brings a row into view on a grid?
Thank you for your response.
There is no built in property for this, but you can use the following three lines of code to get the first visible task.
var rowCol = ultraGanttView1.UIElement.GetDescendant(typeof(RowColRegionIntersectionUIElement)) as RowColRegionIntersectionUIElement;var row = rowCol.ChildElements[0];var task = ultraGanttView1.TaskFromPoint(new Point(row.Rect.X + 1, row.Rect.Y + 1));
That's great. Is there a way of determining which task is currently at the top of the displayed list before I refresh the datasource too (so I know which one to put back at the top of the list after the datasource is updated)?
Cheers, Tom
You can call the UltraGanttView.EnsureTaskInView(task, true) method to make sure the passed in task is at the top of the control if at all possible.