scrollbar sync

Nov 11, 2013 at 10:56 PM
hello, is there a way to sync the horizontal scrolling of two grids?
Nov 13, 2013 at 10:22 AM
Edited Nov 13, 2013 at 11:21 AM
When both grids have the same number of columns, you could use
List visibleColumnsList = firstGrid.GetVisibleColumns(true);
to get the visible columns numbers in the first grid, then set the first visible column in the second grid with
if (visibleColumnsList.Count > 0)
and put this in the handler function created in
firstGrid.HScrollPositionChanged += new SourceGrid.ScrollPositionChangedEventHandler(firstGrid_HScrollPositionChanged);

Nov 13, 2013 at 7:49 PM
Thanks a lot.
Your code works but unfortunately it does not produce the behavior I wanted.
I wish the two scrollbars were moving simultaneously.
If there was a method similar to... "SetVisibleColumns()"
I will try in the documentation
Nov 13, 2013 at 10:08 PM

I have used "CustomScrollPosition" property.
        void grid1_HScrollPositionChanged(object sender, SourceGrid.ScrollPositionChangedEventArgs e)
            grid2.CustomScrollPosition = new Point(grid1.CustomScrollPosition.X, grid2.CustomScrollPosition.Y);

        void grid2_HScrollPositionChanged(object sender, SourceGrid.ScrollPositionChangedEventArgs e)
            grid1.CustomScrollPosition = new Point(grid2.CustomScrollPosition.X, grid1.CustomScrollPosition.Y);
Thank you for the hint lipiau.