0
votes

Is it possible to change the font color for the column headers in a datagrid?

I've already applied some styling which changes the background, but i can't figure out how to change the font color, not for the element, but for the header.

the XAML I'm using is from this thread: Change background color of Datagrid Header in Silverlight

1

1 Answers

0
votes

Hi add a style to your resource and set the style,

<Style x:Key="GridHeaderStyle" ControlTemplate 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>