1
+ <ResourceDictionary
2
+ xmlns =" http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3
+ xmlns : x =" http://schemas.microsoft.com/winfx/2006/xaml"
4
+ xmlns : controls =" clr-namespace:WPFDevelopers.Controls"
5
+ xmlns : helpers =" clr-namespace:WPFDevelopers.Helpers" >
6
+
7
+ <ResourceDictionary .MergedDictionaries>
8
+ <ResourceDictionary Source =" Basic/ControlBasic.xaml" />
9
+ </ResourceDictionary .MergedDictionaries>
10
+
11
+ <ControlTemplate x : Key =" WD.TimePickerToggleButton" TargetType =" {x:Type ToggleButton}" >
12
+ <Border
13
+ x : Name =" PART_Border"
14
+ Padding =" 6,0"
15
+ Background =" Transparent"
16
+ BorderThickness =" 0"
17
+ SnapsToDevicePixels =" true" >
18
+ <controls : PathIcon
19
+ x : Name =" PART_PathIcon"
20
+ HorizontalAlignment =" Center"
21
+ VerticalAlignment =" Center"
22
+ Foreground =" {DynamicResource WD.PlaceholderTextSolidColorBrush}"
23
+ IsHitTestVisible =" False"
24
+ Kind =" Time" />
25
+ </Border >
26
+ <ControlTemplate .Triggers>
27
+ <Trigger Property =" IsMouseOver" Value =" True" >
28
+ <Setter TargetName =" PART_PathIcon" Property =" Foreground" Value =" {DynamicResource WD.PrimaryNormalSolidColorBrush}" />
29
+ </Trigger >
30
+ <Trigger Property =" IsChecked" Value =" True" >
31
+ <Setter TargetName =" PART_PathIcon" Property =" Foreground" Value =" {DynamicResource WD.PrimaryNormalSolidColorBrush}" />
32
+ </Trigger >
33
+ </ControlTemplate .Triggers>
34
+ </ControlTemplate >
35
+ <Style
36
+ x : Key =" WD.TimeSelectorItem"
37
+ BasedOn =" {StaticResource WD.DefaultListBoxItem}"
38
+ TargetType =" {x:Type controls:TimeSelectorItem}" >
39
+ <Setter Property =" BorderThickness" Value =" 0" />
40
+ <Setter Property =" HorizontalContentAlignment" Value =" Center" />
41
+ <Setter Property =" Template" >
42
+ <Setter .Value>
43
+ <ControlTemplate TargetType =" {x:Type controls:TimeSelectorItem}" >
44
+ <ControlTemplate .Triggers>
45
+ <Trigger Property =" IsSelected" Value =" True" >
46
+ <Setter Property =" FontWeight" Value =" Bold" />
47
+ <Setter Property =" Background" Value =" Transparent" />
48
+ </Trigger >
49
+ <Trigger Property =" IsMouseOver" Value =" True" >
50
+ <Setter Property =" Background" Value =" {DynamicResource WD.BaseSolidColorBrush}" />
51
+ </Trigger >
52
+ <DataTrigger Binding =" {Binding}" Value =" " >
53
+ <Setter Property =" IsEnabled" Value =" False" />
54
+ </DataTrigger >
55
+ </ControlTemplate .Triggers>
56
+ <controls : SmallPanel >
57
+ <Border
58
+ Name =" PART_Border"
59
+ Padding =" {TemplateBinding Padding}"
60
+ Background =" {TemplateBinding Background}"
61
+ BorderBrush =" {TemplateBinding BorderBrush}"
62
+ BorderThickness =" {TemplateBinding BorderThickness}"
63
+ SnapsToDevicePixels =" True" >
64
+ <ContentPresenter HorizontalAlignment =" {TemplateBinding HorizontalContentAlignment}" VerticalAlignment =" {TemplateBinding VerticalContentAlignment}" />
65
+ </Border >
66
+ </controls : SmallPanel >
67
+ </ControlTemplate >
68
+ </Setter .Value>
69
+ </Setter >
70
+ </Style >
71
+
72
+ <Style
73
+ x : Key =" WD.TimeListStyle"
74
+ BasedOn =" {StaticResource WD.DefaultListBox}"
75
+ TargetType =" {x:Type controls:TimeSelectorListBox}" >
76
+ <Setter Property =" ScrollViewer.HorizontalScrollBarVisibility" Value =" Hidden" />
77
+ <Setter Property =" ScrollViewer.VerticalScrollBarVisibility" Value =" Hidden" />
78
+ <Setter Property =" BorderThickness" Value =" 0" />
79
+ <Setter Property =" ItemContainerStyle" Value =" {StaticResource WD.TimeSelectorItem}" />
80
+ <Style .Triggers>
81
+ <Trigger Property =" IsMouseOver" Value =" True" >
82
+ <Setter Property =" ScrollViewer.HorizontalScrollBarVisibility" Value =" Auto" />
83
+ <Setter Property =" ScrollViewer.VerticalScrollBarVisibility" Value =" Auto" />
84
+ </Trigger >
85
+ </Style .Triggers>
86
+ </Style >
87
+
88
+
89
+ <Style
90
+ x : Key =" WD.TimeSelector"
91
+ BasedOn =" {StaticResource WD.ControlBasicStyle}"
92
+ TargetType =" {x:Type controls:TimeSelector}" >
93
+ <Setter Property =" HorizontalContentAlignment" Value =" Left" />
94
+ <Setter Property =" VerticalContentAlignment" Value =" Center" />
95
+ <Setter Property =" Padding" Value =" {StaticResource WD.DefaultPadding}" />
96
+ <Setter Property =" Template" >
97
+ <Setter .Value>
98
+ <ControlTemplate TargetType =" {x:Type controls:TimeSelector}" >
99
+ <Border
100
+ Padding =" {TemplateBinding Padding}"
101
+ Background =" {TemplateBinding Background}"
102
+ BorderThickness =" {TemplateBinding BorderThickness}"
103
+ SnapsToDevicePixels =" {TemplateBinding SnapsToDevicePixels}"
104
+ UseLayoutRounding =" {TemplateBinding UseLayoutRounding}" >
105
+ <controls : SmallPanel SnapsToDevicePixels =" True" >
106
+ <UniformGrid Rows =" 1" >
107
+ <controls : TimeSelectorListBox x : Name =" PART_ListBoxHour" Style =" {StaticResource WD.TimeListStyle}" />
108
+ <controls : TimeSelectorListBox x : Name =" PART_ListBoxMinute" Style =" {StaticResource WD.TimeListStyle}" />
109
+ <controls : TimeSelectorListBox x : Name =" PART_ListBoxSecond" Style =" {StaticResource WD.TimeListStyle}" />
110
+ </UniformGrid >
111
+ <Line />
112
+ <Path />
113
+ <Border
114
+ Height =" {TemplateBinding ItemHeight}"
115
+ Margin =" {TemplateBinding SelectorMargin}"
116
+ VerticalAlignment =" Top"
117
+ BorderBrush =" {DynamicResource WD.BaseSolidColorBrush}"
118
+ BorderThickness =" 0,1"
119
+ IsHitTestVisible =" False" />
120
+ </controls : SmallPanel >
121
+ </Border >
122
+ </ControlTemplate >
123
+ </Setter .Value>
124
+ </Setter >
125
+ </Style >
126
+
127
+ <Style
128
+ x : Key =" WD.TimePicker"
129
+ BasedOn =" {StaticResource WD.ControlBasicStyle}"
130
+ TargetType =" {x:Type controls:TimePicker}" >
131
+ <Setter Property =" HorizontalContentAlignment" Value =" Left" />
132
+ <Setter Property =" VerticalContentAlignment" Value =" Center" />
133
+ <Setter Property =" BorderBrush" Value =" {DynamicResource WD.BaseSolidColorBrush}" />
134
+ <Setter Property =" BorderThickness" Value =" 1" />
135
+ <Setter Property =" Background" Value =" {DynamicResource WD.BackgroundSolidColorBrush}" />
136
+ <Setter Property =" Padding" Value =" {StaticResource WD.DefaultPadding}" />
137
+ <Setter Property =" Template" >
138
+ <Setter .Value>
139
+ <ControlTemplate TargetType =" {x:Type controls:TimePicker}" >
140
+ <ControlTemplate .Resources>
141
+ <Storyboard x : Key =" OpenStoryboard" >
142
+ <DoubleAnimation
143
+ EasingFunction =" {StaticResource WD.ExponentialEaseOut}"
144
+ Storyboard.TargetName=" PART_DropDown"
145
+ Storyboard.TargetProperty=" (Grid.RenderTransform).(ScaleTransform.ScaleY)"
146
+ To =" 1"
147
+ Duration =" 00:00:.2" />
148
+ </Storyboard >
149
+ <Storyboard x : Key =" CloseStoryboard" >
150
+ <DoubleAnimation
151
+ EasingFunction =" {StaticResource WD.ExponentialEaseOut}"
152
+ Storyboard.TargetName=" PART_DropDown"
153
+ Storyboard.TargetProperty=" (Grid.RenderTransform).(ScaleTransform.ScaleY)"
154
+ To =" 0"
155
+ Duration =" 00:00:.2" />
156
+ </Storyboard >
157
+ </ControlTemplate .Resources>
158
+ <controls : SmallPanel SnapsToDevicePixels =" True" >
159
+ <Grid Background =" Transparent" >
160
+ <Grid .ColumnDefinitions>
161
+ <ColumnDefinition />
162
+ <ColumnDefinition Width =" Auto" />
163
+ </Grid .ColumnDefinitions>
164
+ <Border
165
+ Name =" PART_Border"
166
+ Grid.ColumnSpan=" 2"
167
+ Background =" {TemplateBinding Background}"
168
+ BorderBrush =" {TemplateBinding BorderBrush}"
169
+ BorderThickness =" {TemplateBinding BorderThickness}"
170
+ CornerRadius =" {Binding Path=(helpers:ElementHelper.CornerRadius), RelativeSource={RelativeSource TemplatedParent}}"
171
+ SnapsToDevicePixels =" True" />
172
+ <TextBox
173
+ x : Name =" PART_EditableTextBox"
174
+ Margin =" {TemplateBinding Padding}"
175
+ HorizontalAlignment =" {TemplateBinding HorizontalContentAlignment}"
176
+ VerticalAlignment =" {TemplateBinding VerticalContentAlignment}"
177
+ Background =" {TemplateBinding Background}"
178
+ Focusable =" True"
179
+ Foreground =" {DynamicResource WD.PrimaryTextSolidColorBrush}"
180
+ SelectionBrush =" {DynamicResource WD.WindowBorderBrushSolidColorBrush}"
181
+ Style =" {x:Null}"
182
+ Template =" {StaticResource WD.ComboBoxTextBox}" />
183
+ <TextBlock
184
+ x : Name =" PART_Watermark"
185
+ Margin =" {TemplateBinding Padding}"
186
+ Padding =" 1,0"
187
+ HorizontalAlignment =" {TemplateBinding HorizontalContentAlignment}"
188
+ VerticalAlignment =" {TemplateBinding VerticalContentAlignment}"
189
+ Background =" Transparent"
190
+ FontSize =" {StaticResource WD.NormalFontSize}"
191
+ Foreground =" {DynamicResource WD.RegularTextSolidColorBrush}"
192
+ IsHitTestVisible =" False"
193
+ Text =" {Binding Path=(helpers:ElementHelper.Watermark), RelativeSource={RelativeSource TemplatedParent}}"
194
+ TextTrimming =" CharacterEllipsis"
195
+ Visibility =" Collapsed" />
196
+ <ToggleButton
197
+ x : Name =" PART_ToggleButton"
198
+ Grid.Column=" 1"
199
+ Background =" {TemplateBinding Background}"
200
+ ClickMode =" Release"
201
+ Focusable =" False"
202
+ Style =" {x:Null}"
203
+ Template =" {StaticResource WD.TimePickerToggleButton}" />
204
+ <Popup
205
+ x : Name =" PART_Popup"
206
+ AllowsTransparency =" True"
207
+ IsOpen =" {Binding Path=IsChecked, ElementName=PART_ToggleButton}"
208
+ Placement =" Bottom"
209
+ PlacementTarget =" {Binding ElementName=PART_Border}"
210
+ StaysOpen =" False" >
211
+ <controls : SmallPanel
212
+ x : Name =" PART_DropDown"
213
+ MinWidth =" {TemplateBinding FrameworkElement.ActualWidth}"
214
+ MaxHeight =" {TemplateBinding MaxDropDownHeight}"
215
+ Margin =" 24,2,24,24"
216
+ RenderTransformOrigin =" .5,0"
217
+ SnapsToDevicePixels =" True" >
218
+ <controls : SmallPanel .RenderTransform>
219
+ <ScaleTransform ScaleY =" 0" />
220
+ </controls : SmallPanel .RenderTransform>
221
+ <Border
222
+ Name =" PART_DropDownBorder"
223
+ Background =" {TemplateBinding Background}"
224
+ BorderBrush =" {TemplateBinding BorderBrush}"
225
+ BorderThickness =" {TemplateBinding BorderThickness}"
226
+ CornerRadius =" {Binding Path=(helpers:ElementHelper.CornerRadius), RelativeSource={RelativeSource TemplatedParent}}"
227
+ Effect =" {StaticResource WD.PopupShadowDepth}"
228
+ SnapsToDevicePixels =" True"
229
+ UseLayoutRounding =" True" />
230
+ <controls : TimeSelector x : Name =" PART_TimeSelector" />
231
+ </controls : SmallPanel >
232
+ </Popup >
233
+ </Grid >
234
+ </controls : SmallPanel >
235
+ <ControlTemplate .Triggers>
236
+ <Trigger SourceName =" PART_ToggleButton" Property =" IsChecked" Value =" True" >
237
+ <Trigger .EnterActions>
238
+ <BeginStoryboard x : Name =" BeginStoryboardOpenStoryboard" Storyboard =" {StaticResource OpenStoryboard}" />
239
+ </Trigger .EnterActions>
240
+ <Trigger .ExitActions>
241
+ <StopStoryboard BeginStoryboardName =" BeginStoryboardOpenStoryboard" />
242
+ </Trigger .ExitActions>
243
+ </Trigger >
244
+ <Trigger SourceName =" PART_ToggleButton" Property =" IsChecked" Value =" False" >
245
+ <Trigger .EnterActions>
246
+ <BeginStoryboard x : Name =" BeginStoryboardCloseStoryboard" Storyboard =" {StaticResource CloseStoryboard}" />
247
+ </Trigger .EnterActions>
248
+ <Trigger .ExitActions>
249
+ <StopStoryboard BeginStoryboardName =" BeginStoryboardCloseStoryboard" />
250
+ </Trigger .ExitActions>
251
+ </Trigger >
252
+ <Trigger Property =" IsMouseOver" Value =" True" >
253
+ <Setter TargetName =" PART_Border" Property =" BorderBrush" Value =" {DynamicResource WD.PrimaryNormalSolidColorBrush}" />
254
+ </Trigger >
255
+ <Trigger SourceName =" PART_Popup" Property =" AllowsTransparency" Value =" True" >
256
+ <Setter TargetName =" PART_DropDownBorder" Property =" Margin" Value =" 0,2,0,0" />
257
+ </Trigger >
258
+ <Trigger Property =" SelectedTime" Value =" " >
259
+ <Setter TargetName =" PART_Watermark" Property =" Visibility" Value =" Visible" />
260
+ </Trigger >
261
+ <Trigger Property =" SelectedTime" Value =" {x:Null}" >
262
+ <Setter TargetName =" PART_Watermark" Property =" Visibility" Value =" Visible" />
263
+ </Trigger >
264
+ </ControlTemplate .Triggers>
265
+ </ControlTemplate >
266
+ </Setter .Value>
267
+ </Setter >
268
+ </Style >
269
+
270
+ <Style BasedOn =" {StaticResource WD.TimeSelector}" TargetType =" {x:Type controls:TimeSelector}" />
271
+ <Style BasedOn =" {StaticResource WD.TimePicker}" TargetType =" {x:Type controls:TimePicker}" />
272
+
273
+ </ResourceDictionary >
0 commit comments