1

是否可以更改Button按钮存在于工具栏中的文本颜色?

我尝试了以下app.xaml

<Style TargetType="{x:Type Toolbar}"> <!-- this changes the background colour -->
    <Setter Property="Background" Value="AliceBlue"/> <!-- works -->
    <Setter Property="Foreground" Value="Red"/> <!-- doesn't work -->
</Style>

我试过了

<Style TargetType="{x:Type Button}"> <!-- this changes both colours -->
    <Setter Property="Background" Value="AliceBlue"/> <!-- works -->
    <Setter Property="Foreground" Value="Red"/> <!-- work -->
</Style>

工具栏定义为:

<ToolBarTray Background="White" Width="Auto">
    <ToolBar UseLayoutRounding="True" >
        <Button Content="Options"  Name="btnOptionsSettings" Click="btnOptionsSettings_Click" ></Button>
        <Button Content="Timer"    Name="btnTimerSettings" Click="btnTimerSettings_Click" ></Button>
        <Button Content="Blocks"   Name="btnBlocks" Click="btnBlocks_Click" ></Butto

    </ToolBar>
</ToolBarTray>
4

1 回答 1

0

你可以通过调用外部样式表来做到这一点

于 2012-04-18T11:31:18.803 回答