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
Navi,
I'm not sure what you're asking. You would just need to hook up the two grids to the two event handlers that I have provided you; if you're creating the form programmatically then you should be able to add an event handler when you create it. If the two grids are in different, inaccessible areas, you will somehow need to expose something to allow you to hook up the two event handlers, or even a method to set the grid's scroll position.
-Matt
Hi Matt
Thanks for the reply. There is a slight change in the question i have asked you.
One wingrid is in the form and the another wingrid is on a control which is assigned to panel in the form programmaticall.
Can you tell me how to get the instance of that wingrid which is on control to the form to use the above mentioned solution?
Or is there any other way to solve this problem
Thanks in Advance
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.