<ResourceDictionary
    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">

    <!--  SimpleStyles: Menu  -->
    <!--<SnippetMenu>-->
    <Style x:Key="{x:Type Menu}" TargetType="{x:Type Menu}">
        <Setter Property="OverridesDefaultStyle" Value="True" />
        <Setter Property="SnapsToDevicePixels" Value="True" />

        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Menu}">
                    <Border BorderThickness="1" CornerRadius="8">
                        <StackPanel
                            ClipToBounds="True"
                            IsItemsHost="True"
                            Orientation="Horizontal" />
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <!--</SnippetMenu>-->

    <!--<SnippetContextMenu>-->
    <Style TargetType="{x:Type ContextMenu}">
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="OverridesDefaultStyle" Value="True" />
        <Setter Property="Grid.IsSharedSizeScope" Value="true" />
        <Setter Property="HasDropShadow" Value="True" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ContextMenu}">
                    <Border
                        x:Name="Border"
                        Background="{StaticResource MenuBg}"
                        BorderBrush="{StaticResource BorderBrush}"
                        BorderThickness="1"
                        CornerRadius="4">
                        <StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Cycle" />
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="HasDropShadow" Value="true">
                            <Setter TargetName="Border" Property="Padding" Value="5" />
                            <Setter TargetName="Border" Property="CornerRadius" Value="8" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--<SnippetMenuItem>-->
    <Style x:Key="{x:Static MenuItem.SeparatorStyleKey}" TargetType="{x:Type Separator}">
        <Setter Property="Height" Value="1" />
        <Setter Property="Margin" Value="0" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Separator}">
                    <Border BorderBrush="{StaticResource BorderBrush}" BorderThickness="2" />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <!--</Snippet9>-->

    <!--  TopLevelItem  -->
    <ControlTemplate x:Key="{x:Static MenuItem.TopLevelItemTemplateKey}" TargetType="{x:Type MenuItem}">
        <Border
            x:Name="Border"
            BorderThickness="1"
            CornerRadius="8">
            <Grid>
                <ContentPresenter
                    Margin="{TemplateBinding Padding}"
                    ContentSource="Header"
                    RecognizesAccessKey="True" />
            </Grid>
        </Border>
        <ControlTemplate.Triggers>
            <Trigger Property="IsHighlighted" Value="true">
                <Setter TargetName="Border" Property="Background" Value="transparent" />
            </Trigger>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="Foreground" Value="White" />
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <!--  SubmenuItem  -->
    <ControlTemplate x:Key="{x:Static MenuItem.SubmenuItemTemplateKey}" TargetType="{x:Type MenuItem}">
        <Border
            x:Name="Border"
            Padding="0,3,0,3"
            BorderThickness="4">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" SharedSizeGroup="Icon" />
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="Auto" SharedSizeGroup="Shortcut" />
                    <ColumnDefinition Width="13" />
                </Grid.ColumnDefinitions>
                <ContentPresenter
                    x:Name="Icon"
                    Margin="5,0,15,0"
                    VerticalAlignment="Center"
                    ContentSource="Icon" />
                <Border
                    x:Name="Check"
                    Width="13"
                    Height="13"
                    Margin="{TemplateBinding Padding}"
                    BorderThickness="0"
                    Visibility="Collapsed">
                    <Path
                        x:Name="CheckMark"
                        Width="15"
                        Height="15"
                        Data="F1M5.346,7.187C5.346,7.187 8.991,2.802 8.991,2.802 8.991,2.802 7.487,1.001 7.487,1.001 7.487,1.001 3.843,5.384 3.843,5.384 3.843,5.384 2.505,3.779 2.505,3.779 2.505,3.779 1.003,5.582 1.003,5.582 1.003,5.582 3.845,8.992 3.845,8.992 3.845,8.992 3.847,8.99 3.847,8.99 3.847,8.99 5.347,7.189 5.347,7.189 5.347,7.189 5.346,7.187 5.346,7.187z"
                        Fill="#FF088530"
                        SnapsToDevicePixels="False"
                        StrokeThickness="1"
                        Visibility="Hidden">
                        <Path.Stroke>
                            <SolidColorBrush Color="#FF088530" />
                        </Path.Stroke>
                    </Path>
                </Border>
                <ContentPresenter
                    x:Name="HeaderHost"
                    Grid.Column="1"
                    ContentSource="Header"
                    RecognizesAccessKey="True" />
                <TextBlock
                    x:Name="InputGestureText"
                    Grid.Column="2"
                    Margin="5,0,0,0"
                    Foreground="{StaticResource MainColorFadedBrush}"
                    Text="{TemplateBinding InputGestureText}" />
            </Grid>
        </Border>
        <ControlTemplate.Triggers>
            <Trigger Property="ButtonBase.Command" Value="{x:Null}" />
            <Trigger Property="Icon" Value="{x:Null}">
                <Setter TargetName="Icon" Property="Visibility" Value="Hidden" />
            </Trigger>
            <Trigger Property="IsChecked" Value="true">
                <Setter TargetName="CheckMark" Property="Visibility" Value="Visible" />
            </Trigger>
            <Trigger Property="IsCheckable" Value="true">
                <Setter TargetName="Check" Property="Visibility" Value="Visible" />
                <Setter TargetName="Icon" Property="Visibility" Value="Hidden" />
            </Trigger>
            <!--  Menu highligt/hover  -->
            <Trigger Property="IsHighlighted" Value="true">
                <Setter TargetName="Border" Property="Background" Value="{DynamicResource ChosenColorBrush}" />
                <Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource ChosenColorBrush}" />
            </Trigger>
            <Trigger Property="IsEnabled" Value="false">
                <Setter Property="Foreground" Value="{StaticResource FadeColorBrush}" />
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <ControlTemplate x:Key="{x:Static MenuItem.SubmenuHeaderTemplateKey}" TargetType="{x:Type MenuItem}">
        <!--  menu that goes into submenu  -->
        <Border
            x:Name="Border"
            Padding="3,7,0,7"
            CornerRadius="0">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" SharedSizeGroup="Icon" />
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="Auto" SharedSizeGroup="Shortcut" />
                    <ColumnDefinition Width="13" />
                </Grid.ColumnDefinitions>
                <ContentPresenter
                    x:Name="Icon"
                    Margin="5,0,15,0"
                    VerticalAlignment="Center"
                    ContentSource="Icon" />
                <ContentPresenter
                    x:Name="HeaderHost"
                    Grid.Column="1"
                    ContentSource="Header"
                    RecognizesAccessKey="True" />
                <TextBlock
                    x:Name="InputGestureText"
                    Grid.Column="2"
                    Margin="5,0,0,0"
                    DockPanel.Dock="Right"
                    Foreground="{StaticResource MainColorFadedBrush}"
                    Text="{TemplateBinding InputGestureText}" />
                <Path
                    Grid.Column="2"
                    HorizontalAlignment="Right"
                    VerticalAlignment="Center"
                    Data="F1M2,11.906C2,11.906 2,1.906 2,1.906 2,1.906 12,6.875 12,6.875">
                    <Path.Fill>
                        <SolidColorBrush Color="{StaticResource MainColorFaded}" />
                    </Path.Fill>
                </Path>
                <Popup
                    x:Name="Popup"
                    AllowsTransparency="True"
                    Focusable="False"
                    IsOpen="{TemplateBinding IsSubmenuOpen}"
                    OpacityMask="#7F000000"
                    Placement="Right"
                    PopupAnimation="Fade">
                    <!--  Sub level border  -->
                    <Border
                        x:Name="SubmenuBorder"
                        Background="{StaticResource MenuBg}"
                        BorderBrush="{StaticResource BorderBrush}"
                        BorderThickness="1"
                        CornerRadius="4"
                        SnapsToDevicePixels="True">
                        <StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Cycle" />
                    </Border>
                </Popup>
            </Grid>
        </Border>
        <ControlTemplate.Triggers>
            <Trigger Property="Icon" Value="{x:Null}">
                <Setter TargetName="Icon" Property="Visibility" Value="Collapsed" />
            </Trigger>
            <Trigger Property="IsHighlighted" Value="true">
                <Setter TargetName="Border" Property="Background" Value="{DynamicResource ChosenColorBrush}" />
            </Trigger>
            <Trigger Property="IsEnabled" Value="false">
                <Setter Property="Foreground" Value="{StaticResource MainColorFadedBrush}" />
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <!--  MenuItem Style  -->
    <Style x:Key="{x:Type MenuItem}" TargetType="{x:Type MenuItem}">
        <Setter Property="OverridesDefaultStyle" Value="True" />
        <Setter Property="FontFamily" Value="/PicView;component/Themes/Resources/fonts/#TeX Gyre Heros" />
        <Style.Triggers>
            <Trigger Property="Role" Value="TopLevelHeader">
                <Setter Property="Template" Value="{StaticResource {x:Static MenuItem.TopLevelHeaderTemplateKey}}" />
                <Setter Property="Grid.IsSharedSizeScope" Value="true" />
            </Trigger>
            <Trigger Property="Role" Value="TopLevelItem">
                <Setter Property="Template" Value="{StaticResource {x:Static MenuItem.TopLevelItemTemplateKey}}" />
            </Trigger>
            <Trigger Property="Role" Value="SubmenuHeader">
                <Setter Property="Template" Value="{StaticResource {x:Static MenuItem.SubmenuHeaderTemplateKey}}" />
            </Trigger>
            <Trigger Property="Role" Value="SubmenuItem">
                <Setter Property="Template" Value="{StaticResource {x:Static MenuItem.SubmenuItemTemplateKey}}" />
            </Trigger>
        </Style.Triggers>
    </Style>
    <!--</SnippetMenuItem>-->
</ResourceDictionary>