Does somebody know how to delete these lines in the last non-existing column in the WPF DataGrid? And also how to remove the last extra row?

Here is my xaml:
<WindowChrome.WindowChrome>
<WindowChrome CaptionHeight="30" />
</WindowChrome.WindowChrome>
<Border BorderBrush="#FF333333" BorderThickness="1">
<DataGrid Name="ParametersConfigGrid"
AutoGenerateColumns="False"
Loaded="ParametersConfigGrid_OnLoaded">
<DataGrid.Columns>
<DataGridTextColumn Header="Order" Binding="{Binding Order}" />
<DataGridTextColumn Header="Parameter Name" Binding="{Binding ParameterName}" />
<DataGridTextColumn Header="Designation" Binding="{Binding Designation}" />
</DataGrid.Columns>
</DataGrid>
</Border>
Thanks!
To get rid of the last row, in your DataGrid set the CanUserAddRows property to False:
<DataGrid Name="ParametersConfigGrid"
AutoGenerateColumns="False"
Loaded="ParametersConfigGrid_OnLoaded"
CanUserAddRows="False">
To get rid of the lines that extend past your columns, use a row style. You can just put the style into your Window Resources.
<Style TargetType="{x:Type DataGridRow}" BasedOn="{StaticResource {x:Type DataGridRow}}">
<Setter Property="BorderThickness" Value="0" />
</Style>
You may need to add a style for the cells if you want borders on cells. You would do it in a very similar way as for the row.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With