I am using the WPF Datagrid from Codeplex.
I am able to style the rows and with the following attributes in the dg:DataGrid element.
But how do I style the Headers? I find 100s of examples on the web which define Styles and use e.g. x:Key=’DataGridColumnHeaderStyle’ in the Datagrid element, but none of them seem to work for me.
How can I just e.g. change the Datagrid Header background to orange on this DataGrid?
<dg:DataGrid AlternatingRowBackground='#ddd' RowBackground='#eee' Name='theGrid1' VerticalAlignment='Stretch' AutoGenerateColumns='False' BorderBrush='#ddd'> ... </dg:DataGrid>
The style in this case is in a file called generic.xaml it should be loacted in a themems folder in your project.
find it and open it. inside you will find this line that controls the background of the column headers
basically its defined at another place in the template: this will explain TemlateBinding to you MSDN TemplateBinding
HTH, Eric