CheckBoxStyle.xaml
9.45 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:Microsoft_Windows_Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="..\Colors\Colors.xaml"/>
</ResourceDictionary.MergedDictionaries>
<SolidColorBrush x:Key="CheckBoxFillNormal" Color="#F4F4F4"/>
<!-- Resource dictionary entries should be defined here. -->
<Style x:Key="EmptyCheckBoxFocusVisual">
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate>
<Rectangle Margin="1" SnapsToDevicePixels="true" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" StrokeThickness="1" StrokeDashArray="1 2"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<LinearGradientBrush x:Key="CheckBoxBackground" EndPoint="0.146,0.854" StartPoint="0.854,0.146">
<GradientStop Color="#FFE7E7E7" Offset="0"/>
<GradientStop Color="White" Offset="1"/>
</LinearGradientBrush>
<Style x:Key="CheckBoxStyle" TargetType="{x:Type CheckBox}">
<Setter Property="Foreground" Value="{DynamicResource ForegroundNormalColorBrush}"/>
<Setter Property="Background" Value="{DynamicResource CheckBoxBackground}"/>
<Setter Property="BorderBrush" Value="{DynamicResource OuterBorderBrushStyle}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="FocusVisualStyle" Value="{StaticResource EmptyCheckBoxFocusVisual}"/>
<Setter Property="Template" Value="{DynamicResource CheckBoxControlTemplate}"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
</Style>
<ControlTemplate x:Key="CheckBoxControlTemplate" TargetType="{x:Type CheckBox}">
<Grid Margin="{TemplateBinding Padding}">
<Grid.RowDefinitions>
<RowDefinition Height="7*"/>
<RowDefinition Height="19*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="20"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal"/>
<VisualState x:Name="MouseOver">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="MouseOverRectangle">
<DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Pressed">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="MouseOverRectangle">
<DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Collapsed}"/>
</ObjectAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="MouseOverRectangle">
<EasingDoubleKeyFrame KeyTime="0" Value="0.9"/>
</DoubleAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="BaseRectangle">
<DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Collapsed}"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Disabled">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="DisabledRectangle">
<DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="CheckStates">
<VisualState x:Name="Checked">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="Tick">
<DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}"/>
</ObjectAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="InnerRectangle">
<EasingDoubleKeyFrame KeyTime="0" Value="0.3"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Unchecked"/>
<VisualState x:Name="Indeterminate">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="InnerRectangle2">
<DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="InnerRectangle1">
<DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}"/>
</ObjectAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[0].(GradientStop.Offset)" Storyboard.TargetName="InnerRectangle2">
<EasingDoubleKeyFrame KeyTime="0" Value="0"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="InnerRectangle2">
<EasingDoubleKeyFrame KeyTime="0" Value="1"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Offset)" Storyboard.TargetName="InnerRectangle2">
<EasingDoubleKeyFrame KeyTime="0" Value="0.75"/>
</DoubleAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="InnerRectangle">
<DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Collapsed}"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Grid Grid.RowSpan="2">
<Rectangle x:Name="BaseRectangle" Stroke="{TemplateBinding BorderBrush}" Width="14" Height="14" HorizontalAlignment="Center" VerticalAlignment="Center" Fill="{TemplateBinding Background}"/>
<Rectangle x:Name="MouseOverRectangle" Stroke="{DynamicResource ButtonCheckingColorBrush}" Width="14" Height="14" HorizontalAlignment="Center" VerticalAlignment="Center" Opacity="0.7" Visibility="Collapsed"/>
<Grid SnapsToDevicePixels="True" Width="10" Height="10" HorizontalAlignment="Center" VerticalAlignment="Center">
<Rectangle x:Name="InnerRectangle" Stroke="{TemplateBinding BorderBrush}" Width="Auto" Height="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Opacity="0.7"/>
<Rectangle x:Name="InnerRectangle1" Width="Auto" Height="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Opacity="1" Visibility="Collapsed" StrokeThickness="0">
<Rectangle.Fill>
<SolidColorBrush>#FFEB7F11</SolidColorBrush>
</Rectangle.Fill>
</Rectangle>
<Rectangle x:Name="InnerRectangle2" Width="Auto" Height="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Opacity="1" Visibility="Collapsed" Stroke="#99414141">
<Rectangle.Fill>
<LinearGradientBrush EndPoint="0.854,0.854" StartPoint="0.146,0.146">
<GradientStop Color="#FFF4FF31"/>
<GradientStop Color="#FFFF9800" Offset="0.6"/>
</LinearGradientBrush>
</Rectangle.Fill>
</Rectangle>
<Path x:Name="Tick" Data="M7.687375,0.2220739 C8.0155,-0.05973274 8.1038766,0.0097396618 8.29675,0.0029198407 8.5066265,-0.0045011927 9.1668963,0.57316282 9.29675,0.628 9.29675,0.628 9.562375,1.003 9.499875,1.206125 9.437375,1.40925 4.203,8.97175 4.203,8.97175 3.9929055,9.2410637 3.6989538,9.1618134 3.3908969,9.1598239 3.3908969,9.1598239 0.00027189102,5.8158239 0.00027189102,5.8158239 -0.0057670967,5.4862303 0.087374154,5.1787686 0.42202189,4.9251989 0.71874926,4.6074266 0.999875,4.3470739
1.328,4.3314489 2.1634858,4.9882366 2.781125,5.7220739 3.593625,6.4408239 3.593625,6.4408239 7.687375,0.2220739 7.687375,0.2220739 z" HorizontalAlignment="Left" Stretch="None" StrokeThickness="0" Visibility="Collapsed" SnapsToDevicePixels="False" VerticalAlignment="Center" Height="9.172" Margin="0.297,0.372,0,0.456" Width="9.509" Opacity="1" Fill="{DynamicResource ButtonCheckingColorBrush3}"/>
</Grid>
<Rectangle x:Name="DisabledRectangle" Width="14" Height="14" HorizontalAlignment="Center" VerticalAlignment="Center" Opacity="0.5" Visibility="Collapsed" Fill="{DynamicResource GrayLightBrush}"/>
</Grid>
<ContentPresenter ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentStringFormat}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Grid.Column="1" Margin="0,4.52,0,5.52" Grid.RowSpan="2"/>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="HasContent" Value="True">
<Setter Property="Padding" Value="4,0,0,0"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</ResourceDictionary>