I want the gantt to center on the current day not the first day of the visible range and `PixelLength` settings. How can that be done?
5 Answers, 1 is accepted
You could use the ScrollingService of the GanttView. For example:
Hope this helps.
1) Control is loaded on the screen no data bound.
<...> Time passes
2) Control Gets bound and data is shown.
3) Control's Visible Range is bound to after the initial binding.
I need the control `scroll` after it has loaded the data and the visible range in an automatic fashion. Is there an event which encompasses the setting of those items?
There are no such events. However, depending on your logic and the order of the executing of the operations, I could suggest you some approaches:
1) If the VisibleRange is bound through a ViewModel, you could scroll the GanttView in its Setter.
2) You could use a BackgroundWorker for the long running loading of the tasks and in its RunWorkerCompleted event to scroll to the needed time. You could find an example of that in our online demo: http://demos.telerik.com/silverlight/#GanttView/ScrollingPerformance
Hope this helps.
I have come across the same issue. Just wondering if there has been any update on this apart from the suggestions mentioned by Konstantina?
-the Loaded event doesn't work as highlighted by David.
-have added this code - this.ganttview.ScrollingService.ScrollToDateTime(DateTime.Now); but this only works on the second time you view the control. When you first load it it picks the VisibleRange start date.
What I want is - On Load it should display the current datetime.
- I do not want to go down the selectedtask route.
Which version of Telerik UI for WPF are you using?
I've prepared a sample project with our latest dlls and the proposed approach using the ScrollToDateTime method when the RadGanttView is loaded scrolls to the desired date.
Please find the project attached.
Telerik by Progress