【问题标题】:Silverlight datagrid columnheader change font colorSilverlight datagrid columnheader 更改字体颜色
【发布时间】:2013-04-04 18:16:02
【问题描述】:

是否可以更改数据网格中列标题的字体颜色?

我已经应用了一些改变背景的样式,但我不知道如何改变字体颜色,不是针对元素,而是针对标题。

我使用的 XAML 来自这个线程:Change background color of Datagrid Header in Silverlight

【问题讨论】:

    标签: silverlight datagrid


    【解决方案1】:

    您好,为您的资源添加样式并设置样式,

    <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>
    

    【讨论】:

      猜你喜欢
      • 2010-12-03
      • 2023-03-05
      • 2016-06-16
      • 2015-04-16
      • 2010-09-24
      • 1970-01-01
      • 1970-01-01
      • 2023-03-13
      • 2015-02-23
      相关资源
      最近更新 更多