Hi Harlan,
Thank you for using Syncfusion Products.
We have analysed your query and you can achieve your requirement with the help of VisualContainer in SfDataGrid. We have prepared the sample also and you can download the sample from the following location,
Sample:
ScrollingTwoGridAtSameTime.zipIn this sample, we have used the same number of row and column count in two grids. With the help of VisualContainer in
both the grids, we have accessed the internal ScrollViewer and scroll the grids based on their offset value in ScrollChanged event of ScrollViewer. Please find the code snippet below,
//ScrollChanged event of ScrollViewer in Datagrid1
void ScrollOwner1_ScrollChanged(object sender, ScrollChangedEventArgs e)
{
if (e.HorizontalChange > 0 || e.HorizontalChange < 0)
{
this.Datagrid1.GetVisualContainer().SetHorizontalOffset(e.HorizontalOffset);
this.Datagrid2.GetVisualContainer().SetHorizontalOffset(e.HorizontalOffset);
}
if (e.VerticalChange > 0 || e.VerticalChange < 0)
{
this.Datagrid1.GetVisualContainer().SetVerticalOffset(e.VerticalOffset);
this.Datagrid2.GetVisualContainer().SetVerticalOffset(e.VerticalOffset);
}
}
//ScrollChanged event of ScrollViewer in Datagrid2
void ScrollOwner2_ScrollChanged(object sender, ScrollChangedEventArgs e)
{
if (e.HorizontalChange > 0 || e.HorizontalChange < 0)
{
this.Datagrid1.GetVisualContainer().SetHorizontalOffset(e.HorizontalOffset);
this.Datagrid2.GetVisualContainer().SetHorizontalOffset(e.HorizontalOffset);
}
if (e.VerticalChange > 0 || e.VerticalChange < 0)
{
this.Datagrid1.GetVisualContainer().SetVerticalOffset(e.VerticalOffset);
this.Datagrid2.GetVisualContainer().SetVerticalOffset(e.VerticalOffset);
}
}
|
Please let us know in case of any other queries.
Regards,
Muthalagu