Xaml:按钮角半径全局样式



我在xaml中有以下代码来设置按钮的角半径。如何为应用程序中的所有按钮定义全局样式以具有恒定的角半径?

<Button Content="Exit" MinWidth="65" Background="#b82c2c" Foreground="#fff" BorderThickness="0" 
Height="25" VerticalAlignment="Bottom" >
<Button.Resources>
<Style TargetType="Border">
<Setter Property="CornerRadius" Value="5"/>
</Style>
</Button.Resources>
</Button>

Style.Resources中声明一个带有边框样式的全局按钮样式:

<Application.Resources>
<Style TargetType="Button">
<Style.Resources>
<Style TargetType="Border">
<Setter Property="CornerRadius" Value="5"/>
</Style>
</Style.Resources>
</Style>
</Application.Resources>

最新更新