<Window x:Class="_5_WPF样式和行为_6通过类型自动应用样式.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        mc:Ignorable="d"
        Icon="public/003540AH4M72.jpg" Title="_5_WPF样式和行为_6通过类型自动应用样式" Height="450" Width="800">
    <Window.Resources>
        <Style TargetType="Button">
            <Setter Property="FontFamily" Value="Times New Roman" />
            <Setter Property="FontSize" Value="18" />
            <Setter Property="FontWeight" Value="Bold" />
        </Style>
        
        <Style TargetType="TextBlock">
            <Setter Property="Background" Value="Pink"></Setter>
            <Setter Property="FontSize" Value="16"></Setter>
            <Setter Property="FontWeight" Value="Bold"></Setter>
            <Setter Property="Foreground" Value="Green"></Setter>
        </Style>
    </Window.Resources>

    <StackPanel>
        <Button Padding="5" Margin="5">用户自定义按钮</Button>
        <TextBlock Margin="5">自定义内容</TextBlock>

        <Button Padding="5" Margin="5" Style="{x:Null}">一个默认的设置</Button>
        <TextBlock Padding="5" Margin="5">更多默认的内容</TextBlock>

        <Button Padding="5" Margin="5">其他的按钮</Button>
    </StackPanel>
</Window>