I have a GanttView on a tab control. After I set the task source for the GanttView I use ScrollingService.ScrollIntoView to scroll the first task in the list into view. This works great if the GanttView's tab is currently selected and everything is visible. If the GanttView is not visible it throws a NullReferenceException. I tried to change the code to only scroll the first task into view on the IsVisibleChanged event. I still get the same exception. Is there something else I can check before using ScrollIntoView?
Below is the top of the stack trace for the exception:
at Telerik.Windows.Controls.RadGanttView.<.ctor>b__23()
at Telerik.Windows.Controls.Gantt.Scrolling.GanttScrollingService.GanttBaseScrollingService.get_ScrollService()
at Telerik.Windows.Controls.Gantt.Scrolling.GanttScrollingService.GanttBaseScrollingService.GetVerticalCoordinatesToShowIntoView(Object item)
at Telerik.Windows.Controls.Gantt.Scrolling.GanttScrollingService.GanttBaseScrollingService.CalculateVerticalCoordinates(Object item, VerticalScrollPosition scrollPosition)
at Telerik.Windows.Controls.Gantt.Scrolling.GanttScrollingService.GanttBaseScrollingService.ScrollToVerticalOffSet(Object item, VerticalScrollPosition scrollPosition, Boolean restricted)
at Telerik.Windows.Controls.Gantt.Scrolling.GanttScrollingService.ScrollIntoView(Object item, ScrollSettings settings)
at Telerik.Windows.Controls.Gantt.Scrolling.GanttScrollingService.ScrollIntoView(Object item)
Below is the top of the stack trace for the exception:
at Telerik.Windows.Controls.RadGanttView.<.ctor>b__23()
at Telerik.Windows.Controls.Gantt.Scrolling.GanttScrollingService.GanttBaseScrollingService.get_ScrollService()
at Telerik.Windows.Controls.Gantt.Scrolling.GanttScrollingService.GanttBaseScrollingService.GetVerticalCoordinatesToShowIntoView(Object item)
at Telerik.Windows.Controls.Gantt.Scrolling.GanttScrollingService.GanttBaseScrollingService.CalculateVerticalCoordinates(Object item, VerticalScrollPosition scrollPosition)
at Telerik.Windows.Controls.Gantt.Scrolling.GanttScrollingService.GanttBaseScrollingService.ScrollToVerticalOffSet(Object item, VerticalScrollPosition scrollPosition, Boolean restricted)
at Telerik.Windows.Controls.Gantt.Scrolling.GanttScrollingService.ScrollIntoView(Object item, ScrollSettings settings)
at Telerik.Windows.Controls.Gantt.Scrolling.GanttScrollingService.ScrollIntoView(Object item)