<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
                    xmlns:Converters="clr-namespace:Vulnerator.View.Converter"
                    xmlns:IconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks"
                    xmlns:local="clr-namespace:Vulnerator.View.Styles">

    <!--  WindowButtonCommands control templates  -->

    <ControlTemplate x:Key="Vulnerator.Templates.WindowButtonCommands.Win10"
                     TargetType="{x:Type Controls:WindowButtonCommands}">
        <StackPanel Orientation="Horizontal">
            <Button x:Name="PART_Min"
                    Width="48"
                    Height="48"
                    MaxHeight="48"
                    Content="{IconPacks:FontAwesomeLight Kind=WindowMinimize,
                                                         Height=16,
                                                         Width=16}"
                    Focusable="False"
                    IsEnabled="{Binding IsMinButtonEnabled, RelativeSource={RelativeSource AncestorType={x:Type Controls:MetroWindow}}}"
                    ToolTip="{Binding Minimize, RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}"
                    UseLayoutRounding="True">
                <Button.Visibility>
                    <MultiBinding Converter="{x:Static Converters:ResizeModeMinMaxButtonVisibilityConverter.Instance}"
                                  ConverterParameter="MIN">
                        <Binding Mode="OneWay"
                                 Path="ShowMinButton"
                                 RelativeSource="{RelativeSource AncestorType={x:Type Controls:MetroWindow}}" />
                        <Binding Mode="OneWay"
                                 Path="UseNoneWindowStyle"
                                 RelativeSource="{RelativeSource AncestorType={x:Type Controls:MetroWindow}}" />
                        <Binding Mode="OneWay"
                                 Path="ResizeMode"
                                 RelativeSource="{RelativeSource AncestorType={x:Type Controls:MetroWindow}}" />
                    </MultiBinding>
                </Button.Visibility>
            </Button>
            <Button x:Name="PART_Max"
                    Width="48"
                    Height="48"
                    MaxHeight="48"
                    Content="{IconPacks:FontAwesomeLight Kind=WindowMaximize,
                                                         Height=16,
                                                         Width=16}"
                    Focusable="False"
                    IsEnabled="{Binding IsMaxRestoreButtonEnabled, RelativeSource={RelativeSource AncestorType={x:Type Controls:MetroWindow}}}"
                    ToolTip="{Binding Maximize, RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}"
                    UseLayoutRounding="True">
                <Button.Visibility>
                    <MultiBinding Converter="{x:Static Converters:ResizeModeMinMaxButtonVisibilityConverter.Instance}"
                                  ConverterParameter="MAX">
                        <Binding Mode="OneWay"
                                 Path="ShowMaxRestoreButton"
                                 RelativeSource="{RelativeSource AncestorType={x:Type Controls:MetroWindow}}" />
                        <Binding Mode="OneWay"
                                 Path="UseNoneWindowStyle"
                                 RelativeSource="{RelativeSource AncestorType={x:Type Controls:MetroWindow}}" />
                        <Binding Mode="OneWay"
                                 Path="ResizeMode"
                                 RelativeSource="{RelativeSource AncestorType={x:Type Controls:MetroWindow}}" />
                    </MultiBinding>
                </Button.Visibility>
            </Button>
            <Button x:Name="PART_Close"
                    Width="48"
                    Height="48"
                    MaxHeight="48"
                    Content="{IconPacks:FontAwesomeLight Kind=WindowClose,
                                                         Height=16,
                                                         Width=16}"
                    Focusable="False"
                    IsEnabled="{Binding RelativeSource={RelativeSource AncestorType={x:Type Controls:MetroWindow}}, Path=IsCloseButtonEnabled, Mode=OneWay}"
                    ToolTip="{Binding Close, RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}"
                    UseLayoutRounding="True">
                <Button.Visibility>
                    <MultiBinding Converter="{x:Static Converters:ResizeModeMinMaxButtonVisibilityConverter.Instance}"
                                  ConverterParameter="CLOSE">
                        <Binding Mode="OneWay"
                                 Path="ShowCloseButton"
                                 RelativeSource="{RelativeSource AncestorType={x:Type Controls:MetroWindow}}" />
                        <Binding Mode="OneWay"
                                 Path="UseNoneWindowStyle"
                                 RelativeSource="{RelativeSource AncestorType={x:Type Controls:MetroWindow}}" />
                    </MultiBinding>
                </Button.Visibility>
            </Button>
        </StackPanel>
        <ControlTemplate.Triggers>
            <MultiDataTrigger>
                <MultiDataTrigger.Conditions>
                    <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type Controls:MetroWindow}}, Path=IsCloseButtonEnabled}" Value="True" />
                    <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type Controls:MetroWindow}}, Path=IsCloseButtonEnabledWithDialog}" Value="False" />
                </MultiDataTrigger.Conditions>
                <Setter TargetName="PART_Close" Property="IsEnabled" Value="False" />
            </MultiDataTrigger>
            <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type Controls:MetroWindow}}, Path=WindowState}"
                         Value="Maximized">
                <Setter TargetName="PART_Max" Property="Content" Value="{IconPacks:FontAwesomeLight Kind=WindowRestore, Height=16, Width=16}" />
                <Setter TargetName="PART_Max" Property="ToolTip" Value="{Binding Restore, RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" />
            </DataTrigger>
            <Trigger Property="Theme" Value="Light">
                <Setter TargetName="PART_Close" Property="Style" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=LightCloseButtonStyle}" />
                <Setter TargetName="PART_Max" Property="Style" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=LightMaxButtonStyle}" />
                <Setter TargetName="PART_Min" Property="Style" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=LightMinButtonStyle}" />
            </Trigger>
            <Trigger Property="Theme" Value="Dark">
                <Setter TargetName="PART_Close" Property="Style" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=DarkCloseButtonStyle}" />
                <Setter TargetName="PART_Max" Property="Style" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=DarkMaxButtonStyle}" />
                <Setter TargetName="PART_Min" Property="Style" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=DarkMinButtonStyle}" />
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <Style x:Key="MahApps.Styles.WindowButtonCommands"
           TargetType="{x:Type Controls:WindowButtonCommands}">
        <Setter Property="Background" Value="{DynamicResource MahApps.Brushes.TransparentWhite}" />
        <Setter Property="DarkCloseButtonStyle" Value="{DynamicResource MahApps.Styles.Button.MetroWindow.Dark}" />
        <Setter Property="DarkMaxButtonStyle" Value="{DynamicResource MahApps.Styles.Button.MetroWindow.Dark}" />
        <Setter Property="DarkMinButtonStyle" Value="{DynamicResource MahApps.Styles.Button.MetroWindow.Dark}" />
        <Setter Property="FocusVisualStyle" Value="{x:Null}" />
        <Setter Property="Foreground" Value="{DynamicResource MahApps.Brushes.Black}" />
        <Setter Property="IsTabStop" Value="False" />
        <Setter Property="LightCloseButtonStyle" Value="{DynamicResource MahApps.Styles.Button.MetroWindow.Light}" />
        <Setter Property="LightMaxButtonStyle" Value="{DynamicResource MahApps.Styles.Button.MetroWindow.Light}" />
        <Setter Property="LightMinButtonStyle" Value="{DynamicResource MahApps.Styles.Button.MetroWindow.Light}" />
        <Setter Property="Template" Value="{StaticResource MahApps.Templates.WindowButtonCommands}" />
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Style.Triggers>
            <DataTrigger Binding="{Binding ParentWindow.ShowTitleBar, RelativeSource={RelativeSource Self}}"
                         Value="True">
                <Setter Property="Foreground" Value="{DynamicResource MahApps.Brushes.IdealForeground}" />
            </DataTrigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="MahApps.Styles.WindowButtonCommands.Win10"
           BasedOn="{StaticResource MahApps.Styles.WindowButtonCommands}"
           TargetType="{x:Type Controls:WindowButtonCommands}">
        <Setter Property="DarkCloseButtonStyle" Value="{DynamicResource MahApps.Styles.Button.MetroWindow.Close.Dark.Win10}" />
        <Setter Property="LightCloseButtonStyle" Value="{DynamicResource MahApps.Styles.Button.MetroWindow.Close.Light.Win10}" />
        <Setter Property="Template" Value="{StaticResource MahApps.Templates.WindowButtonCommands.Win10}" />
    </Style>

    <Style x:Key="CustomCloseWindowButtonStyle"
           BasedOn="{StaticResource MetroWindowButtonStyle}"
           TargetType="{x:Type Button}">
        <Style.Triggers>

            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="Background" Value="#EB2F2F" />
                <Setter Property="Foreground" Value="{DynamicResource WhiteBrush}" />
            </Trigger>
            <Trigger Property="IsPressed" Value="True">
                <Setter Property="Background" Value="#7C0000" />
            </Trigger>

        </Style.Triggers>
    </Style>

</ResourceDictionary>