text: ﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                      xmlns:Converters="clr-namespace:ZdfFlatUI.Converters" 
                      xmlns:My="clr-namespace:ZdfFlatUI">
  
      <SolidColorBrush x:Key="Button.Disabled.Background" Color="#FFF4F4F4" />
      <SolidColorBrush x:Key="Button.Disabled.Border" Color="#D7DDE4" />
      <SolidColorBrush x:Key="Button.Disabled.Foreground" Color="#C9D0DA" />
  
      <ControlTemplate x:Key="Button" TargetType="{x:Type My:FlatButton}">
          <Border x:Name="border"
                  Background="{TemplateBinding Background}"
                  BorderBrush="{TemplateBinding BorderBrush}"
                  BorderThickness="{TemplateBinding BorderThickness}"
                  CornerRadius="{TemplateBinding CornerRadius}"
                  SnapsToDevicePixels="true" UseLayoutRounding="True">
              <Border.OpacityMask>
                  <SolidColorBrush Color="#000000" />
              </Border.OpacityMask>
              <AdornerDecorator>
                  <ContentPresenter x:Name="contentPresenter" Grid.Column="1"
                                    Margin="{TemplateBinding Padding}"
                                    HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                    VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                    Focusable="False" RecognizesAccessKey="True"
                                    SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
              </AdornerDecorator>
              <VisualStateManager.VisualStateGroups>
                  <VisualStateGroup x:Name="CommonStates">
                      <VisualState x:Name="Normal">
                          <Storyboard>
                              <ColorAnimationUsingKeyFrames Storyboard.TargetName="border" Storyboard.TargetProperty="(UIElement.OpacityMask).(SolidColorBrush.Color)">
                                  <EasingColorKeyFrame KeyTime="00:00:0.3" Value="#FF000000" />
                              </ColorAnimationUsingKeyFrames>
                          </Storyboard>
                      </VisualState>
                      <VisualState x:Name="MouseOver">
                          <Storyboard>
                              <ColorAnimationUsingKeyFrames Storyboard.TargetName="border" Storyboard.TargetProperty="(UIElement.OpacityMask).(SolidColorBrush.Color)">
                                  <EasingColorKeyFrame KeyTime="00:00:0.3" Value="#C0000000" />
                              </ColorAnimationUsingKeyFrames>
                          </Storyboard>
                      </VisualState>
                      <VisualState x:Name="Pressed">
                          <Storyboard>
                              <ColorAnimationUsingKeyFrames Storyboard.TargetName="border" Storyboard.TargetProperty="(UIElement.OpacityMask).(SolidColorBrush.Color)">
                                  <EasingColorKeyFrame KeyTime="00:00:00" Value="#FF000000" />
                              </ColorAnimationUsingKeyFrames>
                          </Storyboard>
                      </VisualState>
                  </VisualStateGroup>
              </VisualStateManager.VisualStateGroups>
          </Border>
          <ControlTemplate.Triggers>
              <Trigger Property="IsDefaulted" Value="true">
                  <Setter TargetName="border" Property="BorderBrush" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}" />
              </Trigger>
              <Trigger Property="IsMouseOver" Value="true">
                  <Setter Property="Cursor" Value="Hand" />
              </Trigger>
              <Trigger Property="IsPressed" Value="true">
                  <!--<Setter TargetName="border" Property="Background" Value="{Binding PressedBackground, RelativeSource={RelativeSource Mode=TemplatedParent}}" />-->
                  <Setter TargetName="contentPresenter" Property="Margin" Value="0,0,0,0" />
              </Trigger>
              <Trigger Property="IsEnabled" Value="false">
                  <Setter Property="Cursor" Value="No" />
                  <Setter TargetName="border" Property="Background" Value="{StaticResource Button.Disabled.Background}" />
                  <Setter TargetName="border" Property="BorderBrush" Value="{StaticResource Button.Disabled.Border}" />
                  <Setter TargetName="border" Property="BorderThickness" Value="1" />
                  <Setter TargetName="contentPresenter" Property="TextElement.Foreground" Value="{StaticResource Button.Disabled.Foreground}" />
              </Trigger>
          </ControlTemplate.Triggers>
      </ControlTemplate>
  
      <ControlTemplate x:Key="Ghost" TargetType="{x:Type My:FlatButton}">
          <Border x:Name="border"
                  Background="{TemplateBinding Background}"
                  BorderBrush="{TemplateBinding BorderBrush}"
                  BorderThickness="{TemplateBinding BorderThickness}"
                  CornerRadius="{TemplateBinding CornerRadius}"
                  SnapsToDevicePixels="true" UseLayoutRounding="True">
              <Border.OpacityMask>
                  <SolidColorBrush Color="#000000" />
              </Border.OpacityMask>
              <ContentPresenter x:Name="contentPresenter" Grid.Column="1"
                                Margin="{TemplateBinding Padding}"
                                HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                Focusable="False" RecognizesAccessKey="True"
                                SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
              <VisualStateManager.VisualStateGroups>
                  <VisualStateGroup x:Name="CommonStates">
                      <VisualState x:Name="Normal">
                          <Storyboard>
                              <ColorAnimation Duration="00:00:0.2" Storyboard.TargetProperty="(Button.BorderBrush).(SolidColorBrush.Color)"
                                              To="#D7DDE4" />
                              <ColorAnimation Duration="00:00:0.2" Storyboard.TargetProperty="(Button.Foreground).(SolidColorBrush.Color)"
                                              To="#657180" />
                          </Storyboard>
                      </VisualState>
                      <VisualState x:Name="MouseOver">
                          <Storyboard>
                              <ColorAnimation Duration="00:00:0.3" Storyboard.TargetProperty="(Button.BorderBrush).(SolidColorBrush.Color)"
                                              To="#5CADFF" />
                              <ColorAnimation Duration="00:00:0.3" Storyboard.TargetProperty="(Button.Foreground).(SolidColorBrush.Color)"
                                              To="#5CADFF" />
                          </Storyboard>
                      </VisualState>
                      <VisualState x:Name="Pressed">
                          <Storyboard>
                              <ColorAnimation Duration="00:00:0.3" Storyboard.TargetProperty="(Button.BorderBrush).(SolidColorBrush.Color)"
                                              To="#3091F2" />
                              <ColorAnimation Duration="00:00:0.3" Storyboard.TargetProperty="(Button.Foreground).(SolidColorBrush.Color)"
                                              To="#3091F2" />
                              <ColorAnimationUsingKeyFrames Storyboard.TargetName="border" Storyboard.TargetProperty="(UIElement.OpacityMask).(SolidColorBrush.Color)">
                                  <EasingColorKeyFrame KeyTime="00:00:00" Value="#FF000000" />
                              </ColorAnimationUsingKeyFrames>
                          </Storyboard>
                      </VisualState>
                  </VisualStateGroup>
              </VisualStateManager.VisualStateGroups>
          </Border>
          <ControlTemplate.Triggers>
              <Trigger Property="IsDefaulted" Value="true">
                  <Setter TargetName="border" Property="BorderBrush" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}" />
              </Trigger>
              <Trigger Property="IsMouseOver" Value="true">
                  <Setter Property="Cursor" Value="Hand" />
              </Trigger>
              <Trigger Property="IsEnabled" Value="false">
                  <Setter TargetName="border" Property="Background" Value="{StaticResource Button.Disabled.Background}" />
                  <Setter TargetName="border" Property="BorderBrush" Value="{StaticResource Button.Disabled.Border}" />
                  <Setter TargetName="border" Property="BorderThickness" Value="1" />
                  <Setter TargetName="contentPresenter" Property="TextElement.Foreground" Value="{StaticResource Button.Disabled.Foreground}" />
              </Trigger>
          </ControlTemplate.Triggers>
      </ControlTemplate>
  
      <ControlTemplate x:Key="Default" TargetType="{x:Type My:FlatButton}">
          <Border x:Name="border"
                  Background="{TemplateBinding Background}"
                  BorderBrush="{TemplateBinding BorderBrush}"
                  BorderThickness="{TemplateBinding BorderThickness}"
                  CornerRadius="{TemplateBinding CornerRadius}"
                  SnapsToDevicePixels="true" UseLayoutRounding="True">
              <AdornerDecorator>
                  <ContentPresenter x:Name="contentPresenter" Grid.Column="1"
                                    Margin="{TemplateBinding Padding}"
                                    HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                    VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                    Focusable="False" RecognizesAccessKey="True"
                                    SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
              </AdornerDecorator>
              <VisualStateManager.VisualStateGroups>
                  <VisualStateGroup x:Name="CommonStates">
                      <VisualState x:Name="Normal">
                          <Storyboard>
                              <ColorAnimation Duration="00:00:0.2" Storyboard.TargetProperty="(Button.BorderBrush).(SolidColorBrush.Color)"
                                              To="#C3C6C9" />
                              <ColorAnimation Duration="00:00:0.2" Storyboard.TargetProperty="(Button.Foreground).(SolidColorBrush.Color)"
                                              To="#657180" />
                              <ColorAnimation Duration="00:00:0.2" Storyboard.TargetProperty="(Button.Background).(SolidColorBrush.Color)"
                                              To="#F7F7F7" />
                          </Storyboard>
                      </VisualState>
                      <VisualState x:Name="MouseOver">
                          <Storyboard>
                              <ColorAnimation Duration="00:00:0.2" Storyboard.TargetProperty="(Button.BorderBrush).(SolidColorBrush.Color)"
                                              To="#5CADFF" />
                              <ColorAnimation Duration="00:00:0.2" Storyboard.TargetProperty="(Button.Foreground).(SolidColorBrush.Color)"
                                              To="#5CADFF" />
                              <ColorAnimation Duration="00:00:0.2" Storyboard.TargetProperty="(Button.Background).(SolidColorBrush.Color)"
                                              To="#FFFFFF" />
                          </Storyboard>
                      </VisualState>
                      <VisualState x:Name="Pressed">
                          <Storyboard>
                              <ColorAnimation Duration="00:00:0.3" Storyboard.TargetProperty="(Button.BorderBrush).(SolidColorBrush.Color)"
                                              To="#3091F2" />
                              <ColorAnimation Duration="00:00:0.3" Storyboard.TargetProperty="(Button.Foreground).(SolidColorBrush.Color)"
                                              To="#3091F2" />
                              <ColorAnimation Duration="0" Storyboard.TargetProperty="(Button.Background).(SolidColorBrush.Color)" To="#FFFFFF" />
                          </Storyboard>
                      </VisualState>
                  </VisualStateGroup>
              </VisualStateManager.VisualStateGroups>
          </Border>
          <ControlTemplate.Triggers>
              <Trigger Property="IsDefaulted" Value="true">
                  <Setter TargetName="border" Property="BorderBrush" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}" />
              </Trigger>
              <Trigger Property="IsMouseOver" Value="true">
                  <Setter Property="Cursor" Value="Hand" />
              </Trigger>
              <Trigger Property="IsPressed" Value="true">
                  <Setter TargetName="contentPresenter" Property="Margin" Value="0,3,0,0" />
              </Trigger>
              <Trigger Property="IsEnabled" Value="false">
                  <Setter TargetName="border" Property="Background" Value="{StaticResource Button.Disabled.Background}" />
                  <Setter TargetName="border" Property="BorderBrush" Value="{StaticResource Button.Disabled.Border}" />
                  <Setter TargetName="border" Property="BorderThickness" Value="1" />
                  <Setter TargetName="contentPresenter" Property="TextElement.Foreground" Value="{StaticResource Button.Disabled.Foreground}" />
              </Trigger>
          </ControlTemplate.Triggers>
      </ControlTemplate>
  
      <Style TargetType="{x:Type My:FlatButton}">
          <!--<Setter Property="Width" Value="70" />-->
          <!--<Setter Property="Height" Value="28" />-->
          <Setter Property="FocusVisualStyle" Value="{x:Null}" />
          <Setter Property="BorderBrush" Value="Transparent" />
          <Setter Property="Foreground" Value="#FFFFFF" />
          <Setter Property="Background" Value="#3399FF" />
          <Setter Property="BorderThickness" Value="0" />
          <Setter Property="HorizontalContentAlignment" Value="Center" />
          <Setter Property="VerticalContentAlignment" Value="Center" />
          <Setter Property="CornerRadius" Value="3" />
          <Setter Property="Template" Value="{StaticResource Button}" />
          <Style.Triggers>
              <Trigger Property="Type" Value="Default">
                  <Setter Property="Background" Value="#F7F7F7" />
                  <Setter Property="Foreground" Value="#657180" />
                  <Setter Property="BorderThickness" Value="1" />
                  <Setter Property="BorderBrush" Value="#C3C6C9" />
                  <Setter Property="Template" Value="{StaticResource Default}" />
              </Trigger>
              <Trigger Property="Type" Value="ghost">
                  <Setter Property="BorderBrush" Value="#C3C6C9" />
                  <Setter Property="Foreground" Value="#657180" />
                  <Setter Property="Background" Value="#FFFFFF" />
                  <Setter Property="BorderThickness" Value="1" />
                  <Setter Property="Template" Value="{StaticResource Ghost}" />
              </Trigger>
              <Trigger Property="Type" Value="text">
                  <Setter Property="BorderBrush" Value="#C3C6C9" />
                  <Setter Property="Foreground" Value="#657180" />
                  <Setter Property="Background" Value="Transparent" />
                  <Setter Property="BorderThickness" Value="0" />
              </Trigger>
              <Trigger Property="Type" Value="info">
                  <Setter Property="Background" Value="#2DB7F5" />
              </Trigger>
              <Trigger Property="Type" Value="success">
                  <Setter Property="Background" Value="#00CC66" />
              </Trigger>
              <Trigger Property="Type" Value="error">
                  <Setter Property="Background" Value="#FF5500" />
              </Trigger>
              <Trigger Property="Type" Value="warning">
                  <Setter Property="Background" Value="#FF9900" />
              </Trigger>
          </Style.Triggers>
      </Style>
  </ResourceDictionary>