是否可以更改工具栏中按钮所在的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>
答案 0 :(得分:0)
您可以通过调用外部样式表
来完成此操作