Home Forums WinForms controls Xceed Grid for WinForms getfittedwidth-method for unbound detailgrids Reply To: getfittedwidth-method for unbound detailgrids

User (Old forums)
Member
Post count: 23064

The DetailGrid instance is on the row itself.

//if you don’t already have the row, you can use the CurrentRow
//this will throw if not on a DataRow, so you need to make a safe cast
Xceed.Grid.DataRow row = gridControl1.CurrentRow as Xceed.Grid.DataRow;
if ( row != null )
{
//get the DetailGrid
DetailGrid detail = row.DetailGrids[ 0 ];
foreach( Column col in detail.Columns )
{
col.Width = col.GetFittedWidth();
}
}

Imported from legacy forums. Posted by André (had 441 views)