【发布时间】:2014-12-12 15:57:45
【问题描述】:
有人可以向我解释为什么这不起作用吗? ToolBar 中的按钮未获取 Black BorderBrush 属性设置。我试过 TargetType="Button" 和 TargetType="{x:Type Button}" 但都不起作用。我对一系列标签做了几乎完全相同的事情,而且效果很好。我对 WPF 很陌生。这里有什么我对样式优先级不了解的地方吗?谢谢!
...Window Definition...
<Grid>
<Grid.Resources>
<Style TargetType="{x:Type Button}">
<Setter Property="BorderBrush" Value="Black" />
</Style>
</Grid.Resources>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<ToolBar Grid.Column="0" Grid.Row="0" Margin="0">
<Button>
<StackPanel Orientation="Horizontal" Height="Auto">
<Rectangle Width="16" Height="16" Fill="LightBlue" VerticalAlignment="Center"></Rectangle>
<Label Padding="0" VerticalAlignment="Center" HorizontalAlignment="Left">Redraw</Label>
</StackPanel>
</Button>
... More Buttons ...
</ToolBar>
</Grid>
... End Window Definition ...
【问题讨论】:
标签: wpf