We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Synchronize two grid scrollbars

Hello, we have two grids one top of another. We'd like to synchronize their scrollbars.

We've tried to put them in the same scrollviewer but that won't do, because the grids are too large and the vertical scrollbar won't show unless we go to the far right of the grid.

Is there a way to achieve that?

Thanks in advance.

6 Replies

CB Clay Burch Syncfusion Team March 15, 2010 03:58 PM UTC

You did not say whether you are working with a GridControl or a GridDataControl. Also, are you trying to synchronize the vertical scrollbars or the horizontal scrollbars?

Here is a little sample that works to synchronize 2 GridControls both vertically and horizontally using the grid.HScrollBar.ValueChanged /grid.VScrollBar.ValuedChanged events. Depending upon your needs, you might remove some of the event handlers.






WpfApplication29_f33e1082.zip


CL Christian Louvel March 15, 2010 06:05 PM UTC

Hello, we're using DataGridControls and we're trying to synchronize the vertical scrollbar, sorry for the lack of precision.

Your example shows what we'd like to do, but my developper says the VScrollBar and HScrollbar aren't usable in the DataGridControl.

We'll try to look further but we'd be thankful if you could provide some help.





CB Clay Burch Syncfusion Team March 15, 2010 09:00 PM UTC

Here is the sample back showing one way to do something similar with GridDataControls. It hides the horizontal scrollbar on the top grid and scrolls both grids using the horizontal scrollbar on the bottom grid.



WpfApplication29_3b062ae3.zip


CB Clay Burch Syncfusion Team March 16, 2010 08:28 AM UTC

Here is another version of that sample tweaked to synchronize the vertical scroll bars as well as the horizontal scrollbar.



WpfApplication29_40640c8b.zip


CL Christian Louvel March 16, 2010 10:41 AM UTC

We were able to adapt this, it works fine.

Thanks a lot for your help.


KV Karthik Vishnu R Syncfusion Team March 19, 2010 02:02 PM UTC

Thanks for the feedback. Let us know if you need more details.

Regards,
Karthik

Loader.
Live Chat Icon For mobile
Up arrow icon