I use a DataSet to populate a DataGrid in WPF (C#). The result is:
I want
Avoid setting static Height and Width.
Use ColumnWidth="*"
to share the space between your DataGridColumns
<DataGrid x:Name="dg1" ColumnWidth="*"
HorizontalAlignment="Left" VerticalAlignment="Top" Margin="25,10,0,0"
EnableRowVirtualization="false" EnableColumnVirtualization="false"
FontFamily="2 badr" FontSize="20" FlowDirection="RightToLeft"
CanUserAddRows="False" CanUserReorderColumns="False" />
You can set the last column or one column of your Grid
with
<DataGridTextColumn Header="Surname"
Width="*"
Binding="{Binding Path=Surname,Mode=TwoWay}" IsReadOnly="True">
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Center" />
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>