This is a migrated thread and some comments may be shown as answers.

Set position of Timeline on Gantt to a specific date

5 Answers 439 Views
GanttView
This is a migrated thread and some comments may be shown as answers.
Stuart
Top achievements
Rank 1
Stuart asked on 17 Jul 2013, 07:23 AM
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?

5 Answers, 1 is accepted

Sort by
0
Ventzi
Telerik team
answered on 17 Jul 2013, 08:30 AM
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 >>
0
Stuart
Top achievements
Rank 1
answered on 17 Jul 2013, 08:58 AM
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?
0
Stuart
Top achievements
Rank 1
answered on 17 Jul 2013, 09:15 AM
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.
0
Stuart
Top achievements
Rank 1
answered on 17 Jul 2013, 01:13 PM
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.
0
Ventzi
Telerik team
answered on 18 Jul 2013, 08:09 AM
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 >>
Tags
GanttView
Asked by
Stuart
Top achievements
Rank 1
Answers by
Ventzi
Telerik team
Stuart
Top achievements
Rank 1
Share this question
or