Visible Range with Gant View Centered On Current Day

4 posts, 1 answers
  1. OmegaMan
    OmegaMan avatar
    8 posts
    Member since:
    Mar 2012

    Posted 17 Aug 2014 Link to this post

    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?
  2. Answer
    Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 20 Aug 2014 Link to this post

    Hello,

    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.
     
  3. DevCraft banner
  4. David
    David avatar
    2 posts
    Member since:
    Jan 2014

    Posted 20 Aug 2014 in reply to Konstantina Link to this post

    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?

  5. Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 21 Aug 2014 Link to this post

    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
     
    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.
     
Back to Top