Button style as Window resource

image_pdfimage_print


   
       

<Window x:Class="Styles.AutomaticStyles"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="AutomaticStyles" Height="300" Width="300"
    >
  <Window.Resources>
    <Style TargetType="Button">
      <Setter Property="FontFamily" Value="Times New Roman" />
      <Setter Property="FontSize" Value="18" />
      <Setter Property="FontWeight" Value="Bold" />
    </Style>
  </Window.Resources>

  <StackPanel Margin="5">
    <Button Padding="5" Margin="5">Customized Button</Button>
    <Button Padding="5" Margin="5" Style="{x:Null}">A Normal Button</Button>
    <Button Padding="5" Margin="5">Another Customized Button</Button>
  </StackPanel>
</Window>