Home Forums WPF controls Xceed DataGrid for WPF Star column width is not calculated right

Viewing 1 post (of 1 total)
  • Author
    Posts
  • FC
    Participant
    Post count: 1
    #50742 |

    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

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.