<Window x:Class="_4_WPF资源_2资源层次.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="_4_WPF资源_2资源层次" Height="450" Width="800">
    <Window.Resources>
    </Window.Resources>
    <StackPanel>
        <Button Margin="5" Padding="15 5">Button</Button>

        <Button Margin="5" Padding="15 5" FontWeight="Bold" FontSize="14">
            <Button.Resources>
                <ImageBrush x:Key="MyImageBrush" TileMode="Tile" ViewportUnits="Absolute" Viewport="0 0 10 10"
                            ImageSource="public/003540AH4M72.jpg" Opacity="0.3" />
            </Button.Resources>

            <Button.Background>
                <StaticResource ResourceKey="MyImageBrush" />
            </Button.Background>
            按钮
        </Button>

        <Button Background="{DynamicResource BunnyImageBrush}" Padding="5" Margin="5" FontWeight="Bold" FontSize="14">
            <Button.Resources>
                <ImageBrush x:Key="BunnyImageBrush" TileMode="Tile" ViewportUnits="Absolute" Viewport="0 0 32 32"
                            ImageSource="public/003540AH4M72.jpg" Opacity="0.3" />
            </Button.Resources>

            <Button.Content>按钮</Button.Content>
        </Button>

        <Button Background="{DynamicResource BunnyImageBrush}" Padding="5" Margin="5" FontWeight="Bold" FontSize="14">
            <Button.Resources>

                <ImageBrush x:Key="BunnyImageBrush" x:Shared="False" TileMode="Tile" ViewportUnits="Absolute"
                            Viewport="0 0 32 32"
                            ImageSource="public/003540AH4M72.jpg" Opacity="0.3" />
            </Button.Resources>

            <Button.Content>x:Shared="False" 是否共享资源</Button.Content>
        </Button>

        <Button Name="FindResource" Click="FindResource_OnClick">查找资源</Button>
    </StackPanel>
</Window>