【问题标题】:Override TextBlock style of ContentPresenter in Metro theme在 Metro 主题中覆盖 ContentPresenter 的 TextBlock 样式
【发布时间】:2015-08-13 08:05:23
【问题描述】:

我在我的项目中使用 Metro 主题。

我有一个 TextBlock Base 的样式。

<Style x:Key="TextBlockText" TargetType="{x:Type TextBlock}">
    <Setter Property="Foreground" Value="#FF63798F"/>
    <Setter Property="FontSize" Value="14"/>
    <Setter Property="VerticalAlignment" Value="Bottom"/>
    <Setter Property="HorizontalAlignment" Value="Stretch"/>
</Style>

我想通过设置样式来更改 GridViewColumnHeader 的前景。我为其中的ContentPresenter 添加了TextBlock.Foreground="White"。但它不会改变颜色!

当我删除 TextBlock 样式时就可以了。

【问题讨论】:

    标签: c# wpf xaml styles


    【解决方案1】:
    1. 移除TextBlockTextForeground属性

    2. Windows添加样式


    3. 为 ContentPresenter 添加TextBlock.Foreground='White'

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-10-06
      • 1970-01-01
      • 1970-01-01
      • 2013-07-13
      • 1970-01-01
      • 2020-12-04
      相关资源
      最近更新 更多