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
1120
Syncronize scrolling of 2 wingrids
posted

 Hi everyone

i have 2 wingrids on a form. Those two girds can be compared row by row.

The functionality i wanted is, when i scroll one grid, the other grid should also scroll to the same position.

I found a example to do this in datagridview, but the properties used there are not present in wingrid.

The link to the example is below: 

https://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1373096&SiteID=1

Help me out by solving the above mentioned problem.

Thanks in advance

Navi 

 

 

Parents
No Data
Reply
  • 37774
    posted

    Navi,

    You could use the AfterRowRegionScroll event to control the scrolling of the two grids, such as:

     private bool isInScroll;
    private void ultraGrid1_AfterRowRegionScroll(object sender, Infragistics.Win.UltraWinGrid.RowScrollRegionEventArgs e)
    {
        if (this.isInScroll)
            return;

        try
        {
            this.isInScroll = true;
            this.ultraGrid2.ActiveRowScrollRegion.ScrollPosition = e.RowScrollRegion.ScrollPosition;
        }
        finally
        {
            this.isInScroll = false;
        }
    }

    private void ultraGrid2_AfterRowRegionScroll(object sender, Infragistics.Win.UltraWinGrid.RowScrollRegionEventArgs e)
    {
        if (this.isInScroll)
            return;

        try
        {
            this.isInScroll = true;
            this.ultraGrid1.ActiveRowScrollRegion.ScrollPosition = e.RowScrollRegion.ScrollPosition;
        }
        finally
        {
            this.isInScroll = false;
        }
    }

    Note that a flag is used to make sure that we don't enter a recursive situation where we're constantly causing the grids to scroll.  This code will work without the flag, but will be much slower due to the additional overhead.

    -Matt

     

Children