我在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>