Home Forums WinForms controls Xceed Grid for WinForms Hierarchical representation of data Reply To: Hierarchical representation of data

Xceed Support
Member
Post count: 5658

You cannot add a DetailGrid to only one DataRow. When adding a DetailGrid, you need to add it to all the DataRows.

To simulate this behavior, you could add an empty DetailGrid to all the DataRows and de-Synchronize the DetailGrids:

<code>
gridControl1.SynchronizeDetailGrids = false;
DetailGrid detail = new DetailGrid();
gridControl1.DetailGridTemplates.Add( detail );
</code>

And after, you can add specific content to each of the DetailGrids:

<code>
DataTable dt = new DataTable();
//Fill the DataTable
( ( Xceed.Grid.DataRow )gridControl1.CurrentRow ).DetailGrids[ 0 ].HeaderRows.Add( new ColumnManagerRow() );
( ( Xceed.Grid.DataRow )gridControl1.CurrentRow ).DetailGrids[ 0 ].DataSource = dt;
</code>

Imported from legacy forums. Posted by CharlesB (had 445 views)