| 1 | <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
| 2 | xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
| 3 | xmlns:local="clr-namespace:UI.Controls.Button" |
| 4 | xmlns:base="clr-namespace:UI.Controls.Base" |
| 5 | xmlns:sys="clr-namespace:System;assembly=mscorlib"> |
| 6 | <Style TargetType="{x:Type local:Button}"> |
| 7 | <Setter Property="SnapsToDevicePixels" |
| 8 | Value="true" /> |
| 9 | <Setter Property="UseLayoutRounding" Value="True"/> |
| 10 | |
| 11 | <Setter Property="Foreground" Value="{DynamicResource StandardTextBrush}"/> |
| 12 | <Setter Property="Height" Value="35"/> |
| 13 | <Setter Property="Background" Value="{DynamicResource StandardBackgroundBrush}"/> |
| 14 | <Setter Property="Template"> |
| 15 | <Setter.Value> |
| 16 | <ControlTemplate TargetType="{x:Type local:Button}"> |
| 17 | |
| 18 | <Grid SnapsToDevicePixels="True"> |
| 19 | |
| 20 | |
| 21 | <Border BorderBrush="#f3f3f3" BorderThickness="0" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}" x:Name="BoxBorder" CornerRadius="4" Background="{TemplateBinding Background}"> |
| 22 | |
| 23 | |
| 24 | |
| 25 | <Grid HorizontalAlignment="Center" VerticalAlignment="Center"> |
| 26 | <Grid.ColumnDefinitions> |
| 27 | <ColumnDefinition Width="auto"/> |
| 28 | <ColumnDefinition Width="auto"/> |
| 29 | </Grid.ColumnDefinitions> |
| 30 | <base:Icon x:Name="Icon" Margin="0,0,5,0" IconType="{TemplateBinding Icon}" VerticalAlignment="Center" FontSize="12" > |
| 31 | |
| 32 | </base:Icon> |
| 33 | <ContentPresenter |
| 34 | Grid.Column="1" |
| 35 | HorizontalAlignment="Center" |
| 36 | VerticalAlignment="Center" |
| 37 | RecognizesAccessKey="True"/> |
| 38 | </Grid> |
| 39 | |
| 40 | </Border> |
| 41 | <Border x:Name="Shadow" BorderBrush="{Binding ElementName=BoxBorder,Path=BorderBrush}" BorderThickness="{Binding ElementName=BoxBorder,Path=BorderThickness}" Panel.ZIndex="-1" Width="{Binding ElementName=BoxBorder,Path=ActualWidth}" Height="{Binding ElementName=BoxBorder,Path=ActualHeight}" CornerRadius="{Binding ElementName=BoxBorder,Path=CornerRadius}" Background="{Binding ElementName=BoxBorder,Path=Background}"> |
| 42 | <Border.Effect> |
| 43 | <DropShadowEffect BlurRadius="5" ShadowDepth="2" Direction="315" Color="Gray" Opacity=".1"/> |
| 44 | </Border.Effect> |
| 45 | </Border> |
| 46 | <VisualStateManager.VisualStateGroups> |
| 47 | <VisualStateGroup x:Name="CommonStates"> |
| 48 | <VisualStateGroup.Transitions> |
| 49 | <VisualTransition GeneratedDuration="0:0:0.18" /> |
| 50 | <VisualTransition GeneratedDuration="0" |
| 51 | To="Pressed" /> |
| 52 | </VisualStateGroup.Transitions> |
| 53 | <VisualState x:Name="Normal" /> |
| 54 | <VisualState x:Name="MouseOver"> |
| 55 | <Storyboard> |
| 56 | |
| 57 | |
| 58 | |
| 59 | |
| 60 | |
| 61 | <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)" |
| 62 | Storyboard.TargetName="BoxBorder"> |
| 63 | <EasingColorKeyFrame KeyTime="0" |
| 64 | Value="{DynamicResource HoverBackgroundColor}" /> |
| 65 | </ColorAnimationUsingKeyFrames> |
| 66 | |
| 67 | |
| 68 | |
| 69 | |
| 70 | |
| 71 | |
| 72 | |
| 73 | |
| 74 | |
| 75 | |
| 76 | </Storyboard> |
| 77 | </VisualState> |
| 78 | <VisualState x:Name="Pressed"> |
| 79 | <Storyboard> |
| 80 | |
| 81 | |
| 82 | <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)" |
| 83 | Storyboard.TargetName="BoxBorder"> |
| 84 | <EasingColorKeyFrame KeyTime="0" |
| 85 | Value="{DynamicResource ThemeColor}" /> |
| 86 | </ColorAnimationUsingKeyFrames> |
| 87 | |
| 88 | </Storyboard> |
| 89 | </VisualState> |
| 90 | </VisualStateGroup> |
| 91 | </VisualStateManager.VisualStateGroups> |
| 92 | |
| 93 | </Grid> |
| 94 | |
| 95 | |
| 96 | <ControlTemplate.Triggers> |
| 97 | <Trigger Property="Icon" Value="None"> |
| 98 | <Setter TargetName="Icon" Property="Visibility" Value="Collapsed"/> |
| 99 | </Trigger> |
| 100 | <Trigger Property="IsMouseOver" Value="True"> |
| 101 | <Setter TargetName="BoxBorder" Property="BorderThickness" Value="0"/> |
| 102 | |
| 103 | </Trigger> |
| 104 | </ControlTemplate.Triggers> |
| 105 | </ControlTemplate> |
| 106 | </Setter.Value> |
| 107 | </Setter> |
| 108 | </Style> |
| 109 | </ResourceDictionary> |