<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:p="http://prismlibrary.com/"
                    xmlns:m="http://metro.mahapps.com/winfx/xaml/controls"
                    xmlns:mi="http://metro.mahapps.com/winfx/xaml/iconpacks"
                    xmlns:controls="clr-namespace:MyPad.Views.Controls">

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="./Sizes.xaml"/>
        <ResourceDictionary Source="./Common.xaml"/>
    </ResourceDictionary.MergedDictionaries>

    <!-- ボタン (ボーダーレス) -->
    <Style x:Key="Common.ChromelessButton" TargetType="{x:Type Button}" BasedOn="{StaticResource MahApps.Styles.Button.Chromeless}">
    </Style>

    <!-- ボタン (アクセント) -->
    <Style x:Key="Common.AccentButton" TargetType="{x:Type Button}" BasedOn="{StaticResource Common.Button}">
        <Setter Property="Foreground" Value="White"/>
        <Setter Property="Background" Value="{DynamicResource MahApps.Brushes.Accent2}"/>
        <Setter Property="BorderBrush" Value="{DynamicResource MahApps.Brushes.Accent2}"/>
        <Setter Property="FontWeight" Value="Bold"/>
        <Style.Triggers>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Foreground" Value="{DynamicResource MahApps.Brushes.Gray2}"/>
                <Setter Property="Background" Value="{DynamicResource MahApps.Brushes.Accent3}"/>
            </Trigger>
            <Trigger Property="IsFocused" Value="True">
                <Setter Property="Background" Value="{DynamicResource MahApps.Brushes.Accent3}"/>
            </Trigger>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="Background" Value="{DynamicResource MahApps.Brushes.Accent4}"/>
            </Trigger>
        </Style.Triggers>
    </Style>

    <!-- ボタン (警告) -->
    <Style x:Key="Common.DangerButton" TargetType="{x:Type Button}" BasedOn="{StaticResource Common.Button}">
        <Setter Property="Foreground" Value="White"/>
        <Setter Property="Background" Value="{DynamicResource MahApps.Brushes.ValidationSummary2}"/>
        <Setter Property="BorderBrush" Value="{DynamicResource MahApps.Brushes.ValidationSummary2}"/>
        <Setter Property="FontWeight" Value="Bold"/>
        <Style.Triggers>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Foreground" Value="{DynamicResource MahApps.Brushes.Gray2}"/>
                <Setter Property="Background" Value="{DynamicResource MahApps.Brushes.ValidationSummary3}"/>
            </Trigger>
            <Trigger Property="IsFocused" Value="True">
                <Setter Property="Background" Value="{DynamicResource MahApps.Brushes.ValidationSummary3}"/>
            </Trigger>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="Background" Value="{DynamicResource MahApps.Brushes.ValidationSummary4}"/>
            </Trigger>
        </Style.Triggers>
    </Style>

    <!-- ドロップダウンボタン (アクセント) -->
    <Style x:Key="Common.AccentDropDownButton" TargetType="{x:Type m:DropDownButton}" BasedOn="{StaticResource Common.DropDownButton}">
        <Setter Property="Foreground" Value="White"/>
        <Setter Property="Background" Value="{DynamicResource MahApps.Brushes.Accent2}"/>
        <Setter Property="BorderBrush" Value="{DynamicResource MahApps.Brushes.Accent2}"/>
        <Setter Property="FontWeight" Value="Bold"/>
        <Style.Triggers>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Foreground" Value="{DynamicResource MahApps.Brushes.Gray2}"/>
                <Setter Property="Background" Value="{DynamicResource MahApps.Brushes.Accent3}"/>
            </Trigger>
            <Trigger Property="IsFocused" Value="True">
                <Setter Property="Background" Value="{DynamicResource MahApps.Brushes.Accent3}"/>
            </Trigger>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="Background" Value="{DynamicResource MahApps.Brushes.Accent4}"/>
            </Trigger>
            <Trigger Property="IsExpanded" Value="True">
                <Setter Property="Background" Value="{DynamicResource MahApps.Brushes.FlatButton.PressedBackground}"/>
            </Trigger>
        </Style.Triggers>
    </Style>

    <!-- ドロップダウンボタン (警告) -->
    <Style x:Key="Common.DangerDropDownButton" TargetType="{x:Type m:DropDownButton}" BasedOn="{StaticResource Common.DropDownButton}">
        <Setter Property="Foreground" Value="White"/>
        <Setter Property="Background" Value="{DynamicResource MahApps.Brushes.ValidationSummary2}"/>
        <Setter Property="BorderBrush" Value="{DynamicResource MahApps.Brushes.ValidationSummary2}"/>
        <Setter Property="FontWeight" Value="Bold"/>
        <Style.Triggers>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Foreground" Value="{DynamicResource MahApps.Brushes.Gray2}"/>
                <Setter Property="Background" Value="{DynamicResource MahApps.Brushes.ValidationSummary3}"/>
            </Trigger>
            <Trigger Property="IsFocused" Value="True">
                <Setter Property="Background" Value="{DynamicResource MahApps.Brushes.ValidationSummary3}"/>
            </Trigger>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="Background" Value="{DynamicResource MahApps.Brushes.ValidationSummary4}"/>
            </Trigger>
            <Trigger Property="IsExpanded" Value="True">
                <Setter Property="Background" Value="{DynamicResource MahApps.Brushes.FlatButton.PressedBackground}"/>
            </Trigger>
        </Style.Triggers>
    </Style>

    <!-- サークルボタン -->
    <Style x:Key="Common.CircleButton" TargetType="{x:Type ButtonBase}" BasedOn="{StaticResource MahApps.Styles.Button.Circle}">
        <Setter Property="Width" Value="{DynamicResource Common.Size.CircleButton}"/>
        <Setter Property="Height" Value="{DynamicResource Common.Size.CircleButton}"/>
        <Style.Resources>
            <Style TargetType="{x:Type mi:PackIconModern}">
                <Setter Property="Width" Value="{DynamicResource Common.Size.CircleButtonIcon}"/>
                <Setter Property="Height" Value="{DynamicResource Common.Size.CircleButtonIcon}"/>
            </Style>
            <Style TargetType="{x:Type mi:PackIconMaterial}">
                <Setter Property="Width" Value="{DynamicResource Common.Size.CircleButtonIcon}"/>
                <Setter Property="Height" Value="{DynamicResource Common.Size.CircleButtonIcon}"/>
            </Style>
            <Style TargetType="{x:Type mi:PackIconFontAwesome}">
                <Setter Property="Width" Value="{DynamicResource Common.Size.CircleButtonIcon}"/>
                <Setter Property="Height" Value="{DynamicResource Common.Size.CircleButtonIcon}"/>
            </Style>
            <Style TargetType="{x:Type mi:PackIconOcticons}">
                <Setter Property="Width" Value="{DynamicResource Common.Size.CircleButtonIcon}"/>
                <Setter Property="Height" Value="{DynamicResource Common.Size.CircleButtonIcon}"/>
            </Style>
        </Style.Resources>
    </Style>

    <!-- サークルボタン (アクセント) -->
    <Style x:Key="Common.CircleAccentButton" TargetType="{x:Type ButtonBase}" BasedOn="{StaticResource Common.CircleButton}">
        <Setter Property="Foreground" Value="{DynamicResource MahApps.Brushes.Accent}"/>
        <Setter Property="BorderBrush" Value="{DynamicResource MahApps.Brushes.Accent}"/>
    </Style>

    <!-- サークルボタン (警告) -->
    <Style x:Key="Common.CircleDangerButton" TargetType="{x:Type ButtonBase}" BasedOn="{StaticResource Common.CircleButton}">
        <Setter Property="Foreground" Value="{DynamicResource MahApps.Brushes.ValidationSummary2}"/>
        <Setter Property="BorderBrush" Value="{DynamicResource MahApps.Brushes.ValidationSummary2}"/>
    </Style>

    <!-- サークルトグルボタン -->
    <Style x:Key="Common.CircleToggleButton" TargetType="{x:Type ToggleButton}" BasedOn="{StaticResource MahApps.Styles.ToggleButton.Circle}">
        <Setter Property="Width" Value="{DynamicResource Common.Size.CircleButton}"/>
        <Setter Property="Height" Value="{DynamicResource Common.Size.CircleButton}"/>
        <Style.Resources>
            <Style x:Key="Common.CirclePackIcon" TargetType="{x:Type mi:PackIconBase}" BasedOn="{StaticResource Common.PackIcon}">
                <Setter Property="Width" Value="{DynamicResource Common.Size.CircleButtonIcon}"/>
                <Setter Property="Height" Value="{DynamicResource Common.Size.CircleButtonIcon}"/>
            </Style>
            <Style TargetType="{x:Type mi:PackIconBootstrapIcons}" BasedOn="{StaticResource Common.CirclePackIcon}"/>
            <Style TargetType="{x:Type mi:PackIconBoxIcons}"       BasedOn="{StaticResource Common.CirclePackIcon}"/>
            <Style TargetType="{x:Type mi:PackIconCodicons}"       BasedOn="{StaticResource Common.CirclePackIcon}"/>
            <Style TargetType="{x:Type mi:PackIconCoolicons}"      BasedOn="{StaticResource Common.CirclePackIcon}"/>
            <Style TargetType="{x:Type mi:PackIconEntypo}"         BasedOn="{StaticResource Common.CirclePackIcon}"/>
            <Style TargetType="{x:Type mi:PackIconEvaIcons}"       BasedOn="{StaticResource Common.CirclePackIcon}"/>
            <Style TargetType="{x:Type mi:PackIconFeatherIcons}"   BasedOn="{StaticResource Common.CirclePackIcon}"/>
            <Style TargetType="{x:Type mi:PackIconFileIcons}"      BasedOn="{StaticResource Common.CirclePackIcon}"/>
            <Style TargetType="{x:Type mi:PackIconFontaudio}"      BasedOn="{StaticResource Common.CirclePackIcon}"/>
            <Style TargetType="{x:Type mi:PackIconFontAwesome}"    BasedOn="{StaticResource Common.CirclePackIcon}"/>
            <Style TargetType="{x:Type mi:PackIconFontisto}"       BasedOn="{StaticResource Common.CirclePackIcon}"/>
            <Style TargetType="{x:Type mi:PackIconForkAwesome}"    BasedOn="{StaticResource Common.CirclePackIcon}"/>
            <Style TargetType="{x:Type mi:PackIconIonicons}"       BasedOn="{StaticResource Common.CirclePackIcon}"/>
            <Style TargetType="{x:Type mi:PackIconJamIcons}"       BasedOn="{StaticResource Common.CirclePackIcon}"/>
            <Style TargetType="{x:Type mi:PackIconMaterialDesign}" BasedOn="{StaticResource Common.CirclePackIcon}"/>
            <Style TargetType="{x:Type mi:PackIconMaterial}"       BasedOn="{StaticResource Common.CirclePackIcon}"/>
            <Style TargetType="{x:Type mi:PackIconMaterialLight}"  BasedOn="{StaticResource Common.CirclePackIcon}"/>
            <Style TargetType="{x:Type mi:PackIconMicrons}"        BasedOn="{StaticResource Common.CirclePackIcon}"/>
            <Style TargetType="{x:Type mi:PackIconModern}"         BasedOn="{StaticResource Common.CirclePackIcon}"/>
            <Style TargetType="{x:Type mi:PackIconOcticons}"       BasedOn="{StaticResource Common.CirclePackIcon}"/>
            <Style TargetType="{x:Type mi:PackIconPicolIcons}"     BasedOn="{StaticResource Common.CirclePackIcon}"/>
            <Style TargetType="{x:Type mi:PackIconPixelartIcons}"  BasedOn="{StaticResource Common.CirclePackIcon}"/>
            <Style TargetType="{x:Type mi:PackIconRadixIcons}"     BasedOn="{StaticResource Common.CirclePackIcon}"/>
            <Style TargetType="{x:Type mi:PackIconRemixIcon}"      BasedOn="{StaticResource Common.CirclePackIcon}"/>
            <Style TargetType="{x:Type mi:PackIconRPGAwesome}"     BasedOn="{StaticResource Common.CirclePackIcon}"/>
            <Style TargetType="{x:Type mi:PackIconSimpleIcons}"    BasedOn="{StaticResource Common.CirclePackIcon}"/>
            <Style TargetType="{x:Type mi:PackIconTypicons}"       BasedOn="{StaticResource Common.CirclePackIcon}"/>
            <Style TargetType="{x:Type mi:PackIconUnicons}"        BasedOn="{StaticResource Common.CirclePackIcon}"/>
            <Style TargetType="{x:Type mi:PackIconVaadinIcons}"    BasedOn="{StaticResource Common.CirclePackIcon}"/>
            <Style TargetType="{x:Type mi:PackIconWeatherIcons}"   BasedOn="{StaticResource Common.CirclePackIcon}"/>
            <Style TargetType="{x:Type mi:PackIconZondicons}"      BasedOn="{StaticResource Common.CirclePackIcon}"/>
        </Style.Resources>
    </Style>

    <!-- オーバーレイ -->
    <Style x:Key="Common.Overlay" TargetType="{x:Type Border}">
        <Setter Property="Opacity"    Value="0.9"/>
        <Setter Property="Background" Value="{DynamicResource MahApps.Brushes.Gray.SemiTransparent}"/>
        <Style.Resources>
            <Style TargetType="{x:Type TextBlock}" BasedOn="{StaticResource Common.TextBlock}">
                <Setter Property="Foreground" Value="{DynamicResource MahApps.Brushes.ThemeForeground}"/>
                <Setter Property="FontSize"   Value="{DynamicResource MahApps.Font.Size.Dialog.Title}"/>
            </Style>
        </Style.Resources>
    </Style>

    <!-- ウィンドウコマンド -->    
    <m:WindowButtonCommands x:Key="_windowButtonCommands" x:Shared="False">
        <m:WindowButtonCommands.Style>
            <Style TargetType="{x:Type m:WindowButtonCommands}" BasedOn="{StaticResource MahApps.Styles.WindowButtonCommands}">
                <Style.Resources>
                    <Style x:Key="_buttonDark" TargetType="{x:Type Button}" BasedOn="{StaticResource MahApps.Styles.Button.MetroWindow.Dark}">
                        <Setter Property="Foreground" Value="{DynamicResource MahApps.Brushes.Gray1}"/>
                    </Style>
                    <Style x:Key="_buttonLight" TargetType="{x:Type Button}" BasedOn="{StaticResource MahApps.Styles.Button.MetroWindow.Light}">
                        <Setter Property="Foreground" Value="{DynamicResource MahApps.Brushes.Gray1}"/>
                    </Style>
                </Style.Resources>
                <Setter Property="DarkCloseButtonStyle"  Value="{DynamicResource _buttonDark}"/>
                <Setter Property="DarkMaxButtonStyle"    Value="{DynamicResource _buttonDark}"/>
                <Setter Property="DarkMinButtonStyle"    Value="{DynamicResource _buttonDark}"/>
                <Setter Property="LightCloseButtonStyle" Value="{DynamicResource _buttonLight}"/>
                <Setter Property="LightMaxButtonStyle"   Value="{DynamicResource _buttonLight}"/>
                <Setter Property="LightMinButtonStyle"   Value="{DynamicResource _buttonLight}"/>
                <Setter Property="Height"                Value="{StaticResource Const.WindowButtonCommands.Height}"/>
                <Setter Property="VerticalAlignment"     Value="Top"/>
            </Style>
        </m:WindowButtonCommands.Style>
    </m:WindowButtonCommands>

    <!-- ウィンドウ -->
    <Style x:Key="Common.Window" TargetType="{x:Type m:MetroWindow}" BasedOn="{StaticResource {x:Type m:MetroWindow}}">
        <Setter Property="MinHeight"                           Value="200"/>
        <Setter Property="MinWidth"                            Value="200"/>
        <Setter Property="ResizeBorderThickness"               Value="7"/>
        <Setter Property="WindowTitleBrush"                    Value="{x:Null}"/>
        <Setter Property="BorderBrush"                         Value="{DynamicResource MahApps.Brushes.Accent}"/>
        <Setter Property="GlowBrush"                           Value="{DynamicResource MahApps.Brushes.Accent}"/>
        <Setter Property="NonActiveWindowTitleBrush"           Value="{x:Null}"/>
        <Setter Property="NonActiveBorderBrush"                Value="{DynamicResource MahApps.Brushes.Accent3}"/>
        <Setter Property="NonActiveGlowBrush"                  Value="{DynamicResource MahApps.Brushes.Accent3}"/>
        <Setter Property="TitleForeground"                     Value="{DynamicResource MahApps.Brushes.ThemeForeground}"/>
        <Setter Property="TitleCharacterCasing"                Value="Normal"/>
        <Setter Property="LeftWindowCommandsOverlayBehavior"   Value="Never"/>
        <Setter Property="RightWindowCommandsOverlayBehavior"  Value="Never"/>
        <Setter Property="WindowButtonCommandsOverlayBehavior" Value="Never"/>
        <Setter Property="WindowButtonCommands">
            <Setter.Value>
                <StaticResource ResourceKey="_windowButtonCommands"/>
            </Setter.Value>
        </Setter>
        <Setter Property="TitleTemplate">
            <Setter.Value>
                <DataTemplate>
                    <TextBlock Margin="8 -1 1 0"
                               VerticalAlignment="Center"
                               FontFamily="{Binding FontFamily, Mode=OneWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}"
                               FontSize="{DynamicResource MahApps.Font.Size.Window.Title}"
                               Text="{TemplateBinding Content}"
                               TextTrimming="CharacterEllipsis" />
                </DataTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- ダイアログ -->
    <Style x:Key="Common.Dialog" TargetType="{x:Type m:MetroWindow}" BasedOn="{StaticResource Common.Window}">
        <Setter Property="Width"                          Value="300"/>
        <Setter Property="MaxWidth"                       Value="500"/>
        <Setter Property="MinHeight"                      Value="170"/>
        <Setter Property="NonActiveBorderBrush"           Value="{DynamicResource MahApps.Brushes.Gray}"/>
        <Setter Property="NonActiveGlowBrush"             Value="{DynamicResource MahApps.Brushes.Gray}"/>
        <Setter Property="ShowSystemMenu"                 Value="False"/>
        <Setter Property="ShowSystemMenuOnRightClick"     Value="False"/>
        <Setter Property="ShowInTaskbar"                  Value="False"/>
        <Setter Property="SizeToContent"                  Value="WidthAndHeight"/>
        <Setter Property="ResizeMode"                     Value="NoResize"/>
        <Setter Property="p:Dialog.WindowStartupLocation" Value="CenterScreen"/>
        <Style.Resources>
            <Style TargetType="{x:Type TextBlock}" BasedOn="{StaticResource Common.TextBlock}">
                <Setter Property="FontSize"     Value="{DynamicResource MahApps.Font.Size.Dialog.Message}"/>
                <Setter Property="TextWrapping" Value="WrapWithOverflow"/>
            </Style>
            <Style TargetType="{x:Type Button}" BasedOn="{StaticResource Common.Button}">
                <Setter Property="MinWidth" Value="80"/>
            </Style>
        </Style.Resources>
    </Style>

    <!-- ダイアログコンテンツ -->
    <Style x:Key="Common.DialogContent" TargetType="{x:Type UserControl}">
        <Style.Resources>
            <Style TargetType="{x:Type TextBlock}" BasedOn="{StaticResource Common.TextBlock}">
                <Setter Property="FontFamily" Value="{Binding FontFamily, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"/>
            </Style>
            <Style TargetType="{x:Type ComboBox}" BasedOn="{StaticResource Common.ComboBox}">
                <Setter Property="FontFamily" Value="{Binding FontFamily, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"/>
            </Style>
            <Style TargetType="{x:Type controls:NumericUpDown}" BasedOn="{StaticResource Common.NumericUpDown}">
                <Setter Property="FontFamily" Value="{Binding FontFamily, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"/>
            </Style>
            <Style TargetType="{x:Type Button}" BasedOn="{StaticResource Common.Button}">
                <Setter Property="FontFamily" Value="{Binding FontFamily, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"/>
            </Style>

            <Style x:Key="_accentButton" TargetType="{x:Type Button}" BasedOn="{StaticResource Common.AccentButton}">
                <Setter Property="FontFamily" Value="{Binding FontFamily, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"/>
            </Style>
            <Style x:Key="Common.AccentButton" TargetType="{x:Type Button}" BasedOn="{StaticResource _accentButton}"/>
        </Style.Resources>
    </Style>

</ResourceDictionary>