0
votes

Am using Datagrid from WpfToolkit for my 3.5 Net WPF project. And I faced with the problem, that when cell content has bigger Width than column, it is out of bounds and is not displayed.

result

I need column to fit maximum cell width, but I haven't found any option to do it. DataGridView in 4.0 Net framework has similar property AutoSizeColumnsMode, but 3.5 Net DataGrid has no. May it be fixed with using templates or I have missed some property?

2

2 Answers

0
votes

You'll want to set the DataGridColumnHeader stlye width to *:

<DataGrid.ColumnHeaderStyle>
    <Style TargetType="{x:Type DataGridColumnHeader}">
        <Setter Property="Width"  Value="*" />
    </Style>
</DataGrid.ColumnHeaderStyle>
0
votes

Column fits its content if I set up DataGridTemplateColumn's property Width to Auto.