Reputation: 5454
As you can see the bottom border of the last row in data grid falls near the border of the data grid and makes it look ugly. How can I fix this?
<DataGrid HeadersVisibility="Column"
ItemsSource="{Binding Path=DevLengths}"
AutoGenerateColumns="False"
CanUserAddRows="False"
CanUserDeleteRows="False"
CanUserReorderColumns="False"
CanUserResizeRows="False"
CanUserResizeColumns="False">
<DataGrid.Columns>
<DataGridTextColumn Header="Size" Binding="{Binding Id}" IsReadOnly="True"/>
<DataGridTextColumn Header="Length of Splice" Binding="{Binding LengthOfSplice}"/>
<DataGridTextColumn Header="Length of Development" Binding="{Binding LengthOfDevelopment}"/>
<DataGridTextColumn Header="Ldh" Binding="{Binding Ldh}"/>
<DataGridTextColumn Header="Length of Hook" Binding="{Binding LengthOfHook}" Width="*">
<DataGridTextColumn.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="Margin" Value="0,0,-1,0"/>
</Style>
</DataGridTextColumn.CellStyle>
</DataGridTextColumn>
</DataGrid.Columns>
</DataGrid>
Upvotes: 0
Views: 2804
Reputation: 1735
You can set BorderThickness="1,1,1,0"
for your DataGrid
. This will remove the bottom border and set the the top, left, right to the default of 1.
So your new code would be:
<DataGrid HeadersVisibility="Column"
ItemsSource="{Binding Path=DevLengths}"
AutoGenerateColumns="False"
CanUserAddRows="False"
CanUserDeleteRows="False"
CanUserReorderColumns="False"
CanUserResizeRows="False"
CanUserResizeColumns="False"
BorderThickness="1,1,1,0">
<DataGrid.Columns>
<DataGridTextColumn Header="Size" Binding="{Binding Id}" IsReadOnly="True"/>
<DataGridTextColumn Header="Length of Splice" Binding="{Binding LengthOfSplice}"/>
<DataGridTextColumn Header="Length of Development" Binding="{Binding LengthOfDevelopment}"/>
<DataGridTextColumn Header="Ldh" Binding="{Binding Ldh}"/>
<DataGridTextColumn Header="Length of Hook" Binding="{Binding LengthOfHook}" Width="*">
<DataGridTextColumn.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="Margin" Value="0,0,-1,0"/>
</Style>
</DataGridTextColumn.CellStyle>
</DataGridTextColumn>
</DataGrid.Columns>
</DataGrid>
Upvotes: 1