如何更改标签控件标签项的标题颜色[MahApps.Metro]

时间:2016-07-18 22:02:38

标签: wpf mahapps.metro

我有来自MahApps Metro的MetroAnimatedSingleRowTabControl。我想将标题的foregorund颜色从蓝色(由模板定义)更改为白色。

这就是我所拥有的:

<Grid x:Name="Body" Grid.Row="1" Margin="20,0,20,0">
    <controls:MetroAnimatedSingleRowTabControl>
        <controls:MetroAnimatedSingleRowTabControl>
            <controls:MetroTabItem Header="Server"/>
        </controls:MetroAnimatedSingleRowTabControl>
    </controls:MetroAnimatedSingleRowTabControl>
</Grid>

我想让Server标题以白色显示。

1 个答案:

答案 0 :(得分:4)

颜色在触发器中设置为TabItem template

获得密钥后,您可以覆盖资源绑定

<Grid x:Name="Body" Grid.Row="1" Margin="20,0,20,0">
    <Controls:MetroAnimatedSingleRowTabControl>
        <Controls:MetroAnimatedSingleRowTabControl.Resources>
            <SolidColorBrush x:Key="AccentColorBrush" Color="Red"/>
            <SolidColorBrush x:Key="HighlightBrush" Color="Orange"/>
        </Controls:MetroAnimatedSingleRowTabControl.Resources>
        <Controls:MetroTabItem Header="Server"/>
    </Controls:MetroAnimatedSingleRowTabControl>
</Grid>