1

グローバルに定義された灰色のテキスト ブロック

<Style TargetType="{x:Type TextBlock}">
    <Setter Property="Foreground" Value="{StaticResource BR_SE_Gray}" />
    <Setter Property="TextTrimming" Value="CharacterEllipsis"/>
    <Setter Property="FontSize" Value="11"/>
    <Setter Property="FontFamily" Value="Arial Unicode MS"/>
    <Style.Triggers> 
        <Trigger Property="controls:TextBlockService.IsTextTrimmed" Value="True">
            <Setter Property="ToolTip" Value="{Binding Text, RelativeSource={RelativeSource Self}}"/>
        </Trigger>
    </Style.Triggers>

以下のコードで、グリッド ビューのヘッダー セルに黒色が必要です。上記のコード ブロックの foreground プロパティに黒色が必要です。グローバルに定義されたテキスト ブロックの色は灰色です。それをオーバーライドして、以下のコードで黒くする方法

<ContentControl x:Name="ContentPresenter"
    Grid.Column="0"
    Margin="{TemplateBinding Padding}"
    HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
    VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
    Content="{TemplateBinding Content}"
    ContentTemplate="{TemplateBinding ContentTemplate}"
    FontFamily="pack://application:,,,/Themes/#Arial Rounded MT Bold"
    FontWeight="Bold"
    Foreground="{TemplateBinding Foreground}"
    IsTabStop="{TemplateBinding IsTabStop}">

    <ContentControl.Style>
        <Style TargetType="{x:Type ContentControl}">
            <Setter Property="FontSize" Value="8" />
            <Setter Property="FontWeight" Value="Bold" />
            <Setter Property="FontFamily" Value="pack://application:,,,/Themes/#Arial Rounded MT Bold" />
            <Setter Property="HorizontalContentAlignment" Value="Stretch" />
            <Setter Property="VerticalContentAlignment" Value="Stretch" />
        </Style>
    </ContentControl.Style>

4

1 に答える 1