﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:ui="clr-namespace:HMI.UI"
                    >
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="/HMI.UI;component/Style/Colors.xaml"/>
        <ResourceDictionary Source="/HMI.UI;component/Resources/Font/Font.xaml"/>
    </ResourceDictionary.MergedDictionaries>

    <Style x:Key="WindowButton" TargetType="Button">
        <Setter Property="Background" Value="{StaticResource PrimaryColor}"/>
        <Setter Property="ui:DpPlugin.HoverColor" Value="{StaticResource SecondPrimaryColor}"/>
        <Setter Property="FontFamily" Value="{StaticResource iconfont}"/>
        <Setter Property="FontWeight" Value="SemiBold"/>
        <Setter Property="Foreground" Value="White"/>
        <Setter Property="Width" Value="50"/>
        <Setter Property="FontSize" Value="20"/>
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="BorderBrush" Value="Transparent"/>
        <Setter Property="Cursor" Value="Hand"/>
        <Setter Property="WindowChrome.IsHitTestVisibleInChrome" Value="True"/>

        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Border x:Name="border" Width="{TemplateBinding Width}" Background="{TemplateBinding Background}" 
                            BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="0">
                        <Label x:Name="label" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" 
                               HorizontalContentAlignment="Center" VerticalContentAlignment="Center" 
                               Foreground="{TemplateBinding Foreground}"
                                       Content="{TemplateBinding Content}"/>
                    </Border>

                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="border" Property="Background" Value="{Binding 
                                Path=(ui:DpPlugin.HoverColor),RelativeSource={RelativeSource TemplatedParent}}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="WindowCloseButton" BasedOn="{StaticResource WindowButton}" TargetType="Button">
        <Setter Property="ui:DpPlugin.HoverColor" Value="Red"/>
    </Style>

    <Style x:Key="ChildWindowButton" BasedOn="{StaticResource WindowButton}" TargetType="Button">
        <Setter Property="FontSize" Value="15"/>
        <Setter Property="Width" Value="30"/>
        <Setter Property="Background" Value="{StaticResource SecondPrimaryColor}"/>
        <Setter Property="ui:DpPlugin.HoverColor" Value="{StaticResource PrimaryColor}"/>
    </Style>

    <Style x:Key="ChildWindowCloseButton" BasedOn="{StaticResource ChildWindowButton}" TargetType="Button">
        <Setter Property="ui:DpPlugin.HoverColor" Value="Red"/>
    </Style>

    <Style x:Key="LinkButton" TargetType="Button">
        <Setter Property="ui:DpPlugin.HoverColor" Value="{StaticResource SecondPrimaryColor}"/>
        <Setter Property="FontFamily" Value="{StaticResource iconfont}"/>
        <Setter Property="Foreground" Value="{StaticResource SecondPrimaryColor}"/>

        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <TextBlock Style="{x:Null}" x:Name="label" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
                               Foreground="{TemplateBinding Foreground}"
                                       Text="{TemplateBinding Content}"/>

                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="label" Property="Foreground" Value="{Binding 
                                Path=(ui:DpPlugin.HoverColor),RelativeSource={RelativeSource TemplatedParent}}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>