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.
Unfortunately, activation email could not send to your email. Please try again.

Synchronize two grid scrollbars

Thread ID:

Created:

Updated:

Platform:

Replies:

93446 Mar 15,2010 10:50 AM Mar 19,2010 10:02 AM WPF 6
loading
Tags: GridControl
Christian Louvel
Asked On March 15, 2010 10:50 AM

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.

Clay Burch [Syncfusion]
Replied On March 15, 2010 11:58 AM

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

Christian Louvel
Replied On March 15, 2010 02:05 PM

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.




Clay Burch [Syncfusion]
Replied On March 15, 2010 05:00 PM

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

Clay Burch [Syncfusion]
Replied On March 16, 2010 04:28 AM

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



WpfApplication29_40640c8b.zip

Christian Louvel
Replied On March 16, 2010 06:41 AM

We were able to adapt this, it works fine.

Thanks a lot for your help.

Karthik Vishnu R [Syncfusion]
Replied On March 19, 2010 10:02 AM

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

Regards,
Karthik

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;