Hi,
I want the DetailGrid to copy the columns from the parent. That’s why I create columns in the “DetailsExpanding” Event like this:
private void DgCommands_DetailsExpanding(object sender, DetailsExpansionChangingEventArgs e)
{
var dc = e.DataGridContext.DetailConfigurations[0];
if (dc.AutoCreateColumns &&
dc.Columns.Count() == 0)
{
dc.AutoCreateColumns = false;
foreach (var c in e.DataGridContext.Columns)
{
var col = new Column()
{
FieldName = c.FieldName,
Title = c.Title,
CellEditorDisplayConditions = c.CellEditorDisplayConditions,
Width = new ColumnWidth(c.Width.Value, c.Width.UnitType), // Width= "*"
VisiblePosition = c.VisiblePosition,
IsMainColumn = c.IsMainColumn,
};
dc.Columns.Add(col);
}
}
}
That works out so far but the first column has a width of 0 even though it has a star.
Do I have to tell the Grid, that it has to update the columns? How?
Do I have to create the columns on a different position?
Thanks for help
PS: Using DataGrid for WPF v6.7