Xaml: 按钮角半径全局样式
Xaml: Button corner radius global style
我在 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>
我在 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>