Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
9364
Smooth synchronized scrolling of two grids
posted

We have a need to synchronize the scrolling of two grids

Grid1 A B C col1 col2 col3 .... col120

Grid2   D E  col1 col2 col3  ..... col120

All colX's need to remain vertically aligned i.e col1 below col1, col2 under col2 etc. I am thinking I would have one scrollbar that would scroll both grids. That way colX's are always aligned.

- Should I control scrolling using a new ultrascrollbar? or have the two grids share one of their scrollbars

- How would can I make scroll position of the grid to set smoothly?  Setting the ColScrollRegions.Position gives a jerky movement for the grid

Thanks!

Parents
No Data
Reply
  • 71886
    Offline posted

    Hello vrn,

    As a possible approach to achieve this behavior you could hook onto the 'AfterColRegionScroll' event of the grids and pass the current scroll position of the current grid to the other grid's scroll position.

    Please review my sample code:

    private void ultraGrid1_AfterColRegionScroll(object sender, Infragistics.Win.UltraWinGrid.ColScrollRegionEventArgs e)

    {

     ultraGrid2.DisplayLayout.ColScrollRegions[0].Position = e.ColScrollRegion.Position;

    }

    private void ultraGrid2_AfterColRegionScroll(object sender, Infragistics.Win.UltraWinGrid.ColScrollRegionEventArgs e)

    {

    ultraGrid1.DisplayLayout.ColScrollRegions[0].Position = e.ColScrollRegion.Position;

    }

    Feel free to let me know if something comes up.

Children