I am trying to remove the far right GridLine in a WPF GridView. Here is an example .xaml
<Window x:Class="Pack.ExampleForm"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Pack"
Background="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"
Width="400" Height="300">
<DataGrid Margin="5" AutoGenerateColumns="False"
CanUserReorderColumns="False" HeadersVisibility="Column">
<DataGrid.Columns>
<DataGridTextColumn Binding="{x:Null}" CanUserResize="False"/>
<DataGridTextColumn Binding="{Binding Path=Key}" Header="Request Header" Width="*"/>
<DataGridTextColumn Binding="{Binding Path=Value}" Header="Value" Width="*"/>
</DataGrid.Columns>
<local:RequestHeader Key="Subject 1" Value="Body 1" />
<local:RequestHeader Key="Subject 1" Value="Body 1" />
</DataGrid>
</Window>
However this has the far right gridline, as show in the designer, circled in yellow.
Is there any way to remove this and have no border, as it is on the left side. Would prefer to do this in the .xaml if possible.
Hm, it is just sneaky workaround, but... :)
<DataGridTextColumn Binding="{Binding Value}" Width="*">
<DataGridTextColumn.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="Margin" Value="0,0,-1,0"></Setter>
</Style>
</DataGridTextColumn.CellStyle>
</DataGridTextColumn>