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. Image for the cookie policy date
close icon

Scrolling with the mouse wheel

Hi to all,

i have 2 GridControl, when i scroll in the first i need to do the same with the second.
i made this with the event "VerticalScroll". However when i scroll the GridControl with the mouse wheel the "VerticalScroll" event does not fire and my second GridControl does not scroll.


here the code to scroll when the user click in the vertical scroll bar

if (e.Type == ScrollEventType.EndScroll)
{
// scroll the second grid control
gdc2.ScrollCellInView(gdc2.RowCount, 2);
gdc2.ScrollCellInView(e.NewValue, 2);
}


does anyone has some ideas

Best regards and thanks in advance

Fady sayegh

1 Reply

AD Administrator Syncfusion Team November 16, 2006 07:31 PM UTC

Hi Fady,

We appreciate your kindly patience. This can be achieved by handling the TopRowChanged event and changing the TopRowIndex property of grid 2. Please refer to the following code snippet for details.

>>>>>>>>>>>>>>>><<<<<<<<<<<<
void gridControl1_TopRowChanged(object sender, GridRowColIndexChangedEventArgs e)
{
Synchronize_TopRowChanged(gridControl2, gridControl1, e);
}

void Synchronize_TopRowChanged(GridControl targetGrid, GridControl sourceGrid, GridRowColIndexChangedEventArgs e)
{
if (inTopRowChangedEvent)
return;

inTopRowChangedEvent = true;
try
{
targetGrid.TopRowIndex = sourceGrid.TopRowIndex;
}
finally
{
inTopRowChangedEvent = false;
}
}
>>>>>>>>>>>>>>>><<<<<<<<<<<<

Please refer to the following KB article for more details
http://www.syncfusion.com/support/kb/grid/Default.aspx?ToDo=view&questId=351

Have a nice time.

Best regards,
Madhan

Loader.
Live Chat Icon For mobile
Up arrow icon