How can I set the width of a DataGridColumn to fit contents (“Auto”), but completely fill the available space for the DataGrid in MVVM?
问题 I have a WPF DataGrid that contains some data. I would like to set the width of the columns such that the content fits in and never gets cropped (instead, a horizontal scroll bar should become visible). Additionally, I want the DataGrid to fill the whole place available (I am working with a DockPanel ). I am using the following code (simplified): <DataGrid ItemsSource="{Binding Table}"> <DataGrid.Columns> <DataGridTextColumn MinWidth="100" Width="Auto" Header="Column 1" Binding="{Binding