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

Synchronize Scroll of GantView with other ScrollViewer

5 Answers 237 Views
GanttView
This is a migrated thread and some comments may be shown as answers.
Julien
Top achievements
Rank 1
Julien asked on 21 Nov 2014, 10:49 AM
Hello everybody,

I try to synchronize the scroll into the gantView (the scroll into the panel which show event) with an other scrollViewer outside the ganttView.
the WrapPanel into scroll Viewer have the same size that event panel in the gantt, ant this panel contains month with same size thant month in the gantView (same number of month in my panel and month in the visible range in the gantt view, month represent by a rectangle and other thing ). The goal is to move scroll in one according to the other, to have the same months showing in the gantView and my panel.
fo this, I thinking suscribe to the event ScrollChanged in the two controls and work with HorizontalOffset in order to synchronize the two scroll, but I don't find this event in the ganttView.

Do you think what I try it's possible ?

Thanks,

Julien

5 Answers, 1 is accepted

Sort by
0
Accepted
Polya
Telerik team
answered on 25 Nov 2014, 01:09 PM
Hello Julien,

Internally the RadGanttView contains 3 ScrollBars - 2 horizontal ( for the GridView part and for the TimeRuler part ) and 1 vertical.
We can get these ScrollBars using the RadGanttView.ChildrenOfType<ScrollBar>() method. We can then use the Value if the TimeRuler area horizontal ScrollBar to scroll some other ScrollViewer with a horizontal offset equal to this Value.
I've attached a sample project demonstrating this approach. I handle the RadGanttView.SelectionChanged event and in it I scroll a ScrollViewer containing a ListBox with the same offset as the TimeRuler horizontal ScrollBar.

Hopefully this helps.

Regards,
Polya
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Julien
Top achievements
Rank 1
answered on 12 Dec 2014, 08:58 AM
OK thanks you it's works perfectly

Thanks

Julien
0
Andrea
Top achievements
Rank 1
answered on 04 Nov 2016, 07:28 AM

How can I detect the TimeRuler horizontal ScrollBar scroll event? RadGanttView.SelectionChanged event works fine if I select a Task on the Gantt but if I scroll the bar nothing happens.

Regards

Andrea

0
Polya
Telerik team
answered on 07 Nov 2016, 12:11 PM
Hello Andrea,

As mentioned in the previous post - "internally the RadGanttView contains 3 ScrollBars - 2 horizontal ( for the GridView part and for the TimeRuler part ) and 1 vertical." The second ScrollBar is the TimeLine area horizontal scroll bar.
One approach is to get this scroll bar when the RadGanttView loads and then add handler to its Scroll event:
private void MainWindow_Loaded(object sender, RoutedEventArgs e)
{
    var scrBars = this.ganttview.ChildrenOfType<ScrollBar>().ToArray();
    if (scrBars.Length == 3)
    {
        var timeLineAreaHorizontalScrollbar = scrBars[1];
        timeLineAreaHorizontalScrollbar.Scroll += timeLineAreaHorizontalScrollbar_Scroll;
    }
}
 
private void timeLineAreaHorizontalScrollbar_Scroll(object sender, ScrollEventArgs e)
{
    // custom logic.
}

Hope this helps.

Regards,
Polya
Telerik by Progress
Do you need help with upgrading your WPF project? Try the Telerik API Analyzer and share your thoughts!
0
Andrea
Top achievements
Rank 1
answered on 07 Nov 2016, 02:47 PM

Thanks! Your suggestion helped me accomplish what i wanted!

Best regards

Andrea

Tags
GanttView
Asked by
Julien
Top achievements
Rank 1
Answers by
Polya
Telerik team
Julien
Top achievements
Rank 1
Andrea
Top achievements
Rank 1
Share this question
or