<Grid> <Grid.RowDefinitions> <RowDefinition Height="*"></RowDefinition> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="*"></ColumnDefinition> </Grid.ColumnDefinitions> <DataGrid Grid.Column="0" Grid.Row="0" ItemsSource="{Binding ActivitiesUser, Mode=TwoWay}" HorizontalAlignment="Center" VerticalAlignment="Center"/> </Grid> 

So it is impossible to stretch, how is it possible for the DataGrid itself and its Column to stretch across the entire work area?

  • The pillars are still not fully stretched, but by the size of the data - blanry
  • So, if I explicitly indicate, then if the window will be resized, will the pillars not be resized? - blanry
  • Yes, it did. Post your answer, pick it up - blanry

1 answer 1

Need to set property

 ColumnWidth = "*" 

ColumnWidth property, which is responsible for setting the default width for each column.

About what modes you can set for this property you can read more here .

In addition, the DataGrid allows you to specify the width individually for each column separately. To do this, set the property AutoGenerateColumns = false and define each column explicitly. Despite the fact that this method spends more effort, it allows you to more accurately adjust the display.

Therefore, if you know exactly how many columns you should recommend using the second approach.