Я новичок в WPF и пытаюсь создать DataGrid с автоматически сгенерированными столбцами.
Теперь я стилизовал DataGrid так, как я хочу, но есть проблема, когда DG меньше, чем ParentContent, и это выглядит так.
Мне не нравится, как выглядит белая полоска справа от DG, но я не знаю, как изменить ее цвет. Мне бы хотелось, чтобы это выглядело как в DataGridView.
У меня вопрос: как я могу изменить цвет этой части Решетки?
СЕТЕВОЙ КОД
<DataGrid x:Class="Project.WPF.Grid"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Project.WPF"
mc:Ignorable="d"
d:DesignHeight="50" d:DesignWidth="200"
Name="dgv_grid"
Height="Auto" Width="Auto"
AutoGenerateColumns="True"
SelectionMode="Single"
ItemsSource="{Binding}"
DataContext="{Binding}"
Background="#ABABAB"
SelectionUnit="FullRow"
CanUserAddRows="False"
CanUserReorderColumns="False"
CanUserResizeColumns="True"
CanUserResizeRows="False"
IsReadOnly="True"
GridLinesVisibility="None"
HorizontalGridLinesBrush="#A0A0A0"
VerticalGridLinesBrush="#A0A0A0"
BorderThickness="1"
BorderBrush="#636363"
EnableColumnVirtualization="True"
RowHeaderWidth="0"
ColumnWidth="Auto"
Loaded="dgv_grid_Loaded"
AutoGeneratedColumns="dgv_grid_AutoGeneratedColumns"
AutoGeneratingColumn="dgv_grid_AutoGeneratingColumn"
MouseDoubleClick="dgv_grid_MouseDoubleClick"
SelectedCellsChanged="dgv_grid_SelectedCellsChanged">
<DataGrid.ColumnHeaderStyle>
<Style TargetType="{x:Type DataGridColumnHeader}">
<!--#region Triggers-->
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="BorderBrush" Value="#A0A0A0"/>
<Setter Property="BorderThickness" Value="1,1,1,1"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="BorderBrush" Value="#A0A0A0"/>
<Setter Property="BorderThickness" Value="1,1,1,1"/>
<Setter Property="Background" Value="#FFB6B6B6"/>
</Trigger>
</Style.Triggers>
<!--#endregion-->
<!--#region Setters-->
<!--<Setter Property="Height" Value="Auto"/>-->
<Setter Property="FontFamily" Value="Myanmar Text"/>
<Setter Property="FontSize" Value="12"/>
<Setter Property="FontWeight" Value="SemiBold"/>
<Setter Property="Background" Value="#ffffff"/>
<Setter Property="BorderThickness" Value="1,1,0,1"/>
<Setter Property="Padding" Value="7,5,5,0"/>
<Setter Property="BorderBrush" Value="#e5e5e5"/>
<Setter Property="TextBlock.TextAlignment" Value="Left"/>
<Setter Property="VerticalAlignment" Value="Stretch"/>
<Setter Property="TextBlock.TextWrapping" Value="WrapWithOverflow"/>
<!--#endregion-->
</Style>
</DataGrid.ColumnHeaderStyle>
<DataGrid.RowHeaderStyle>
<Style TargetType="{x:Type DataGridRowHeader}">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="BorderBrush" Value="#A0A0A0"/>
<Setter Property="BorderThickness" Value="1,1,1,1"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="BorderBrush" Value="#A0A0A0"/>
<Setter Property="BorderThickness" Value="1,1,1,1"/>
<Setter Property="Background" Value="#FFB6B6B6"/>
</Trigger>
</Style.Triggers>
<Setter Property="Background" Value="#ffffff"/>
<Setter Property="BorderBrush" Value="#e5e5e5"/>
<Setter Property="BorderThickness" Value="1,1,1,0"/>
<Setter Property="Width" Value="33"/>
<Setter Property="Height" Value="20"/>
</Style>
</DataGrid.RowHeaderStyle>
<DataGrid.CellStyle>
<Style TargetType="{x:Type DataGridCell}">
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="#FF7B7E99"/>
<Setter Property="BorderThickness" Value="0"/>
</Trigger>
<Trigger Property="IsKeyboardFocusWithin" Value="True">
<Setter Property="Background" Value="#FF4DA2D8"/>
<Setter Property="BorderThickness" Value="0"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Background" Value="#ABABAB"/>
</Trigger>
</Style.Triggers>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type DataGridCell}">
<Grid Background="{TemplateBinding Background}">
<Border BorderBrush="#a0a0a0" BorderThickness="1,1,0,0"/>
<ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center" Margin="6,2,6,2"/>
<ContentControl FontFamily="Myanmar Text" FontSize="20"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</DataGrid.CellStyle>