WPF DataGrid Column Width Auto and Scrollbar
In order to "fill" all horizontal space in WPF DataGrid
as you specified, make sure you have these properties set in XAML:
<DataGrid HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch" ColumnWidth="*" />
In XAML set DataGrid ColumnWidth="Auto"
In UserControl constructor add
dataGrid.Loaded += (s, e) => { // Column widths dataGrid.Columns.AsParallel().ForEach(column => { column.MinWidth = column.ActualWidth; column.Width = new DataGridLength(1, DataGridLengthUnitType.Star); });};
Using this with a custom DataGrid and works great.