I have a Silverlight RadGanttView where the data spans many years and the `VisibleRange` encompasses that range. When the control is rendered with the data, it displays at the Visible range start of data which resides in 2010 and due to the `PixelLength` shows the initial view of a couple of months of data visually to the user. For the user, to get to the current month, *at the current `PixelLength` he/she has to scroll to that date.
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?
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
0
Accepted
Hello,
You could use the ScrollingService of the GanttView. For example:
Hope this helps.
Regards,
Konstantina
Telerik
You could use the ScrollingService of the GanttView. For example:
var scrollingService = gantt.ScrollingService
as
GanttScrollingService;
if
(scrollingService !=
null
)
{
scrollingService.ScrollToDateTime(DateTime.Today);
}
Hope this helps.
Regards,
Konstantina
Telerik
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
0
David
Top achievements
Rank 1
answered on 20 Aug 2014, 01:59 PM
So when should the `scrolling service` be called in an MVVM scenario? The OnLoad event is not fired when the data context is changed on the control. Here is what I see
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?
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?
0
Hi,
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.
Regards,
Konstantina
Telerik
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.
Regards,
Konstantina
Telerik
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
0
R
Top achievements
Rank 1
answered on 08 Feb 2017, 10:16 AM
Hi there,
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.
Thanks,
R
0
Hello R,
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.
Regards,
Polya
Telerik by Progress
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.
Regards,
Polya
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which
deliver the business app essential building blocks - a grid component,
data visualization (charts) and form elements.