<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:Fluent="clr-namespace:Fluent"
                    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                    mc:Ignorable="d">
    <ControlTemplate TargetType="{x:Type Fluent:GalleryItem}"
                     x:Key="GalleryItemControlTemplate">
        <Grid Background="Transparent">
            <Border x:Name="hoverBorder"
                    Visibility="Collapsed"
                    Background="{DynamicResource Fluent.Ribbon.Brushes.GalleryItem.MouseOver}" />

            <Border x:Name="selectedBorder"
                    Visibility="Collapsed"
                    Background="{DynamicResource Fluent.Ribbon.Brushes.GalleryItem.Selected}" />
            
            <Border x:Name="pressedBorder"
                    Visibility="Collapsed"
                    Background="{DynamicResource Fluent.Ribbon.Brushes.GalleryItem.Pressed}" />

            <ContentPresenter x:Name="contentPresenter"
                              Margin="1"
                              Opacity="1" />
        </Grid>
        <ControlTemplate.Triggers>
            <Trigger Property="IsEnabled"
                     Value="False">
                <Setter Property="Opacity"
                        TargetName="contentPresenter"
                        Value="0.5" />
            </Trigger>
            <Trigger Property="IsSelected"
                     Value="True">
                <Setter Property="Visibility"
                        TargetName="selectedBorder"
                        Value="Visible" />
            </Trigger>
            <Trigger Property="IsMouseOver"
                     Value="True">
                <Setter Property="Visibility"
                        TargetName="hoverBorder"
                        Value="Visible" />
            </Trigger>
            <Trigger Property="IsPressed"
                     Value="True">
                <Setter Property="Visibility"
                        TargetName="pressedBorder"
                        Value="Visible" />
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <Style x:Key="GalleryItemStyle"
           TargetType="{x:Type Fluent:GalleryItem}">
        <Setter Property="Template"
                Value="{DynamicResource GalleryItemControlTemplate}" />
    </Style>
</ResourceDictionary>