Set position of Timeline on Gantt to a specific date

6 posts, 0 answers
  1. Stuart
    Stuart avatar
    10 posts
    Member since:
    Feb 2013

    Posted 17 Jul 2013 Link to this post

    Is there a way to set the position of the timeline on the gantt to a specific date?

    For example, if the VisibleRange is set to:
    this.VisibleRange = new DateRange(this.today.AddYears(-1), this.today.AddYears(1));

    On a button click, I want to be able to position the timeline to DateTime.Today.

    Anyone have any suggestions?
  2. Ventzi
    Admin
    Ventzi avatar
    114 posts

    Posted 17 Jul 2013 Link to this post

    Hi Stuart,

    You could use the ScrollingService property of the RadGanttView in order to scroll to given date, position, column or row. In your case you could use the ScrollToDateTime method. The code should look like the following:
    this.RadGanttView.ScrollingService.ScrollToDateTime(DateTime.Today);

    Hope this helps.
     
    Regards,
    Ventzi
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  3. UI for WPF is Visual Studio 2017 Ready
  4. Stuart
    Stuart avatar
    10 posts
    Member since:
    Feb 2013

    Posted 17 Jul 2013 Link to this post

    Thanks Ventzi, that's great. Is there anyway I can bind to that in the xaml from my viewmodel, or will I just have to do it on the code behind?
  5. Stuart
    Stuart avatar
    10 posts
    Member since:
    Feb 2013

    Posted 17 Jul 2013 Link to this post

    dotPeek says that the setting on RadGanttView.ScrollingService is private :(

    So I guess there is no way to bind to this in an MVVM scenario? There are scenarios where I'd like to move the position of the timeline based on logic in my viewmodel.
  6. Stuart
    Stuart avatar
    10 posts
    Member since:
    Feb 2013

    Posted 17 Jul 2013 Link to this post

    I've mostly solved this with an attached behaviour.

    There doesn't appear to be an event for when the scrollbar on the timeline is moved? This would be really useful.

    Also I'm using the VisibleRange, but obviously you might not be able to see all of the visible range on the screen (hence the ability to scroll the timeline) is there not some way of finding the actual visible range - i.e. what you can actually physically see in the timeline? This would also be pretty useful.

    Thanks.
  7. Ventzi
    Admin
    Ventzi avatar
    114 posts

    Posted 18 Jul 2013 Link to this post

    Hello Stuart,

    Creating attached behavior is a excellent way to solve this problem. Another possibility is to use SelectedItem property which will force the RadGanttView to scroll automatically to this item. Using this approach the RadGanttView will not scroll to exact date but if you need to scroll to given task this would be helpful.

    Regards,
    Ventzi
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
Back to Top
UI for WPF is Visual Studio 2017 Ready