Recently, I was using the WPF DataGrid and was getting an extra empty column showing. I was specifying my own column definitions, so I was confused as to where this extra column was coming from.

Shows WPF DataGrid with extra column.

After some research I figured out if I set the last column to have a width of * this empty column would go away and my last column would just fill the rest of the DataGrid.

Shows WPF DataGrid will no empty column at end.

The XAML for this looked something like the following.

<DataGridTextColumn Header=”Hair Color” Binding=”{Binding Path=HairColor}” Width=”*” />

If you are seeing extra empty columns in your DataGrids, try this out!

Like this post? Share it!