forked from microsoft/calculator
-
Notifications
You must be signed in to change notification settings - Fork 1
/
DateCalculator.xaml
589 lines (564 loc) · 38.8 KB
/
DateCalculator.xaml
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
<UserControl x:Class="CalculatorApp.DateCalculator"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="using:CalculatorApp.Controls"
xmlns:converters="using:CalculatorApp.Converters"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:CalculatorApp"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
d:DesignHeight="300"
d:DesignWidth="400"
Loaded="OnLoaded"
mc:Ignorable="d">
<UserControl.Resources>
<converters:BooleanNegationConverter x:Key="BooleanNegationConverter"/>
<converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
<converters:BooleanToVisibilityNegationConverter x:Key="BooleanToVisibilityNegationConverter"/>
<DataTemplate x:Key="ComboBoxItemContentTemplate">
<TextBlock Text="{Binding}" TextWrapping="WrapWholeWords"/>
</DataTemplate>
<Style x:Key="DateCalculation_ComboStyle" TargetType="ComboBox">
<Setter Property="Padding" Value="0,0,0,0"/>
<Setter Property="MinHeight" Value="20"/>
<Setter Property="Foreground" Value="{ThemeResource SystemControlForegroundBaseHighBrush}"/>
<Setter Property="Background" Value="{ThemeResource SystemControlBackgroundTransparentBrush}"/>
<Setter Property="BorderBrush" Value="{ThemeResource SystemControlForegroundBaseMediumLowBrush}"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="TabNavigation" Value="Once"/>
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled"/>
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
<Setter Property="ScrollViewer.HorizontalScrollMode" Value="Disabled"/>
<Setter Property="ScrollViewer.VerticalScrollMode" Value="Auto"/>
<Setter Property="ScrollViewer.IsVerticalRailEnabled" Value="True"/>
<Setter Property="ScrollViewer.IsDeferredScrollingEnabled" Value="False"/>
<Setter Property="ScrollViewer.BringIntoViewOnFocusChange" Value="True"/>
<Setter Property="HorizontalContentAlignment" Value="Left"/>
<Setter Property="HorizontalAlignment" Value="Left"/>
<Setter Property="VerticalAlignment" Value="Top"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="UseSystemFocusVisuals" Value="True"/>
<Setter Property="FocusVisualMargin" Value="-5,0,0,0"/>
<Setter Property="ItemsPanel">
<Setter.Value>
<ItemsPanelTemplate>
<CarouselPanel/>
</ItemsPanelTemplate>
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ComboBox">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal"/>
<VisualState x:Name="PointerOver">
<VisualState.Setters>
<Setter Target="BackgroundElement.Background" Value="{ThemeResource SystemControlHighlightTransparentBrush}"/>
<Setter Target="SelectedContentPresenter.Foreground" Value="{ThemeResource SystemControlHighlightAltBaseMediumHighBrush}"/>
<Setter Target="DropDownGlyph.Foreground" Value="{ThemeResource SystemControlHighlightAltBaseMediumHighBrush}"/>
</VisualState.Setters>
</VisualState>
<VisualState x:Name="Pressed">
<VisualState.Setters>
<Setter Target="BackgroundElement.Background" Value="{ThemeResource SystemControlHighlightTransparentBrush}"/>
<Setter Target="SelectedContentPresenter.Foreground" Value="{ThemeResource SystemControlHighlightAltBaseMediumBrush}"/>
<Setter Target="DropDownGlyph.Foreground" Value="{ThemeResource SystemControlHighlightAltBaseMediumBrush}"/>
</VisualState.Setters>
</VisualState>
<VisualState x:Name="Disabled"/>
</VisualStateGroup>
<VisualStateGroup x:Name="DropDownStates">
<VisualState x:Name="Opened">
<Storyboard>
<SplitOpenThemeAnimation ClosedTargetName="SelectedContentPresenter"
OffsetFromCenter="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.DropDownOffset}"
OpenedLength="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.DropDownOpenedHeight}"
OpenedTargetName="PopupBorder"/>
</Storyboard>
</VisualState>
<VisualState x:Name="Closed">
<Storyboard>
<SplitCloseThemeAnimation ClosedTargetName="SelectedContentPresenter"
OffsetFromCenter="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.DropDownOffset}"
OpenedLength="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.DropDownOpenedHeight}"
OpenedTargetName="PopupBorder"/>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<ContentPresenter x:Name="ContentPresenter" Opacity="0"/>
<Popup x:Name="Popup">
<Border x:Name="PopupBorder"
Margin="0,-1,0,-1"
HorizontalAlignment="Stretch"
Background="{ThemeResource SystemControlBackgroundChromeMediumLowBrush}"
BorderBrush="{ThemeResource SystemControlForegroundChromeHighBrush}"
BorderThickness="{ThemeResource ComboBoxDropdownBorderThickness}">
<ScrollViewer x:Name="ScrollViewer"
MinWidth="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.DropDownContentMinWidth}"
Foreground="{ThemeResource SystemControlForegroundBaseHighBrush}"
AutomationProperties.AccessibilityView="Raw"
BringIntoViewOnFocusChange="{TemplateBinding ScrollViewer.BringIntoViewOnFocusChange}"
HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
HorizontalScrollMode="{TemplateBinding ScrollViewer.HorizontalScrollMode}"
IsDeferredScrollingEnabled="{TemplateBinding ScrollViewer.IsDeferredScrollingEnabled}"
IsHorizontalRailEnabled="{TemplateBinding ScrollViewer.IsHorizontalRailEnabled}"
IsVerticalRailEnabled="{TemplateBinding ScrollViewer.IsVerticalRailEnabled}"
VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}"
VerticalScrollMode="{TemplateBinding ScrollViewer.VerticalScrollMode}"
VerticalSnapPointsAlignment="Near"
VerticalSnapPointsType="OptionalSingle"
ZoomMode="Disabled">
<ItemsPresenter/>
</ScrollViewer>
</Border>
</Popup>
<Border x:Name="BackgroundElement"
Grid.ColumnSpan="2"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"/>
<TextBlock x:Name="SelectedContentPresenter"
Margin="{TemplateBinding Padding}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Style="{ThemeResource BodyTextBlockStyle}"
FontWeight="SemiBold"
AutomationProperties.AccessibilityView="Raw"
FlowDirection="{TemplateBinding FlowDirection}"
Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=SelectedValue.Content}"
TextWrapping="WrapWholeWords"/>
<TextBlock x:Name="DropDownGlyph"
Grid.Column="1"
Margin="8,3,12,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Foreground="{ThemeResource SystemControlForegroundBaseHighBrush}"
FontFamily="{ThemeResource SymbolThemeFontFamily}"
FontSize="12"
AutomationProperties.AccessibilityView="Raw"
IsHitTestVisible="False"
Text=""/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="DateCalculation_CalendarPickerStyle" TargetType="CalendarDatePicker">
<Setter Property="Foreground" Value="{ThemeResource SystemControlForegroundBaseHighBrush}"/>
<Setter Property="Background" Value="{ThemeResource SystemControlBackgroundTransparentBrush}"/>
<Setter Property="BorderBrush" Value="{ThemeResource SystemControlForegroundBaseMediumLowBrush}"/>
<Setter Property="BorderThickness" Value="{ThemeResource CalendarDatePickerBorderThemeThickness}"/>
<Setter Property="HorizontalAlignment" Value="Left"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="UseSystemFocusVisuals" Value="True"/>
<Setter Property="FocusVisualMargin" Value="-5,0,0,0"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="CalendarDatePicker">
<Grid x:Name="Root">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="32"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="32"/>
</Grid.RowDefinitions>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal">
<VisualState.Setters>
<Setter Target="DateText.Foreground" Value="{ThemeResource SystemControlForegroundBaseMediumHighBrush}"/>
<Setter Target="CalendarGlyph.Foreground" Value="{ThemeResource SystemControlForegroundBaseHighBrush}"/>
</VisualState.Setters>
</VisualState>
<VisualState x:Name="PointerOver">
<VisualState.Setters>
<Setter Target="BorderElement.Background" Value="{ThemeResource SystemControlHighlightTransparentBrush}"/>
<Setter Target="DateText.Foreground" Value="{ThemeResource SystemControlHighlightAltBaseMediumHighBrush}"/>
<Setter Target="CalendarGlyph.Foreground" Value="{ThemeResource SystemControlHighlightAltBaseMediumHighBrush}"/>
</VisualState.Setters>
</VisualState>
<VisualState x:Name="Pressed">
<VisualState.Setters>
<Setter Target="BorderElement.Background" Value="{ThemeResource SystemControlHighlightTransparentBrush}"/>
<Setter Target="DateText.Foreground" Value="{ThemeResource SystemControlHighlightAltBaseMediumBrush}"/>
<Setter Target="CalendarGlyph.Foreground" Value="{ThemeResource SystemControlHighlightAltBaseMediumBrush}"/>
</VisualState.Setters>
</VisualState>
<VisualState x:Name="Disabled"/>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<FlyoutBase.AttachedFlyout>
<Flyout Placement="Full">
<Flyout.FlyoutPresenterStyle>
<Style TargetType="FlyoutPresenter">
<Setter Property="MaxHeight" Value="9000"/>
<Setter Property="MaxWidth" Value="9000"/>
<Setter Property="Padding" Value="0"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="FlyoutPresenter">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="128"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition x:Name="LeftGutter" Width="0"/>
<ColumnDefinition x:Name="C0" Width="*"/>
<ColumnDefinition x:Name="RightGutter" Width="0"/>
</Grid.ColumnDefinitions>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup>
<VisualState x:Name="LeftAlignedLayout">
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="360"/>
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="LeftGutter.Width" Value="12"/>
<Setter Target="RightGutter.Width" Value="*"/>
<Setter Target="C0.Width" Value="336"/>
</VisualState.Setters>
</VisualState>
<VisualState x:Name="DefaultLayout">
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="0"/>
</VisualState.StateTriggers>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<ContentPresenter Grid.Row="1"
Grid.Column="1"
Margin="0,0,0,0"
HorizontalAlignment="Stretch"
VerticalAlignment="Top"
Background="{ThemeResource SystemControlBackgroundChromeMediumLowBrush}"
BorderBrush="{ThemeResource SystemControlForegroundChromeHighBrush}"
BorderThickness="{ThemeResource ComboBoxDropdownBorderThickness}"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
ContentTransitions="{TemplateBinding ContentTransitions}"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Flyout.FlyoutPresenterStyle>
<CalendarView x:Name="CalendarView"
Style="{TemplateBinding CalendarViewStyle}"
CalendarIdentifier="{TemplateBinding CalendarIdentifier}"
DayOfWeekFormat="{TemplateBinding DayOfWeekFormat}"
DisplayMode="{TemplateBinding DisplayMode}"
FirstDayOfWeek="{TemplateBinding FirstDayOfWeek}"
IsGroupLabelVisible="{TemplateBinding IsGroupLabelVisible}"
IsOutOfScopeEnabled="{TemplateBinding IsOutOfScopeEnabled}"
IsTodayHighlighted="{TemplateBinding IsTodayHighlighted}"
MaxDate="{TemplateBinding MaxDate}"
MinDate="{TemplateBinding MinDate}"/>
</Flyout>
</FlyoutBase.AttachedFlyout>
<ContentPresenter x:Name="HeaderContentPresenter"
Margin="{ThemeResource ComboBoxHeaderThemeMargin}"
x:DeferLoadStrategy="Lazy"
Content="{TemplateBinding Header}"
ContentTemplate="{TemplateBinding HeaderTemplate}"
Visibility="Collapsed"/>
<Border x:Name="BorderElement"
Grid.Row="1"
Grid.ColumnSpan="2"
Background="{TemplateBinding Background}"
BorderThickness="0"/>
<TextBlock x:Name="DateText"
Grid.Row="1"
Padding="0,0,0,2"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Style="{ThemeResource BaseTextBlockStyle}"
Foreground="{ThemeResource SystemControlForegroundBaseMediumBrush}"
Text="{TemplateBinding PlaceholderText}"/>
<FontIcon x:Name="CalendarGlyph"
Grid.Row="1"
Grid.Column="1"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Foreground="{ThemeResource SystemControlForegroundBaseHighBrush}"
FontFamily="{ThemeResource SymbolThemeFontFamily}"
FontSize="16"
Glyph=""/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="DateCalculation_CalendarViewStyle" TargetType="CalendarView">
<Setter Property="FocusBorderBrush" Value="{ThemeResource SystemControlForegroundBaseHighBrush}"/>
<Setter Property="SelectedHoverBorderBrush" Value="{ThemeResource SystemControlHighlightListAccentMediumBrush}"/>
<Setter Property="SelectedPressedBorderBrush" Value="{ThemeResource SystemControlHighlightListAccentHighBrush}"/>
<Setter Property="SelectedBorderBrush" Value="{ThemeResource SystemControlHighlightAccentBrush}"/>
<Setter Property="HoverBorderBrush" Value="{ThemeResource SystemControlHighlightBaseMediumLowBrush}"/>
<Setter Property="PressedBorderBrush" Value="{ThemeResource SystemControlHighlightBaseMediumBrush}"/>
<Setter Property="TodayForeground" Value="{ThemeResource SystemControlHighlightAltChromeWhiteBrush}"/>
<Setter Property="BlackoutForeground" Value="{ThemeResource SystemControlDisabledBaseMediumLowBrush}"/>
<Setter Property="SelectedForeground" Value="{ThemeResource SystemControlHighlightBaseHighBrush}"/>
<Setter Property="PressedForeground" Value="{ThemeResource SystemControlHighlightBaseHighBrush}"/>
<Setter Property="OutOfScopeForeground" Value="{ThemeResource SystemControlForegroundBaseMediumLowBrush}"/>
<Setter Property="CalendarItemForeground" Value="{ThemeResource SystemControlForegroundBaseHighBrush}"/>
<Setter Property="OutOfScopeBackground" Value="Transparent"/>
<Setter Property="CalendarItemBackground" Value="Transparent"/>
<Setter Property="CalendarItemBorderBrush" Value="Transparent"/>
<Setter Property="Foreground" Value="{ThemeResource SystemControlHyperlinkBaseMediumHighBrush}"/>
<Setter Property="Background" Value="{ThemeResource SystemControlBackgroundChromeMediumLowBrush}"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="CalendarItemBorderThickness" Value="2"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="DayItemFontSize" Value="18"/>
<Setter Property="HorizontalAlignment" Value="Stretch"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
<Setter Property="VerticalContentAlignment" Value="Stretch"/>
<Setter Property="Margin" Value="0,12,0,12"/>
<Setter Property="IsTabStop" Value="False"/>
</Style>
<MenuFlyout x:Key="ResultsContextMenu" x:Name="ResultsContextMenu">
<MenuFlyoutItem x:Name="CopyMenuItem"
x:Uid="CopyMenuItem"
Click="OnCopyMenuItemClicked"
Icon="Copy"/>
</MenuFlyout>
</UserControl.Resources>
<Grid x:Name="DateCalculatorGrid"
Margin="12,0,12,0"
AutomationProperties.LandmarkType="Main">
<Grid.ColumnDefinitions>
<ColumnDefinition x:Name="C0" Width="*"/>
<ColumnDefinition x:Name="C1" Width="0"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="1*"
MinHeight="{StaticResource HamburgerHeight}"
MaxHeight="52"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="8*"/>
</Grid.RowDefinitions>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup CurrentStateChanged="OnVisualStateChanged">
<VisualState x:Name="LeftAlignedLayout">
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="480"/>
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="C0.Width" Value="456"/>
<Setter Target="C1.Width" Value="*"/>
<Setter Target="DateDiffAllUnitsResultLabel.FontSize" Value="24"/>
<Setter Target="DateResultLabel.FontSize" Value="24"/>
</VisualState.Setters>
</VisualState>
<VisualState x:Name="DefaultLayout">
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="0"/>
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="DateDiffAllUnitsResultLabel.FontSize" Value="20"/>
<Setter Target="DateResultLabel.FontSize" Value="20"/>
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<!-- ComboBox for Date Calculation options -->
<ComboBox x:Name="DateCalculationOption"
x:Uid="DateCalculationOption"
Grid.Row="1"
Style="{ThemeResource DateCalculation_ComboStyle}"
SelectedIndex="0">
<ComboBoxItem x:Uid="Date_DifferenceOption"
MinWidth="276"
ContentTemplate="{StaticResource ComboBoxItemContentTemplate}"
IsSelected="{Binding IsDateDiffMode, Mode=TwoWay}"/>
<ComboBoxItem x:Uid="Date_AddSubtractOption"
MinWidth="276"
ContentTemplate="{StaticResource ComboBoxItemContentTemplate}"
IsSelected="{Binding IsDateDiffMode, Converter={StaticResource BooleanNegationConverter}, Mode=TwoWay}"/>
</ComboBox>
<!-- Grid to Calculate Difference between Two Dates -->
<Grid x:Name="DateDiffGrid"
Grid.Row="2"
Visibility="{Binding IsDateDiffMode, Converter={StaticResource BooleanToVisibilityConverter}}">
<Grid.RowDefinitions>
<RowDefinition Height="1*" MaxHeight="17"/>
<RowDefinition Height="Auto" MinHeight="32"/>
<RowDefinition Height="1*" MaxHeight="24"/>
<RowDefinition Height="Auto" MinHeight="32"/>
<RowDefinition Height="1*" MaxHeight="24"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="1*" MaxHeight="8"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<!-- From Date -->
<CalendarDatePicker x:Name="DateDiff_FromDate"
x:Uid="DateDiff_FromHeader"
Grid.Row="1"
Style="{StaticResource DateCalculation_CalendarPickerStyle}"
CalendarViewStyle="{StaticResource DateCalculation_CalendarViewStyle}"
Closed="CalendarFlyoutClosed"
DateChanged="FromDate_DateChanged"/>
<!-- To Date -->
<CalendarDatePicker x:Name="DateDiff_ToDate"
x:Uid="DateDiff_ToHeader"
Grid.Row="3"
Margin="0,0,0,0"
Style="{StaticResource DateCalculation_CalendarPickerStyle}"
CalendarViewStyle="{StaticResource DateCalculation_CalendarViewStyle}"
Closed="CalendarFlyoutClosed"
DateChanged="ToDate_DateChanged"/>
<!-- Difference Result -->
<TextBlock x:Uid="Date_DifferenceLabel"
Grid.Row="5"
Margin="0,0,0,0"
Foreground="{ThemeResource SystemControlPageTextBaseHighBrush}"/>
<TextBlock x:Name="DateDiffAllUnitsResultLabel"
Grid.Row="6"
Style="{ThemeResource SubtitleTextBlockStyle}"
FontWeight="SemiBold"
AutomationProperties.LiveSetting="Polite"
AutomationProperties.Name="{Binding StrDateDiffResultAutomationName}"
ContextFlyout="{StaticResource ResultsContextMenu}"
IsTextSelectionEnabled="True"
Text="{Binding StrDateDiffResult}"/>
<TextBlock Grid.Row="8"
Style="{ThemeResource BaseTextBlockStyle}"
Foreground="{ThemeResource SystemControlPageTextBaseMediumBrush}"
ContextFlyout="{StaticResource ResultsContextMenu}"
IsTextSelectionEnabled="True"
Text="{Binding StrDateDiffResultInDays, Mode=OneWay}"
Visibility="{Binding IsDiffInDays, Converter={StaticResource BooleanToVisibilityNegationConverter}}"/>
</Grid>
<!-- Grid for Add/Subtract Date -->
<Grid x:Name="AddSubtractDateGrid"
Grid.Row="2"
x:DeferLoadStrategy="Lazy"
Loaded="AddSubtractDateGrid_Loaded"
Visibility="{Binding IsDateDiffMode, Converter={StaticResource BooleanToVisibilityNegationConverter}}">
<Grid.RowDefinitions>
<RowDefinition Height="1*" MaxHeight="17"/>
<RowDefinition Height="Auto" MinHeight="32"/>
<RowDefinition Height="1*" MaxHeight="23"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="1*" MaxHeight="29"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="1*" MaxHeight="35"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<!-- From Date -->
<CalendarDatePicker x:Name="AddSubtract_FromDate"
x:Uid="AddSubtract_Date_FromHeader"
Grid.Row="1"
Margin="0,0,0,0"
Style="{StaticResource DateCalculation_CalendarPickerStyle}"
CalendarViewStyle="{StaticResource DateCalculation_CalendarViewStyle}"
Closed="CalendarFlyoutClosed"
DateChanged="AddSubtract_DateChanged"/>
<Grid Grid.Row="3">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<RadioButton x:Name="AddOption"
x:Uid="AddOption"
MinWidth="80"
MaxWidth="160"
VerticalAlignment="Top"
Checked="AddSubtractOption_Checked"
IsChecked="{Binding IsAddMode, Mode=TwoWay}"/>
<RadioButton x:Name="SubtractOption"
x:Uid="SubtractOption"
Grid.Column="1"
MinWidth="80"
MaxWidth="160"
Margin="20,0,0,0"
VerticalAlignment="Top"
Checked="AddSubtractOption_Checked"
IsChecked="{Binding IsAddMode, Converter={StaticResource BooleanNegationConverter}, Mode=TwoWay}"/>
</Grid>
<!-- Date Offset to be Added/Subtracted -->
<Grid x:Name="DateOffsetGrid" Grid.Row="5">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock x:Name="YearsLabel"
x:Uid="YearsLabel"
Margin="0,0,0,6"
Foreground="{ThemeResource SystemControlPageTextBaseMediumBrush}"
TextWrapping="Wrap"/>
<ComboBox x:Name="YearsValue"
Grid.Row="1"
MinWidth="84"
AutomationProperties.LabeledBy="{Binding ElementName=YearsLabel}"
DropDownClosed="OffsetDropDownClosed"
ItemsSource="{Binding OffsetValues, Mode=OneTime}"
SelectedIndex="{Binding YearsOffset, Mode=TwoWay}"
SelectionChanged="OffsetValue_Changed"/>
<TextBlock x:Name="MonthsLabel"
x:Uid="MonthsLabel"
Grid.Column="1"
Margin="12,0,12,6"
Foreground="{ThemeResource SystemControlPageTextBaseMediumBrush}"
TextWrapping="Wrap"/>
<ComboBox x:Name="MonthsValue"
Grid.Row="1"
Grid.Column="1"
MinWidth="84"
Margin="12,0,12,0"
AutomationProperties.LabeledBy="{Binding ElementName=MonthsLabel}"
DropDownClosed="OffsetDropDownClosed"
ItemsSource="{Binding OffsetValues, Mode=OneTime}"
SelectedIndex="{Binding MonthsOffset, Mode=TwoWay}"
SelectionChanged="OffsetValue_Changed"/>
<TextBlock x:Name="DaysLabel"
x:Uid="DaysLabel"
Grid.Column="2"
Margin="0,0,0,6"
Foreground="{ThemeResource SystemControlPageTextBaseMediumBrush}"
TextWrapping="Wrap"/>
<ComboBox x:Name="DaysValue"
Grid.Row="1"
Grid.Column="2"
MinWidth="84"
AutomationProperties.LabeledBy="{Binding ElementName=DaysLabel}"
DropDownClosed="OffsetDropDownClosed"
ItemsSource="{Binding OffsetValues, Mode=OneTime}"
SelectedIndex="{Binding DaysOffset, Mode=TwoWay}"
SelectionChanged="OffsetValue_Changed"/>
</Grid>
<!-- Resulting Date -->
<TextBlock x:Uid="DateLabel"
Grid.Row="7"
Foreground="{ThemeResource SystemControlPageTextBaseMediumBrush}"/>
<TextBlock x:Name="DateResultLabel"
Grid.Row="8"
Style="{ThemeResource SubtitleTextBlockStyle}"
FontWeight="SemiBold"
AutomationProperties.LiveSetting="Polite"
AutomationProperties.Name="{Binding StrDateResultAutomationName}"
ContextFlyout="{StaticResource ResultsContextMenu}"
IsTextSelectionEnabled="True"
Text="{Binding StrDateResult}"/>
</Grid>
</Grid>
</UserControl>