0

I have below code in xaml to set the corner radius of buttons. How can i define a global style for all buttons in application to have a constant corner radius?

 <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>
  • @Clemens It's not working for border in App.xaml. Pay attention to the structure. when i set the *Property="Border"* it says member is not recognized or is not accessible. – Armin Torkashvand Jun 04 '20 at 09:48

1 Answers1

2

Declare a global Button Style with a Border Style in Style.Resources:

<Application.Resources>
    <Style TargetType="Button">
        <Style.Resources>
            <Style TargetType="Border">
                <Setter Property="CornerRadius" Value="5"/>
            </Style>
        </Style.Resources>
    </Style>
</Application.Resources>
Clemens
  • 123,504
  • 12
  • 155
  • 268