-1
我只是不明白爲什麼我的代碼不起作用。而我只想改變一個Button的邊框,我看到有人使用TargetType="{x:Type Button}"
,這不符合我的要求! Set CornerRadius on button template的答案解釋瞭如何更改CornerRadius,我知道如何更改CornerRadius,但我真的不知道爲什麼我的代碼不適用於只有一個按鈕。如何更改按鈕邊框CornerRadius?
<Button Content="OK" BorderThickness="1">
<Button.Resources>
<Style TargetType="{x:Type Border}">
<Setter Property="CornerRadius" Value="10"/>
</Style>
</Button.Resources>
</Button>
[設置CornerRadius按鈕模板(HTTP://計算器。 com/questions/17681022/set-cornerradius-on-button-template) –
我在代碼中看到很多輸入錯誤。這是原因嗎?我糾正了所有這些,並且代碼在我的最後工作正常。 –
只有'Border'存在於'Button.Content'中,而不是其''Template'中,您的當前代碼纔會有效。 – AnjumSKhan