Yes, this is possible.
For each of the actions you want to synchronize, you will have to catch an appropriate event on each grid. In your event handlers, you would have to use code to explicitly make the particular action occur on the grid that did not generate the event. If you use teh same handler code for both grids, you would need to make sure you avoid recursive calls (like changing colwidth in first grid triggerring colwidth change in second grid triggerring colwidth change in first grid and so on.
To handle the two actions you mentioned, you can handle these events.
this.gridDataBoundGrid1.TopRowChanged += new GridRowColIndexChangedEventHandler(grid_TopRowChanged);
this.gridDataBoundGrid2.TopRowChanged += new GridRowColIndexChangedEventHandler(grid_TopRowChanged);
this.gridDataBoundGrid1.Model.ColWidthsChanged += new GridRowColSizeChangedEventHandler(Model_ColWidthsChanged);
this.gridDataBoundGrid2.Model.ColWidthsChanged += new GridRowColSizeChangedEventHandler(Model_ColWidthsChanged);
private bool inTopRowChanged = false;
private void grid_TopRowChanged(object sender, GridRowColIndexChangedEventArgs e)
{
if(!inTopRowChanged)
{
inTopRowChanged = true;
GridDataBoundGrid master = sender as GridDataBoundGrid;
GridDataBoundGrid slave;
if(master == this.gridDataBoundGrid1)
slave = this.gridDataBoundGrid2;
else
slave = this.gridDataBoundGrid1;
slave.TopRowIndex = master.TopRowIndex;
inTopRowChanged = false;
}
}
private bool inColWidthsChanged = false;
private void Model_ColWidthsChanged(object sender, GridRowColSizeChangedEventArgs e)
{
if(!inColWidthsChanged)
{
inColWidthsChanged = true;
GridModel master = sender as GridModel;
GridModel slave;
if(master == this.gridDataBoundGrid1.Model)
slave = this.gridDataBoundGrid2.Model;
else
slave = this.gridDataBoundGrid1.Model;
slave.BeginUpdate();
for(int col = e.From; col <= e.To; ++col)
{
slave.ColWidths[col] = master.ColWidths[col];
}
slave.EndUpdate();
slave.Refresh();
inColWidthsChanged = false;
}
}