1
我试图让一个按钮的方形边框,但每当我试图改变按钮它会删除相关的默认样式的风格它。WPF更改按钮的圆角半径同时使用按钮的默认样式消力
例如在这里我找到了一些代码来删除边框,并给它一个类似的外观,但它消除盘旋在它时动画按钮的触发器。
<Style x:Key="SquareButton" TargetType="{x:Type Button}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border BorderBrush="{TemplateBinding BorderBrush}" CornerRadius="0" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" >
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
如何在不删除默认样式的情况下对此特定按钮中的默认按钮样式进行更改?
你使用任何第三方工具进行主题化? – Karolis
(有些新的WPF)我在VS2012这样做的,比其他我使用任何工具。 –
最接近你将得到的默认样式的副本,并改变它。 –