ButtonStyles.xaml
5.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:Microsoft_Windows_Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero" mc:Ignorable="d">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="..\Colors\Colors.xaml"/>
</ResourceDictionary.MergedDictionaries>
<ControlTemplate x:Key="ButtonControlTemplate" TargetType="{x:Type Button}">
<Grid>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="ValidationStates">
<VisualState x:Name="Valid"/>
<VisualState x:Name="InvalidFocused"/>
<VisualState x:Name="InvalidUnfocused"/>
</VisualStateGroup>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal"/>
<VisualState x:Name="MouseOver">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="BottomLighteningGroup">
<DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Pressed">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="BottomLighteningGroup">
<DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Collapsed}"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Disabled">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="Disabling">
<DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="FocusStates">
<VisualState x:Name="Unfocused"/>
<VisualState x:Name="Focused"/>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Border BorderThickness="1" CornerRadius="4"
Background="{TemplateBinding Background}"/>
<Grid x:Name="BottomLighteningGroup" Margin="3,3,3,4" Visibility="Collapsed" Background="White" Opacity="0.6">
<Grid.OpacityMask>
<RadialGradientBrush RadiusY="0.382" Center="0.48,0.958" GradientOrigin="0.48,0.958" RadiusX="0.324">
<GradientStop Color="Black" Offset="0"/>
<GradientStop Offset="1"/>
</RadialGradientBrush>
</Grid.OpacityMask>
</Grid>
<Border x:Name="Shadow" CornerRadius="3" SnapsToDevicePixels="True"
Margin="2" Opacity="0.5" Background="#FF1D1D1D" >
<Border.OpacityMask>
<RadialGradientBrush RadiusY="0.684" RadiusX="0.684">
<GradientStop Color="Black" Offset="0.9"/>
<GradientStop Offset="0.4"/>
</RadialGradientBrush>
</Border.OpacityMask>
</Border>
<Border BorderThickness="3" CornerRadius="2"
Margin="1"
BorderBrush="{TemplateBinding BorderBrush}">
<Rectangle x:Name="TopLightening" Height="5" VerticalAlignment="Top"
Opacity="0.7"
RadiusX="1" RadiusY="1"
Fill="White" OpacityMask="{DynamicResource WhiteToTransparent}" Margin="0" Visibility="Visible"/>
</Border>
<Rectangle x:Name="InnerStroke" RadiusX="1" RadiusY="1" Stroke="{DynamicResource ButtonInnerBrush}" Margin="3"/>
<Border BorderThickness="1" CornerRadius="4"
BorderBrush="{DynamicResource OuterBorderBrushStyle}"/>
<Grid Margin="{TemplateBinding Padding}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
ClipToBounds="False">
<ContentPresenter />
</Grid>
<Border x:Name="Disabling" CornerRadius="2" Margin="2" Opacity="0.4" Background="{DynamicResource GrayLightBrush}" Visibility="Collapsed"/>
</Grid>
</ControlTemplate>
<Style x:Key="ButtonStyle" TargetType="{x:Type Button}">
<Setter Property="Background" Value="{DynamicResource ButtonNormalBackground}"/>
<Setter Property="BorderBrush" Value="{StaticResource WhiteBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Foreground" Value="{DynamicResource ButtonForeground}"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Padding" Value="20,2"/>
<Setter Property="Height" Value="34"/>
<Setter Property="Template" Value="{StaticResource ButtonControlTemplate}"/>
<Setter Property="SnapsToDevicePixels" Value="True"/>
<Setter Property="Margin" Value="2"/>
<Setter Property="FontSize" Value="12"/>
<Style.Triggers>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsDefault" Value="True"/>
<Condition Property="IsPressed" Value="False"/>
</MultiTrigger.Conditions>
<Setter Property="Background" Value="{DynamicResource ButtonDefaultStateBackground}"/>
</MultiTrigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="{DynamicResource ButtonCheckedBrush}"/>
</Trigger>
</Style.Triggers>
</Style>
</ResourceDictionary>