1

May i know how to set the Datagrid Header background using the imagebrush? I know how method to set the background color (like the code snippet). But i need to know how about imagebrush? Any advice? Thanks

p/s: i found a sample here, but doesnt work.....

xaml code snippet:

<DataGrid.Resources>
      <Style TargetType="{x:Type DataGridColumnHeader}">
            <Setter Property="Background" Value="Yellow"/>
      </Style>
</DataGrid.Resources>
Community
  • 1
  • 1
Nerdynosaur
  • 1,798
  • 9
  • 32
  • 61

1 Answers1

1

If you mean how to write the Setter, you could use property element syntax for the Setter.Value property:

<DataGrid.Resources>
    <Style TargetType="{x:Type DataGridColumnHeader}">
        <Setter Property="Background">
            <Setter.Value>
                <ImageBrush ImageSource="..."/>
            </Setter.Value>
        </Setter>
    </Style>
</DataGrid.Resources>
Clemens
  • 123,504
  • 12
  • 155
  • 268