Search code examples
wpfxamlwpfdatagrid

WPF DataGrid RowHeader Style TargetType


DataGrid

Can I style this "Red" element?

I can set style on DataGridColumnHeader, DataGridRowHeader but I don't know how to set tyle on "red" element.


Solution

  • Do you mean the Top-Left corner of the DataGrid? It is a button type. You can apply a custom style to it.

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

    Here is the result.

    enter image description here