<Style TargetType="{x:Type DataGrid}">
    <Setter Property="RowStyle">
        <Setter.Value>
            <Style TargetType="{x:Type DataGridRow}">
                <Setter Property="BorderBrush"
                        Value="{StaticResource ContentBgColorKey}"/>
                <Setter Property="BorderThickness" Value="0"/>
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type DataGridRow}">
                            <Border x:Name="DGR_Border"
                                    Background="{TemplateBinding Background}"
                                    BorderBrush="{TemplateBinding BorderBrush}"
                                    BorderThickness="{TemplateBinding BorderThickness}"
                                    SnapsToDevicePixels="True">
                                <Grid>
                                    <SelectiveScrollingGrid>
                                        <SelectiveScrollingGrid.ColumnDefinitions>
                                            <ColumnDefinition Width="Auto"/>
                                            <ColumnDefinition/>
                                        </SelectiveScrollingGrid.ColumnDefinitions>
                                                
                                        <DataGridCellsPresenter Grid.Column="1"
                                                                ItemsPanel="{TemplateBinding ItemsPanel}"
                                                                SnapsToDevicePixels="True"/>

                                        <DataGridRowHeader
                                            SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical"
                                            Visibility="{Binding HeadersVisibility,
                                                                 Converter={x:Static DataGrid.HeadersVisibilityConverter},
                                                                 ConverterParameter={x:Static DataGridHeadersVisibility.Row},
                                                                 RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
                                    </SelectiveScrollingGrid>

                                    <Rectangle x:Name="PART_Box"
                                               Margin="0,0,1,0"
                                               Stroke="Orange"
                                               StrokeThickness="1"
                                               Fill="{x:Null}"
                                               Visibility="Hidden"/>
                                </Grid>
                            </Border>
                            <ControlTemplate.Triggers>
                                <Trigger Property="IsSelected" Value="True">
                                <Setter TargetName="PART_Box"
                                        Property="Visibility" Value="Visible"/>
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
        </Setter.Value>
    </Setter>
</Style>

 

<Style TargetType="{x:Type DataGrid}">
    <Style.Resources>
        <Style x:Key="{ComponentResourceKey ResourceId=DataGridSelectAllButtonStyle, TypeInTargetAssembly={x:Type DataGrid}}"
               TargetType="{x:Type Button}">
            <Setter Property="Background" Value="Transparent"/>
            <Setter Property="BorderThickness" Value="0"/>
        </Style>
    </Style.Resources>
</Style>

+ Recent posts