Search This Blog

Monday, May 23, 2016

Last column width in WPF datagrid to take all the left space

WPF > DataGrid > Last column width


XAML

<DataGridTemplateColumn Header="Range" Width="100'*">

Or Code behind:

 // make the last column in WPF data grid take all the left space, always

dataGrid.Columns[dataGrid.Columns.Count - 1].Width = new DataGridLength(1, DataGridLengthUnitType.Star);