




В вашем объекте DataGrid измените свойство HeadersVisibility на столбец
<DataGrid HeadersVisibility = "Column" ... \>
Сосредоточьтесь на DataGridRowHeader, удалите линию, чтобы она исчезла, измените свойство Background, чтобы сделать ее черной или нужного вам цвета.
<Style x:Key = "DataGridRowStyle1" TargetType = "{x:Type DataGridRow}">
<Setter Property = "Background" Value = "{DynamicResource {x:Static Colors.Red}}"/>
<Setter Property = "SnapsToDevicePixels" Value = "true"/>
<Setter Property = "Validation.ErrorTemplate" Value = "{x:Null}"/>
<Setter Property = "ValidationErrorTemplate">
<Setter.Value>
<ControlTemplate>
<TextBlock Foreground = "Red" Margin = "2,0,0,0" Text = "!" VerticalAlignment = "Center"/>
</ControlTemplate>
</Setter.Value>
</Setter>
<Setter Property = "Template">
<Setter.Value>
<ControlTemplate TargetType = "{x:Type DataGridRow}">
<Border x:Name = "DGR_Border" Background = "{TemplateBinding Background}" BorderThickness = "{TemplateBinding BorderThickness}" BorderBrush = "{TemplateBinding BorderBrush}" SnapsToDevicePixels = "True">
<SelectiveScrollingGrid>
<SelectiveScrollingGrid.ColumnDefinitions>
<ColumnDefinition Width = "Auto"/>
<ColumnDefinition Width = "*"/>
</SelectiveScrollingGrid.ColumnDefinitions>
<SelectiveScrollingGrid.RowDefinitions>
<RowDefinition Height = "*"/>
<RowDefinition Height = "Auto"/>
</SelectiveScrollingGrid.RowDefinitions>
<DataGridCellsPresenter Grid.Column = "1" ItemsPanel = "{TemplateBinding ItemsPanel}" SnapsToDevicePixels = "{TemplateBinding SnapsToDevicePixels}"/>
<DataGridDetailsPresenter Grid.Column = "1" Grid.Row = "1" SelectiveScrollingGrid.SelectiveScrollingOrientation = "{Binding AreRowDetailsFrozen, Converter = {x:Static DataGrid.RowDetailsScrollingConverter}, ConverterParameter = {x:Static SelectiveScrollingOrientation.Vertical}, RelativeSource = {RelativeSource AncestorType = {x:Type DataGrid}}}" Visibility = "{TemplateBinding DetailsVisibility}"/>
<!--HERE: Change the background color property for the color, Or remove the whole line to make it disapper-->
<DataGridRowHeader Grid.RowSpan = "2" Background = "Black" SelectiveScrollingGrid.SelectiveScrollingOrientation = "Vertical" Visibility = "{Binding HeadersVisibility, Converter = {x:Static DataGrid.HeadersVisibilityConverter}, ConverterParameter = {x:Static DataGridHeadersVisibility.Row}, RelativeSource = {RelativeSource AncestorType = {x:Type DataGrid}}}"/>
</SelectiveScrollingGrid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property = "IsNewItem" Value = "True">
<Setter Property = "Margin" Value = "{Binding NewItemMargin, RelativeSource = {RelativeSource AncestorType = {x:Type DataGrid}}}"/>
</Trigger>
</Style.Triggers>
</Style>
Спасибо, это то, что я ищу. ЗаголовкиВидимость = "Столбец"