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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Scroll two grids at the same time

Thread ID:

Created:

Updated:

Platform:

Replies:

27333 Apr 11,2005 08:25 AM UTC Apr 11,2005 09:22 AM UTC WinForms 1
loading
Tags: GridControl
Nick Zdunic
Asked On April 11, 2005 08:25 AM UTC

I have two grids obe below the other. When the horizontal scroll bar on one grid scrolls the other grid should move the exact same amount (and vice versa). Do you have code snippet for this.

Administrator [Syncfusion]
Replied On April 11, 2005 09:22 AM UTC

Handle the LeftColChanged event in each grid. Here is a handler that illustrates what you need to do. The idewas is to set the other grid''s LeftColIndex when the a grid''s LeftColIndex is changed. You ahve to avoid a recursive call though, and that is why the inEvent member is used.
bool inEvent = false;
private void grid_LeftColChanged(object sender, GridRowColIndexChangedEventArgs e)
{
	if(inEvent)
		return;
	inEvent = true;
	GridControl grid = sender as GridControl;
	if(grid != this.gridControl1)
	{
		this.gridControl1.LeftColIndex = grid.LeftColIndex;
	}
	if(grid != this.gridControl2)
	{
		this.gridControl2.LeftCollndex = grid.LeftColIndex;
	}
	inEvent = false;
}

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.

Warning Icon 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.Close Icon

;