1 Star 0 Fork 2

ss / calculator

forked from Jerry / calculator 
Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
Clone or Download
DateCalculator.xaml 39.92 KB
Copy Edit Raw Blame History
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611
<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="&#xE0E5;"/>
</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="&#xE787;"/>
</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>
<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"/>
<RowDefinition Height="Auto" MinHeight="32"/>
<RowDefinition Height="1*" MaxHeight="24"/>
<RowDefinition Height="Auto"/>
<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 -->
<TextBlock x:Name="Date_FromLabel"
x:Uid="Date_FromLabel"
Grid.Row="1"
Margin="0,0,0,2"
Foreground="{ThemeResource SystemControlPageTextBaseHighBrush}"
TextWrapping="Wrap"/>
<CalendarDatePicker x:Name="DateDiff_FromDate"
Grid.Row="2"
Style="{StaticResource DateCalculation_CalendarPickerStyle}"
AutomationProperties.LabeledBy="{x:Bind Date_FromLabel}"
CalendarViewStyle="{StaticResource DateCalculation_CalendarViewStyle}"
Closed="CalendarFlyoutClosed"
DateChanged="FromDate_DateChanged"/>
<!-- To Date -->
<TextBlock x:Name="Date_ToLabel"
x:Uid="Date_ToLabel"
Grid.Row="4"
Margin="0,0,0,2"
Foreground="{ThemeResource SystemControlPageTextBaseHighBrush}"
TextWrapping="Wrap"/>
<CalendarDatePicker x:Name="DateDiff_ToDate"
Grid.Row="5"
Margin="0,0,0,0"
Style="{StaticResource DateCalculation_CalendarPickerStyle}"
AutomationProperties.LabeledBy="{x:Bind Date_ToLabel}"
CalendarViewStyle="{StaticResource DateCalculation_CalendarViewStyle}"
Closed="CalendarFlyoutClosed"
DateChanged="ToDate_DateChanged"/>
<!-- Difference Result -->
<TextBlock x:Uid="Date_DifferenceLabel"
Grid.Row="7"
Margin="0,0,0,0"
Foreground="{ThemeResource SystemControlPageTextBaseHighBrush}"/>
<TextBlock x:Name="DateDiffAllUnitsResultLabel"
Grid.Row="8"
Style="{ThemeResource SubtitleTextBlockStyle}"
FontWeight="SemiBold"
AutomationProperties.LiveSetting="Polite"
AutomationProperties.Name="{Binding StrDateDiffResultAutomationName}"
ContextFlyout="{StaticResource ResultsContextMenu}"
IsTextSelectionEnabled="True"
Text="{Binding StrDateDiffResult}"/>
<TextBlock Grid.Row="10"
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"/>
<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 -->
<TextBlock x:Name="AddSubtract_Date_FromLabel"
x:Uid="Date_FromLabel"
Grid.Row="1"
Margin="0,0,0,2"
Style="{ThemeResource BodyTextBlockStyle}"
Foreground="{ThemeResource SystemControlPageTextBaseMediumBrush}"
TextWrapping="Wrap"/>
<CalendarDatePicker x:Name="AddSubtract_FromDate"
Grid.Row="2"
Margin="0,0,0,0"
Style="{StaticResource DateCalculation_CalendarPickerStyle}"
AutomationProperties.LabeledBy="{x:Bind AddSubtract_Date_FromLabel}"
CalendarViewStyle="{StaticResource DateCalculation_CalendarViewStyle}"
Closed="CalendarFlyoutClosed"
DateChanged="AddSubtract_DateChanged"/>
<Grid Grid.Row="4">
<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="6">
<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="8"
Foreground="{ThemeResource SystemControlPageTextBaseMediumBrush}"/>
<TextBlock x:Name="DateResultLabel"
Grid.Row="9"
Style="{ThemeResource SubtitleTextBlockStyle}"
FontWeight="SemiBold"
AutomationProperties.LiveSetting="Polite"
AutomationProperties.Name="{Binding StrDateResultAutomationName}"
ContextFlyout="{StaticResource ResultsContextMenu}"
IsTextSelectionEnabled="True"
Text="{Binding StrDateResult}"/>
</Grid>
</Grid>
</UserControl>
C++
1
https://gitee.com/ss1353723121/calculator.git
git@gitee.com:ss1353723121/calculator.git
ss1353723121
calculator
calculator
master

Search