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這樣做的,比其他我使用任何工具。 –
最接近你將得到的默認樣式的副本,並改變它。 –