I am trying to affect the background pattern on a DataGrid in Silverlight 4. I have the following style:
<Style x:Key="DashboardGridHeaderStyle"
TargetType="primitives:DataGridColumnHeader">
<Setter Property="FontSize"
Value="14" />
<Setter Property="FontWeight"
Value="Bold" />
<Setter Property="Foreground"
Value="{StaticResource xrxGray_I}" />
<Setter Property="Background"
Value="{StaticResource xrxGray_B}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<Grid Height="50" Width="100">
<TextBlock Text="{TemplateBinding Header}" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
This causes an exception when it is applied. This is caused by the Template setter. Does anyone know how to change the background of the column header (I want a solid color instead of the default gradient)?
Thanks for any help.