- Merge the 3 CalculationResultStyle(S|M|L) in App.xaml - Only modify CalculationResult::*FontSize in Calculator.xaml instead of fully updating the style of the control. - Create a new property MaxFontSize in order to be able to update it without being forced to fully update the Style (because m_startingFontSize was set in OnApplyTemplate) - Modify how DisplayMargin is managed to prevent the textblock Margin to shift when we update its value (without fully updating the Style).
1270 lines
85 KiB
XML
1270 lines
85 KiB
XML
<UserControl x:Class="CalculatorApp.Calculator"
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:automation="using:CalculatorApp.Common.Automation"
|
|
xmlns:common="using:CalculatorApp.Common"
|
|
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"
|
|
xmlns:model="using:CalculatorApp.ViewModel"
|
|
Loaded="OnLoaded"
|
|
mc:Ignorable="d">
|
|
|
|
<UserControl.Resources>
|
|
<!-- DataTemplates -->
|
|
|
|
<DataTemplate x:Key="Operand" x:DataType="common:DisplayExpressionToken">
|
|
<TextBlock Margin="2,0,0,0"
|
|
Foreground="{ThemeResource SystemControlPageTextBaseMediumBrush}"
|
|
IsTextScaleFactorEnabled="False"
|
|
Text="{Binding Token, Mode=OneWay}"/>
|
|
</DataTemplate>
|
|
|
|
<DataTemplate x:Key="Operator" x:DataType="common:DisplayExpressionToken">
|
|
<TextBlock Margin="2,0,0,0"
|
|
Foreground="{ThemeResource SystemControlPageTextBaseMediumBrush}"
|
|
IsTextScaleFactorEnabled="False"
|
|
Text="{Binding Token, Mode=OneWay}"/>
|
|
</DataTemplate>
|
|
|
|
<DataTemplate x:Key="Separator" x:DataType="common:DisplayExpressionToken">
|
|
<TextBlock x:Name="MainText"
|
|
IsTextScaleFactorEnabled="False"
|
|
Text="{Binding Token, Mode=OneWay}"/>
|
|
</DataTemplate>
|
|
|
|
<!-- TextBox Styles -->
|
|
|
|
<Style x:Key="OperandTextBoxStyle" TargetType="controls:OperandTextBox">
|
|
<Setter Property="MinWidth" Value="32"/>
|
|
<Setter Property="MinHeight" Value="20"/>
|
|
<Setter Property="Background" Value="Transparent"/>
|
|
<Setter Property="SelectionHighlightColor" Value="{ThemeResource SystemControlBackgroundAccentBrush}"/>
|
|
<Setter Property="FontSize" Value="{ThemeResource BodyFontSize}"/>
|
|
<Setter Property="IsTextScaleFactorEnabled" Value="False"/>
|
|
<Setter Property="TextAlignment" Value="Center"/>
|
|
<Setter Property="Padding" Value="2,0,3,0"/>
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="controls:OperandTextBox">
|
|
<Grid x:Name="BackgroundElement" Background="{ThemeResource SystemControlBackgroundAltHighBrush}">
|
|
<VisualStateManager.VisualStateGroups>
|
|
<VisualStateGroup x:Name="CommonStates">
|
|
<VisualState x:Name="Disabled"/>
|
|
<VisualState x:Name="Normal">
|
|
<VisualState.Setters>
|
|
<Setter Target="ContentElement.Foreground" Value="{ThemeResource SystemControlForegroundAccentBrush}"/>
|
|
</VisualState.Setters>
|
|
</VisualState>
|
|
<VisualState x:Name="PointerOver">
|
|
<VisualState.Setters>
|
|
<Setter Target="BackgroundElement.Background" Value="{ThemeResource SystemControlHighlightListAccentLowBrush}"/>
|
|
</VisualState.Setters>
|
|
</VisualState>
|
|
<VisualState x:Name="Focused">
|
|
<VisualState.Setters>
|
|
<Setter Target="BackgroundElement.Background" Value="{ThemeResource SystemControlForegroundChromeWhiteBrush}"/>
|
|
<Setter Target="ContentElement.Foreground" Value="{ThemeResource SystemControlBackgroundChromeBlackHighBrush}"/>
|
|
</VisualState.Setters>
|
|
</VisualState>
|
|
</VisualStateGroup>
|
|
</VisualStateManager.VisualStateGroups>
|
|
<ScrollViewer x:Name="ContentElement"
|
|
Padding="{TemplateBinding Padding}"
|
|
VerticalAlignment="Center"
|
|
AutomationProperties.AccessibilityView="Raw"
|
|
HorizontalScrollBarVisibility="Hidden"
|
|
HorizontalScrollMode="Disabled"
|
|
IsDeferredScrollingEnabled="False"
|
|
IsHorizontalRailEnabled="True"
|
|
IsTabStop="False"
|
|
IsVerticalRailEnabled="False"
|
|
VerticalScrollBarVisibility="Disabled"
|
|
VerticalScrollMode="Disabled"
|
|
ZoomMode="Disabled"/>
|
|
</Grid>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Style>
|
|
|
|
<Style x:Key="OperatorTextBoxStyle" TargetType="controls:OperatorTextBox">
|
|
<Setter Property="MinWidth" Value="4"/>
|
|
<Setter Property="MinHeight" Value="20"/>
|
|
<Setter Property="Padding" Value="0"/>
|
|
<Setter Property="Background" Value="Transparent"/>
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="controls:OperatorTextBox">
|
|
<Grid x:Name="BackgroundElement" Background="{ThemeResource SystemControlBackgroundAltHighBrush}">
|
|
<VisualStateManager.VisualStateGroups>
|
|
<VisualStateGroup x:Name="CommonStates">
|
|
<VisualState x:Name="Disabled"/>
|
|
<VisualState x:Name="Normal">
|
|
<VisualState.Setters>
|
|
<Setter Target="textElement.Foreground" Value="{ThemeResource SystemControlPageTextBaseMediumBrush}"/>
|
|
</VisualState.Setters>
|
|
</VisualState>
|
|
<VisualState x:Name="PointerOver">
|
|
<VisualState.Setters>
|
|
<Setter Target="BackgroundElement.Background" Value="{ThemeResource SystemControlHighlightListAccentLowBrush}"/>
|
|
</VisualState.Setters>
|
|
</VisualState>
|
|
<VisualState x:Name="Focused">
|
|
<VisualState.Setters>
|
|
<Setter Target="BackgroundElement.Background" Value="{ThemeResource SystemControlBackgroundAccentBrush}"/>
|
|
<Setter Target="textElement.Foreground" Value="{ThemeResource SystemControlForegroundChromeWhiteBrush}"/>
|
|
</VisualState.Setters>
|
|
</VisualState>
|
|
</VisualStateGroup>
|
|
</VisualStateManager.VisualStateGroups>
|
|
<TextBlock x:Name="textElement"
|
|
Margin="0,-2,0,2"
|
|
HorizontalAlignment="Center"
|
|
VerticalAlignment="Center"
|
|
Foreground="{TemplateBinding Foreground}"
|
|
FontSize="16"
|
|
IsHitTestVisible="True"
|
|
IsTextScaleFactorEnabled="False"
|
|
Text="{Binding Token}"
|
|
TextAlignment="Center"/>
|
|
</Grid>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Style>
|
|
|
|
<Style TargetType="controls:OverflowTextBlock">
|
|
<Setter Property="HorizontalAlignment" Value="Stretch"/>
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="controls:OverflowTextBlock">
|
|
<Border x:Name="expressionborder" Background="Transparent">
|
|
<Grid x:Name="tokenContainer" Background="{TemplateBinding Background}">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="12"/>
|
|
<ColumnDefinition/>
|
|
<ColumnDefinition Width="12"/>
|
|
</Grid.ColumnDefinitions>
|
|
<ScrollViewer x:Name="expressionContainer"
|
|
Grid.Column="1"
|
|
Padding="0,0,0,0"
|
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
|
Style="{StaticResource ResultsScrollerSnapped}"
|
|
AutomationProperties.AccessibilityView="Raw"
|
|
LayoutUpdated="expressionContainer_LayoutUpdated">
|
|
<ListView x:Name="TokenList"
|
|
Padding="0"
|
|
VerticalAlignment="Stretch"
|
|
HorizontalContentAlignment="Right"
|
|
VerticalContentAlignment="Stretch"
|
|
IsTabStop="False"
|
|
ItemContainerStyleSelector="{StaticResource ExpressionItemContainerStyle}"
|
|
ItemTemplateSelector="{StaticResource ExpressionItemTemplateSelector}"
|
|
ItemsSource="{Binding ExpressionTokens}"
|
|
ScrollViewer.HorizontalScrollBarVisibility="Hidden"
|
|
ScrollViewer.HorizontalScrollMode="Enabled"
|
|
ScrollViewer.VerticalScrollBarVisibility="Disabled"
|
|
ScrollViewer.VerticalScrollMode="Disabled"
|
|
SelectionMode="None">
|
|
<ListView.ItemsPanel>
|
|
<ItemsPanelTemplate>
|
|
<StackPanel HorizontalAlignment="Right"
|
|
VerticalAlignment="Stretch"
|
|
Orientation="Horizontal"/>
|
|
</ItemsPanelTemplate>
|
|
</ListView.ItemsPanel>
|
|
<ListView.ItemContainerTransitions>
|
|
<TransitionCollection/>
|
|
</ListView.ItemContainerTransitions>
|
|
</ListView>
|
|
</ScrollViewer>
|
|
<Button x:Name="scrollLeft"
|
|
x:Uid="scrollLeft"
|
|
Grid.Column="0"
|
|
Margin="-4,3,-4,0"
|
|
Style="{StaticResource ScrollButtonStyle}">
|
|
<FontIcon FontFamily="{ThemeResource SymbolThemeFontFamily}"
|
|
FontSize="12"
|
|
Glyph=""/>
|
|
</Button>
|
|
<Button x:Name="scrollRight"
|
|
x:Uid="scrollRight"
|
|
Grid.Column="2"
|
|
Margin="0,3,-9,0"
|
|
Style="{StaticResource ScrollButtonStyle}">
|
|
<FontIcon FontFamily="{ThemeResource SymbolThemeFontFamily}"
|
|
FontSize="12"
|
|
Glyph=""/>
|
|
</Button>
|
|
</Grid>
|
|
</Border>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Style>
|
|
|
|
<!-- ListViewItem Styles -->
|
|
|
|
<Style x:Key="ExpressionBaseContainerStyle" TargetType="ListViewItem">
|
|
<Setter Property="Background" Value="Transparent"/>
|
|
<Setter Property="Margin" Value="0"/>
|
|
<Setter Property="MinWidth" Value="0"/>
|
|
<Setter Property="MinHeight" Value="0"/>
|
|
<Setter Property="HorizontalAlignment" Value="Center"/>
|
|
<Setter Property="VerticalAlignment" Value="Stretch"/>
|
|
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
|
|
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="ListViewItem">
|
|
<ListViewItemPresenter Padding="0"
|
|
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
|
|
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
|
|
ContentMargin="0"
|
|
DisabledOpacity="{ThemeResource ListViewItemDisabledThemeOpacity}"
|
|
DragOpacity="{ThemeResource ListViewItemDragThemeOpacity}"
|
|
PointerOverBackground="{ThemeResource SystemControlHighlightListAccentLowBrush}"
|
|
PointerOverBackgroundMargin="0"
|
|
SelectedBackground="{ThemeResource SystemControlBackgroundAccentBrush}"
|
|
SelectedBorderThickness="0"
|
|
SelectedForeground="{ThemeResource SystemControlForegroundChromeWhiteBrush}"
|
|
SelectedPointerOverBackground="{ThemeResource SystemControlHighlightListAccentLowBrush}"
|
|
SelectedPointerOverBorderBrush="Transparent"
|
|
SelectionCheckMarkVisualEnabled="False"/>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Style>
|
|
|
|
<Style x:Key="NonEditableOperatorContainerStyle"
|
|
BasedOn="{StaticResource ExpressionBaseContainerStyle}"
|
|
TargetType="ListViewItem">
|
|
<Setter Property="IsHitTestVisible" Value="False"/>
|
|
<Setter Property="IsTabStop" Value="False"/>
|
|
<Setter Property="MinWidth" Value="4"/>
|
|
</Style>
|
|
|
|
<Style x:Key="EditableOperatorContainerStyle"
|
|
BasedOn="{StaticResource ExpressionBaseContainerStyle}"
|
|
TargetType="ListViewItem">
|
|
<Setter Property="IsHitTestVisible" Value="True"/>
|
|
<Setter Property="MinWidth" Value="32"/>
|
|
</Style>
|
|
|
|
<!-- Calculation Result Styles -->
|
|
<Style x:Key="ResultsStyle"
|
|
BasedOn="{StaticResource CalculationResultStyle}"
|
|
TargetType="controls:CalculationResult">
|
|
<Setter Property="HorizontalContentAlignment" Value="Right"/>
|
|
<Setter Property="VerticalContentAlignment" Value="Top"/>
|
|
<Setter Property="DisplayMargin" Value="0,0,0,0"/>
|
|
<Setter Property="IsActive" Value="True"/>
|
|
<Setter Property="MinFontSize" Value="12"/>
|
|
</Style>
|
|
|
|
<!-- Button Styles -->
|
|
<Style x:Key="ScrollButtonStyle" TargetType="Button">
|
|
<Setter Property="BorderThickness" Value="0"/>
|
|
<Setter Property="Padding" Value="0,0,0,0"/>
|
|
<Setter Property="VerticalAlignment" Value="Center"/>
|
|
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
|
<Setter Property="HorizontalContentAlignment" Value="Center"/>
|
|
<Setter Property="Width" Value="20"/>
|
|
<Setter Property="MinWidth" Value="20"/>
|
|
<Setter Property="MinHeight" Value="24"/>
|
|
<Setter Property="Foreground" Value="{ThemeResource SystemControlForegroundAccentBrush}"/>
|
|
<Setter Property="Background" Value="Transparent"/>
|
|
<Setter Property="Visibility" Value="Collapsed"/>
|
|
</Style>
|
|
|
|
<!-- Flyout Styles -->
|
|
|
|
<Style x:Key="MemoryFlyoutStyle" TargetType="FlyoutPresenter">
|
|
<Setter Property="MinWidth" Value="200"/>
|
|
<Setter Property="MaxHeight" Value="2400"/>
|
|
<Setter Property="MaxWidth" Value="2400"/>
|
|
<Setter Property="ContentTransitions">
|
|
<Setter.Value>
|
|
<TransitionCollection>
|
|
<EdgeUIThemeTransition Edge="Bottom"/>
|
|
</TransitionCollection>
|
|
</Setter.Value>
|
|
</Setter>
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="FlyoutPresenter">
|
|
<Grid Margin="0"
|
|
Background="Transparent"
|
|
Tapped="OnMemoryFlyOutTapped">
|
|
<ContentPresenter HorizontalAlignment="Stretch"
|
|
VerticalAlignment="Stretch"
|
|
Content="{TemplateBinding Content}"
|
|
ContentTemplate="{TemplateBinding ContentTemplate}"
|
|
ContentTransitions="{TemplateBinding ContentTransitions}"/>
|
|
</Grid>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Style>
|
|
|
|
<Style x:Key="HistoryFlyoutStyle" TargetType="FlyoutPresenter">
|
|
<Setter Property="MinWidth" Value="200"/>
|
|
<Setter Property="MaxHeight" Value="2400"/>
|
|
<Setter Property="MaxWidth" Value="2400"/>
|
|
<Setter Property="ContentTransitions">
|
|
<Setter.Value>
|
|
<TransitionCollection>
|
|
<EdgeUIThemeTransition Edge="Bottom"/>
|
|
</TransitionCollection>
|
|
</Setter.Value>
|
|
</Setter>
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="FlyoutPresenter">
|
|
<Grid Margin="0"
|
|
Background="Transparent"
|
|
Tapped="OnHistoryFlyOutTapped">
|
|
<ContentPresenter HorizontalAlignment="Stretch"
|
|
VerticalAlignment="Stretch"
|
|
Content="{TemplateBinding Content}"
|
|
ContentTemplate="{TemplateBinding ContentTemplate}"
|
|
ContentTransitions="{TemplateBinding ContentTransitions}"/>
|
|
|
|
<Border x:Name="CustomTitleBar"
|
|
Height="32"
|
|
HorizontalAlignment="Stretch"
|
|
Background="{ThemeResource TitleBarBackgroundTransparentBrush}"/>
|
|
</Grid>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Style>
|
|
|
|
<!-- Storyboards -->
|
|
|
|
<Storyboard x:Name="Animate">
|
|
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="NumpadPanel" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleX)">
|
|
<EasingDoubleKeyFrame KeyTime="0" Value="0.92">
|
|
<EasingDoubleKeyFrame.EasingFunction>
|
|
<ExponentialEase EasingMode="EaseOut" Exponent="5"/>
|
|
</EasingDoubleKeyFrame.EasingFunction>
|
|
</EasingDoubleKeyFrame>
|
|
<EasingDoubleKeyFrame KeyTime="0:0:0.367" Value="1">
|
|
<EasingDoubleKeyFrame.EasingFunction>
|
|
<ExponentialEase EasingMode="EaseOut" Exponent="5"/>
|
|
</EasingDoubleKeyFrame.EasingFunction>
|
|
</EasingDoubleKeyFrame>
|
|
</DoubleAnimationUsingKeyFrames>
|
|
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="NumpadPanel" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleY)">
|
|
<EasingDoubleKeyFrame KeyTime="0" Value="0.92">
|
|
<EasingDoubleKeyFrame.EasingFunction>
|
|
<ExponentialEase EasingMode="EaseOut" Exponent="5"/>
|
|
</EasingDoubleKeyFrame.EasingFunction>
|
|
</EasingDoubleKeyFrame>
|
|
<EasingDoubleKeyFrame KeyTime="0:0:0.367" Value="1">
|
|
<EasingDoubleKeyFrame.EasingFunction>
|
|
<ExponentialEase EasingMode="EaseOut" Exponent="5"/>
|
|
</EasingDoubleKeyFrame.EasingFunction>
|
|
</EasingDoubleKeyFrame>
|
|
</DoubleAnimationUsingKeyFrames>
|
|
</Storyboard>
|
|
|
|
<Storyboard x:Name="AnimateWithoutResult">
|
|
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="NumpadPanel" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleX)">
|
|
<EasingDoubleKeyFrame KeyTime="0" Value="0.92">
|
|
<EasingDoubleKeyFrame.EasingFunction>
|
|
<ExponentialEase EasingMode="EaseOut" Exponent="5"/>
|
|
</EasingDoubleKeyFrame.EasingFunction>
|
|
</EasingDoubleKeyFrame>
|
|
<EasingDoubleKeyFrame KeyTime="0:0:0.367" Value="1">
|
|
<EasingDoubleKeyFrame.EasingFunction>
|
|
<ExponentialEase EasingMode="EaseOut" Exponent="5"/>
|
|
</EasingDoubleKeyFrame.EasingFunction>
|
|
</EasingDoubleKeyFrame>
|
|
</DoubleAnimationUsingKeyFrames>
|
|
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="NumpadPanel" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleY)">
|
|
<EasingDoubleKeyFrame KeyTime="0" Value="0.92">
|
|
<EasingDoubleKeyFrame.EasingFunction>
|
|
<ExponentialEase EasingMode="EaseOut" Exponent="5"/>
|
|
</EasingDoubleKeyFrame.EasingFunction>
|
|
</EasingDoubleKeyFrame>
|
|
<EasingDoubleKeyFrame KeyTime="0:0:0.367" Value="1">
|
|
<EasingDoubleKeyFrame.EasingFunction>
|
|
<ExponentialEase EasingMode="EaseOut" Exponent="5"/>
|
|
</EasingDoubleKeyFrame.EasingFunction>
|
|
</EasingDoubleKeyFrame>
|
|
</DoubleAnimationUsingKeyFrames>
|
|
</Storyboard>
|
|
|
|
<!-- Value Converters -->
|
|
|
|
<converters:BooleanToVisibilityNegationConverter x:Key="BooleanToVisibilityNegationConverter"/>
|
|
|
|
<converters:BooleanNegationConverter x:Key="BooleanNegationConverter"/>
|
|
|
|
<!-- DataTemplate Selectors and Style Selectors -->
|
|
|
|
<converters:ExpressionItemTemplateSelector x:Key="ExpressionItemTemplateSelector"
|
|
OperandTemplate="{StaticResource Operand}"
|
|
OperatorTemplate="{StaticResource Operator}"
|
|
SeparatorTemplate="{StaticResource Separator}"/>
|
|
|
|
<converters:ExpressionItemContainerStyle x:Key="ExpressionItemContainerStyle"
|
|
EditableOperatorStyle="{StaticResource NonEditableOperatorContainerStyle}"
|
|
NonEditableOperatorStyle="{StaticResource NonEditableOperatorContainerStyle}"
|
|
OperandStyle="{StaticResource NonEditableOperatorContainerStyle}"
|
|
SeparatorStyle="{StaticResource NonEditableOperatorContainerStyle}"/>
|
|
|
|
<!-- Miscellaneous Resources -->
|
|
|
|
<automation:NarratorNotifier x:Name="NarratorNotifier" Announcement="{x:Bind Model.Announcement, Mode=OneWay}"/>
|
|
|
|
<!-- Used by hidden shortcut buttons -->
|
|
<x:Int32 x:Key="Zero">0</x:Int32>
|
|
|
|
<MenuFlyout x:Key="DisplayContextMenu">
|
|
<MenuFlyoutItem x:Name="CopyMenuItem"
|
|
x:Uid="CopyMenuItem"
|
|
Command="{x:Bind Model.CopyCommand}"
|
|
Icon="Copy"/>
|
|
<MenuFlyoutItem x:Name="PasteMenuItem"
|
|
x:Uid="PasteMenuItem"
|
|
Command="{x:Bind Model.PasteCommand}"
|
|
Icon="Paste"/>
|
|
</MenuFlyout>
|
|
</UserControl.Resources>
|
|
|
|
<Grid AutomationProperties.LandmarkType="Main">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition x:Name="ColumnMain"/>
|
|
<ColumnDefinition x:Name="ColumnHistory"
|
|
Width="0"
|
|
MaxWidth="320"/>
|
|
</Grid.ColumnDefinitions>
|
|
|
|
<VisualStateManager.VisualStateGroups>
|
|
<!-- Error Layout specific -->
|
|
<VisualStateGroup x:Name="ErrorVisualStates">
|
|
<VisualState x:Name="NoErrorLayout"/>
|
|
<VisualState x:Name="ErrorLayout">
|
|
<VisualState.Setters>
|
|
<Setter Target="ClearMemoryButton.IsEnabled" Value="False"/>
|
|
<Setter Target="MemRecall.IsEnabled" Value="False"/>
|
|
<Setter Target="MemPlus.IsEnabled" Value="False"/>
|
|
<Setter Target="MemMinus.IsEnabled" Value="False"/>
|
|
<Setter Target="memButton.IsEnabled" Value="False"/>
|
|
</VisualState.Setters>
|
|
<Storyboard Completed="OnErrorLayoutCompleted"/>
|
|
</VisualState>
|
|
</VisualStateGroup>
|
|
<!-- Mode specific -->
|
|
<VisualStateGroup x:Name="Mode">
|
|
<VisualState x:Name="Standard">
|
|
<Storyboard Completed="OnStoryboardCompleted"/>
|
|
</VisualState>
|
|
<VisualState x:Name="Scientific">
|
|
<VisualState.Setters>
|
|
<Setter Target="RowDisplayControls.Height" Value="32*"/>
|
|
<Setter Target="RowDisplayControls.MinHeight" Value="32"/>
|
|
<Setter Target="RowNumPad.Height" Value="276*"/>
|
|
</VisualState.Setters>
|
|
<Storyboard Completed="OnStoryboardCompleted"/>
|
|
</VisualState>
|
|
<VisualState x:Name="Programmer">
|
|
<VisualState.Setters>
|
|
<Setter Target="RowDisplayControls.Height" Value="96*"/>
|
|
<Setter Target="RowDisplayControls.MinHeight" Value="96"/>
|
|
<Setter Target="RowNumPad.Height" Value="268*"/>
|
|
<Setter Target="M4.Width" Value="0.01*"/>
|
|
<Setter Target="M4.MaxWidth" Value="99999"/>
|
|
<Setter Target="M5.Width" Value="1*"/>
|
|
<Setter Target="M5.MaxWidth" Value="80"/>
|
|
<Setter Target="memButton.(Grid.Column)" Value="5"/>
|
|
<Setter Target="MemoryButton.(Grid.Column)" Value="6"/>
|
|
<Setter Target="HistoryButton.Visibility" Value="Collapsed"/>
|
|
</VisualState.Setters>
|
|
<Storyboard Completed="OnStoryboardCompleted"/>
|
|
</VisualState>
|
|
</VisualStateGroup>
|
|
<!-- Layout specific -->
|
|
<VisualStateGroup>
|
|
<VisualState x:Name="Portrait768x1366">
|
|
<VisualState.StateTriggers>
|
|
<AdaptiveTrigger MinWindowHeight="1366" MinWindowWidth="768"/>
|
|
</VisualState.StateTriggers>
|
|
<VisualState.Setters>
|
|
<Setter Target="ColumnHistory.Width" Value="320"/>
|
|
<Setter Target="DockPanel.Visibility" Value="Visible"/>
|
|
<Setter Target="M6.Width" Value="0"/>
|
|
</VisualState.Setters>
|
|
<Storyboard Completed="OnLayoutStateChanged"/>
|
|
</VisualState>
|
|
<VisualState x:Name="LargeWideView">
|
|
<VisualState.StateTriggers>
|
|
<AdaptiveTrigger MinWindowHeight="768" MinWindowWidth="1024"/>
|
|
</VisualState.StateTriggers>
|
|
<VisualState.Setters>
|
|
<Setter Target="ColumnHistory.Width" Value="320"/>
|
|
<Setter Target="DockPanel.Visibility" Value="Visible"/>
|
|
<Setter Target="M6.Width" Value="0"/>
|
|
</VisualState.Setters>
|
|
<Storyboard Completed="OnLayoutStateChanged"/>
|
|
</VisualState>
|
|
<VisualState x:Name="DockVisible">
|
|
<VisualState.StateTriggers>
|
|
<AdaptiveTrigger MinWindowHeight="0" MinWindowWidth="560"/>
|
|
</VisualState.StateTriggers>
|
|
<VisualState.Setters>
|
|
<Setter Target="ColumnMain.Width" Value="320*"/>
|
|
<Setter Target="ColumnHistory.Width" Value="240*"/>
|
|
<Setter Target="DockPanel.Visibility" Value="Visible"/>
|
|
<Setter Target="M6.Width" Value="0"/>
|
|
</VisualState.Setters>
|
|
<Storyboard Completed="OnLayoutStateChanged"/>
|
|
</VisualState>
|
|
<VisualState x:Name="MinSizeLayout">
|
|
<VisualState.StateTriggers>
|
|
<AdaptiveTrigger MinWindowHeight="{StaticResource AppMinWindowHeight}" MinWindowWidth="{StaticResource AppMinWindowWidth}"/>
|
|
</VisualState.StateTriggers>
|
|
<Storyboard Completed="OnLayoutStateChanged"/>
|
|
</VisualState>
|
|
<VisualState x:Name="DefaultLayout">
|
|
<VisualState.StateTriggers>
|
|
<AdaptiveTrigger MinWindowHeight="0" MinWindowWidth="0"/>
|
|
</VisualState.StateTriggers>
|
|
<VisualState.Setters>
|
|
<Setter Target="RowMemoryControls.MinHeight" Value="24"/>
|
|
|
|
<Setter Target="ClearMemoryButton.Style" Value="{StaticResource CaptionButtonStyle}"/>
|
|
<Setter Target="MemRecall.Style" Value="{StaticResource CaptionButtonStyle}"/>
|
|
<Setter Target="MemPlus.Style" Value="{StaticResource CaptionButtonStyle}"/>
|
|
<Setter Target="MemMinus.Style" Value="{StaticResource CaptionButtonStyle}"/>
|
|
<Setter Target="memButton.Style" Value="{StaticResource CaptionButtonStyle}"/>
|
|
<Setter Target="MemoryButton.MinHeight" Value="0"/>
|
|
</VisualState.Setters>
|
|
<Storyboard Completed="OnLayoutStateChanged"/>
|
|
</VisualState>
|
|
</VisualStateGroup>
|
|
<!-- Results display specific -->
|
|
<VisualStateGroup>
|
|
<VisualState x:Name="ResultsL">
|
|
<VisualState.StateTriggers>
|
|
<AdaptiveTrigger MinWindowHeight="800"/>
|
|
</VisualState.StateTriggers>
|
|
<VisualState.Setters>
|
|
<Setter Target="Results.MaxFontSize" Value="72"/>
|
|
<Setter Target="Results.MaxExpressionHistoryCharacters" Value="51"/>
|
|
<Setter Target="RowResult.MinHeight" Value="108"/>
|
|
<Setter Target="RowResult.Height" Value="72*"/>
|
|
</VisualState.Setters>
|
|
</VisualState>
|
|
<VisualState x:Name="ResultsM">
|
|
<VisualState.StateTriggers>
|
|
<AdaptiveTrigger x:Name="ResultsMVisualStateTrigger" MinWindowHeight="640"/>
|
|
</VisualState.StateTriggers>
|
|
<VisualState.Setters>
|
|
<Setter Target="Results.MaxFontSize" Value="46"/>
|
|
<Setter Target="Results.MaxExpressionHistoryCharacters" Value="30"/>
|
|
<Setter Target="RowResult.MinHeight" Value="72"/>
|
|
<Setter Target="RowResult.Height" Value="72*"/>
|
|
</VisualState.Setters>
|
|
</VisualState>
|
|
<VisualState x:Name="ResultsS">
|
|
<VisualState.StateTriggers>
|
|
<AdaptiveTrigger MinWindowHeight="0"/>
|
|
</VisualState.StateTriggers>
|
|
<VisualState.Setters>
|
|
<Setter Target="Results.MaxFontSize" Value="26"/>
|
|
<Setter Target="Results.MaxExpressionHistoryCharacters" Value="30"/>
|
|
<Setter Target="RowResult.MinHeight" Value="42"/>
|
|
<Setter Target="RowResult.Height" Value="42*"/>
|
|
</VisualState.Setters>
|
|
</VisualState>
|
|
</VisualStateGroup>
|
|
</VisualStateManager.VisualStateGroups>
|
|
|
|
<Grid FlowDirection="LeftToRight">
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition x:Name="RowHamburger" Height="{StaticResource HamburgerHeightGridLength}"/>
|
|
<RowDefinition x:Name="RowExpression"
|
|
Height="20*"
|
|
MinHeight="20"/>
|
|
<RowDefinition x:Name="RowResult"
|
|
Height="72*"
|
|
MinHeight="72"/>
|
|
<RowDefinition x:Name="RowDisplayControls" Height="0"/>
|
|
<RowDefinition x:Name="RowMemoryControls"
|
|
Height="32*"
|
|
MinHeight="32"/>
|
|
<RowDefinition x:Name="RowNumPad"
|
|
Height="308*"
|
|
MinHeight="0"/>
|
|
</Grid.RowDefinitions>
|
|
|
|
<controls:CalculationResult x:Name="Results"
|
|
x:Uid="CalculatorResults"
|
|
Grid.Row="2"
|
|
Margin="0,0,0,0"
|
|
Style="{ThemeResource ResultsStyle}"
|
|
AutomationProperties.AutomationId="CalculatorResults"
|
|
AutomationProperties.HeadingLevel="Level1"
|
|
AutomationProperties.Name="{x:Bind Model.CalculationResultAutomationName, Mode=OneWay}"
|
|
ContextCanceled="OnContextCanceled"
|
|
ContextRequested="OnContextRequested"
|
|
DisplayStringExpression="{x:Bind Model.DisplayStringExpression, Mode=OneWay}"
|
|
DisplayValue="{x:Bind Model.DisplayValue, Mode=OneWay}"
|
|
ExpressionVisibility="Visible"
|
|
IsInError="{x:Bind Model.IsInError, Mode=OneWay}"
|
|
IsOperatorCommand="{x:Bind Model.IsOperatorCommand, Mode=OneWay}"
|
|
TabIndex="1"/>
|
|
<controls:OverflowTextBlock x:Name="expressionText"
|
|
Grid.Row="1"
|
|
Margin="6,0,6,0"
|
|
VerticalAlignment="Bottom"
|
|
AutomationProperties.AutomationId="CalculatorExpression"
|
|
AutomationProperties.Name="{x:Bind Model.CalculationExpressionAutomationName, Mode=OneWay}"
|
|
IsTabStop="False"
|
|
TokensUpdated="{Binding AreTokensUpdated, Mode=OneWay}"/>
|
|
|
|
<!-- Programmer display panel controls -->
|
|
<local:CalculatorProgrammerOperators x:Name="ProgrammerOperators"
|
|
Grid.Row="3"
|
|
x:Load="False"
|
|
IsEnabled="{x:Bind Model.IsProgrammer, Mode=OneWay}"
|
|
TabIndex="6"
|
|
Visibility="{x:Bind Model.IsProgrammer, Mode=OneWay}"/>
|
|
|
|
<local:CalculatorProgrammerDisplayPanel x:Name="ProgrammerDisplayPanel"
|
|
Grid.Row="4"
|
|
x:Load="False"
|
|
IsEnabled="{x:Bind Model.IsProgrammer, Mode=OneWay}"
|
|
TabIndex="7"
|
|
Visibility="{x:Bind Model.IsProgrammer, Mode=OneWay}"/>
|
|
|
|
<Button x:Name="HistoryButton"
|
|
x:Uid="HistoryButton"
|
|
Grid.Row="0"
|
|
Style="{StaticResource HistoryButtonStyle}"
|
|
AutomationProperties.AutomationId="HistoryButton"
|
|
Command="{x:Bind HistoryButtonPressed, Mode=OneTime}"
|
|
Content=""
|
|
ExitDisplayModeOnAccessKeyInvoked="False"
|
|
TabIndex="2">
|
|
<FlyoutBase.AttachedFlyout>
|
|
<Flyout x:Name="HistoryFlyout"
|
|
AutomationProperties.AutomationId="HistoryFlyout"
|
|
Closed="HistoryFlyout_Closed"
|
|
FlyoutPresenterStyle="{ThemeResource HistoryFlyoutStyle}"
|
|
Opened="HistoryFlyout_Opened"
|
|
Placement="Full"/>
|
|
</FlyoutBase.AttachedFlyout>
|
|
</Button>
|
|
|
|
<!-- Scientific angle buttons -->
|
|
<local:CalculatorScientificAngleButtons x:Name="ScientificAngleButtons"
|
|
Grid.Row="3"
|
|
x:Load="False"
|
|
IsEnabled="{x:Bind Model.IsScientific, Mode=OneWay}"
|
|
TabIndex="6"
|
|
Visibility="{x:Bind Model.IsScientific, Mode=OneWay}"/>
|
|
|
|
<!-- Memory panel controls -->
|
|
<Grid x:Name="MemoryPanel"
|
|
x:Uid="MemoryPanel"
|
|
Grid.Row="4"
|
|
Margin="3,0,3,0"
|
|
AutomationProperties.HeadingLevel="Level1">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="1*" MaxWidth="80"/>
|
|
<ColumnDefinition Width="1*" MaxWidth="80"/>
|
|
<ColumnDefinition Width="1*" MaxWidth="80"/>
|
|
<ColumnDefinition Width="1*" MaxWidth="80"/>
|
|
<ColumnDefinition x:Name="M4"
|
|
Width="1*"
|
|
MaxWidth="80"/>
|
|
<ColumnDefinition x:Name="M5" Width="0.01*"/>
|
|
<ColumnDefinition x:Name="M6"
|
|
Width="1*"
|
|
MaxWidth="80"/>
|
|
</Grid.ColumnDefinitions>
|
|
|
|
<controls:CalculatorButton x:Name="ClearMemoryButton"
|
|
x:Uid="ClearMemoryButton"
|
|
Style="{StaticResource CaptionButtonStyle}"
|
|
AutomationProperties.AutomationId="ClearMemoryButton"
|
|
Command="{x:Bind Model.ClearMemoryCommand}"
|
|
Content="MC"
|
|
TabIndex="10"
|
|
Visibility="{Binding IsProgrammer, Converter={StaticResource BooleanToVisibilityNegationConverter}}"/>
|
|
<controls:CalculatorButton x:Name="MemRecall"
|
|
x:Uid="MemRecall"
|
|
Grid.Column="1"
|
|
Style="{StaticResource CaptionButtonStyle}"
|
|
AutomationProperties.AutomationId="MemRecall"
|
|
Command="{x:Bind Model.MemoryItemPressed}"
|
|
CommandParameter="{StaticResource Zero}"
|
|
Content="MR"
|
|
TabIndex="11"
|
|
Visibility="{Binding IsProgrammer, Converter={StaticResource BooleanToVisibilityNegationConverter}}"/>
|
|
<controls:CalculatorButton x:Name="MemPlus"
|
|
x:Uid="MemPlus"
|
|
Grid.Column="2"
|
|
Style="{StaticResource CaptionButtonStyle}"
|
|
AutomationProperties.AutomationId="MemPlus"
|
|
Command="{x:Bind Model.MemoryAdd}"
|
|
CommandParameter="{StaticResource Zero}"
|
|
Content="M+"
|
|
TabIndex="12"
|
|
Visibility="{Binding IsProgrammer, Converter={StaticResource BooleanToVisibilityNegationConverter}}"/>
|
|
<controls:CalculatorButton x:Name="MemMinus"
|
|
x:Uid="MemMinus"
|
|
Grid.Column="3"
|
|
Style="{StaticResource CaptionButtonStyle}"
|
|
AutomationProperties.AutomationId="MemMinus"
|
|
Command="{x:Bind Model.MemorySubtract}"
|
|
CommandParameter="{StaticResource Zero}"
|
|
Content="M-"
|
|
TabIndex="13"
|
|
Visibility="{Binding IsProgrammer, Converter={StaticResource BooleanToVisibilityNegationConverter}}"/>
|
|
<controls:CalculatorButton x:Name="memButton"
|
|
x:Uid="memButton"
|
|
Grid.Column="4"
|
|
Style="{StaticResource CaptionButtonStyle}"
|
|
AutomationProperties.AutomationId="memButton"
|
|
ButtonId="Memory"
|
|
Content="MS"
|
|
TabIndex="14"/>
|
|
<Button x:Name="MemoryButton"
|
|
x:Uid="MemoryButton"
|
|
Grid.Column="6"
|
|
MinWidth="15.5"
|
|
MinHeight="8.402"
|
|
Style="{StaticResource PathFakeButtonStyle}"
|
|
AutomationProperties.AutomationId="MemoryButton"
|
|
Click="ToggleMemoryFlyout"
|
|
Content="M0,9.46968e-006L1.96199,9.46968e-006L4.17099,5.59502C4.33899,6.02501 4.44899,6.34502 4.5,6.55602L4.52899,6.55602C4.67299,6.11501 4.791,5.78701 4.87999,5.57201L7.12999,9.46968e-006L9.023,9.46968e-006L9.023,8.402L7.64,8.402L7.64,2.96501C7.64,2.519 7.668,1.97401 7.722,1.33L7.69899,1.33C7.613,1.697 7.53699,1.96101 7.46999,2.12102L4.96199,8.402L4.002,8.402L1.48799,2.16801C1.418,1.98399 1.34299,1.705 1.265,1.33L1.24199,1.33C1.273,1.666 1.28899,2.21501 1.28899,2.976L1.28899,8.402L0,8.402zM10.5,0L15.5,0L12.99,2.5z"
|
|
ExitDisplayModeOnAccessKeyInvoked="False"
|
|
IsEnabled="{x:Bind Model.IsMemoryEmpty, Converter={StaticResource BooleanNegationConverter}, Mode=OneWay}"
|
|
TabIndex="15">
|
|
<FlyoutBase.AttachedFlyout>
|
|
<Flyout x:Name="MemoryFlyout"
|
|
x:Uid="MemoryFlyout"
|
|
AutomationProperties.AutomationId="MemoryFlyout"
|
|
Closed="OnMemoryFlyoutClosed"
|
|
FlyoutPresenterStyle="{ThemeResource MemoryFlyoutStyle}"
|
|
Opened="OnMemoryFlyoutOpened"
|
|
Placement="Full"/>
|
|
</FlyoutBase.AttachedFlyout>
|
|
</Button>
|
|
</Grid>
|
|
|
|
<Grid x:Name="NumpadPanel"
|
|
Grid.Row="5"
|
|
Margin="3,0,3,3"
|
|
RenderTransformOrigin="0.5,0.5">
|
|
<Grid.RenderTransform>
|
|
<CompositeTransform/>
|
|
</Grid.RenderTransform>
|
|
|
|
<local:OperatorsPanel x:Name="OpsPanel" IsBitFlipChecked="{x:Bind Model.IsBitFlipChecked, Mode=OneWay}"/>
|
|
</Grid>
|
|
</Grid>
|
|
|
|
<!-- Docked Pivot panel for history/memory -->
|
|
<Border x:Name="DockPanel"
|
|
x:Uid="DockPanel"
|
|
Grid.Row="1"
|
|
Grid.Column="1"
|
|
AutomationProperties.HeadingLevel="Level1"
|
|
Visibility="Collapsed">
|
|
<Border.Resources>
|
|
<!--
|
|
This is a copy/paste of the Pivot template. The only change is setting the PivotPanel's ManipulationMode=None
|
|
to disable swipe navigation between History and Memory to enable the SwipeControl
|
|
-->
|
|
<ControlTemplate x:Key="DockPanelTemplate" TargetType="Pivot">
|
|
<Grid x:Name="RootElement"
|
|
HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
|
|
VerticalAlignment="{TemplateBinding VerticalAlignment}"
|
|
Background="{TemplateBinding Background}">
|
|
<Grid.Resources>
|
|
<Style x:Key="BaseContentControlStyle" TargetType="ContentControl">
|
|
<Setter Property="FontFamily" Value="XamlAutoFontFamily"/>
|
|
<Setter Property="FontWeight" Value="SemiBold"/>
|
|
<Setter Property="FontSize" Value="15"/>
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="ContentControl">
|
|
<ContentPresenter Margin="{TemplateBinding Padding}"
|
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
|
Content="{TemplateBinding Content}"
|
|
ContentTemplate="{TemplateBinding ContentTemplate}"
|
|
ContentTransitions="{TemplateBinding ContentTransitions}"
|
|
OpticalMarginAlignment="TrimSideBearings"/>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Style>
|
|
<Style x:Key="TitleContentControlStyle"
|
|
BasedOn="{StaticResource BaseContentControlStyle}"
|
|
TargetType="ContentControl">
|
|
<Setter Property="FontFamily" Value="{ThemeResource PivotTitleFontFamily}"/>
|
|
<Setter Property="FontWeight" Value="{ThemeResource PivotTitleThemeFontWeight}"/>
|
|
<Setter Property="FontSize" Value="{ThemeResource PivotTitleFontSize}"/>
|
|
</Style>
|
|
</Grid.Resources>
|
|
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="Auto"/>
|
|
<RowDefinition Height="*"/>
|
|
</Grid.RowDefinitions>
|
|
|
|
<VisualStateManager.VisualStateGroups>
|
|
<VisualStateGroup x:Name="Orientation">
|
|
<VisualState x:Name="Portrait">
|
|
<Storyboard>
|
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="TitleContentControl" Storyboard.TargetProperty="Margin">
|
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource PivotPortraitThemePadding}"/>
|
|
</ObjectAnimationUsingKeyFrames>
|
|
</Storyboard>
|
|
</VisualState>
|
|
<VisualState x:Name="Landscape">
|
|
<Storyboard>
|
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="TitleContentControl" Storyboard.TargetProperty="Margin">
|
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource PivotLandscapeThemePadding}"/>
|
|
</ObjectAnimationUsingKeyFrames>
|
|
</Storyboard>
|
|
</VisualState>
|
|
</VisualStateGroup>
|
|
<VisualStateGroup x:Name="NavigationButtonsVisibility">
|
|
<VisualState x:Name="NavigationButtonsHidden"/>
|
|
<VisualState x:Name="NavigationButtonsVisible">
|
|
<Storyboard>
|
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="NextButton" Storyboard.TargetProperty="Opacity">
|
|
<DiscreteObjectKeyFrame KeyTime="0" Value="1"/>
|
|
</ObjectAnimationUsingKeyFrames>
|
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="NextButton" Storyboard.TargetProperty="IsEnabled">
|
|
<DiscreteObjectKeyFrame KeyTime="0" Value="True"/>
|
|
</ObjectAnimationUsingKeyFrames>
|
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PreviousButton" Storyboard.TargetProperty="Opacity">
|
|
<DiscreteObjectKeyFrame KeyTime="0" Value="1"/>
|
|
</ObjectAnimationUsingKeyFrames>
|
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PreviousButton" Storyboard.TargetProperty="IsEnabled">
|
|
<DiscreteObjectKeyFrame KeyTime="0" Value="True"/>
|
|
</ObjectAnimationUsingKeyFrames>
|
|
</Storyboard>
|
|
</VisualState>
|
|
<VisualState x:Name="PreviousButtonVisible">
|
|
<Storyboard>
|
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PreviousButton" Storyboard.TargetProperty="Opacity">
|
|
<DiscreteObjectKeyFrame KeyTime="0" Value="1"/>
|
|
</ObjectAnimationUsingKeyFrames>
|
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PreviousButton" Storyboard.TargetProperty="IsEnabled">
|
|
<DiscreteObjectKeyFrame KeyTime="0" Value="True"/>
|
|
</ObjectAnimationUsingKeyFrames>
|
|
</Storyboard>
|
|
</VisualState>
|
|
<VisualState x:Name="NextButtonVisible">
|
|
<Storyboard>
|
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="NextButton" Storyboard.TargetProperty="Opacity">
|
|
<DiscreteObjectKeyFrame KeyTime="0" Value="1"/>
|
|
</ObjectAnimationUsingKeyFrames>
|
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="NextButton" Storyboard.TargetProperty="IsEnabled">
|
|
<DiscreteObjectKeyFrame KeyTime="0" Value="True"/>
|
|
</ObjectAnimationUsingKeyFrames>
|
|
</Storyboard>
|
|
</VisualState>
|
|
</VisualStateGroup>
|
|
<VisualStateGroup x:Name="HeaderStates">
|
|
<VisualState x:Name="HeaderDynamic"/>
|
|
<VisualState x:Name="HeaderStatic">
|
|
<Storyboard>
|
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="Header" Storyboard.TargetProperty="Visibility">
|
|
<DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/>
|
|
</ObjectAnimationUsingKeyFrames>
|
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="StaticHeader" Storyboard.TargetProperty="Visibility">
|
|
<DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
|
|
</ObjectAnimationUsingKeyFrames>
|
|
</Storyboard>
|
|
</VisualState>
|
|
</VisualStateGroup>
|
|
|
|
</VisualStateManager.VisualStateGroups>
|
|
|
|
<ContentControl x:Name="TitleContentControl"
|
|
Margin="{StaticResource PivotPortraitThemePadding}"
|
|
Style="{StaticResource TitleContentControlStyle}"
|
|
Content="{TemplateBinding Title}"
|
|
ContentTemplate="{TemplateBinding TitleTemplate}"
|
|
IsTabStop="False"
|
|
Visibility="Collapsed"/>
|
|
|
|
<Grid Grid.Row="1">
|
|
<Grid.Resources>
|
|
<ControlTemplate x:Key="NextTemplate" TargetType="Button">
|
|
<Border x:Name="Root"
|
|
Background="{ThemeResource PivotNextButtonBackground}"
|
|
BorderBrush="{ThemeResource PivotNextButtonBorderBrush}"
|
|
BorderThickness="{ThemeResource PivotNavButtonBorderThemeThickness}">
|
|
<VisualStateManager.VisualStateGroups>
|
|
<VisualStateGroup x:Name="CommonStates">
|
|
<VisualState x:Name="Normal"/>
|
|
<VisualState x:Name="PointerOver">
|
|
<Storyboard>
|
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="Root" Storyboard.TargetProperty="Background">
|
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource PivotNextButtonBackgroundPointerOver}"/>
|
|
</ObjectAnimationUsingKeyFrames>
|
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="Root" Storyboard.TargetProperty="BorderBrush">
|
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource PivotNextButtonBorderBrushPointerOver}"/>
|
|
</ObjectAnimationUsingKeyFrames>
|
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="Arrow" Storyboard.TargetProperty="Foreground">
|
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource PivotNextButtonForegroundPointerOver}"/>
|
|
</ObjectAnimationUsingKeyFrames>
|
|
</Storyboard>
|
|
</VisualState>
|
|
<VisualState x:Name="Pressed">
|
|
<Storyboard>
|
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="Root" Storyboard.TargetProperty="Background">
|
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource PivotNextButtonBackgroundPressed}"/>
|
|
</ObjectAnimationUsingKeyFrames>
|
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="Root" Storyboard.TargetProperty="BorderBrush">
|
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource PivotNextButtonBorderBrushPressed}"/>
|
|
</ObjectAnimationUsingKeyFrames>
|
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="Arrow" Storyboard.TargetProperty="Foreground">
|
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource PivotNextButtonForegroundPressed}"/>
|
|
</ObjectAnimationUsingKeyFrames>
|
|
</Storyboard>
|
|
</VisualState>
|
|
</VisualStateGroup>
|
|
</VisualStateManager.VisualStateGroups>
|
|
<FontIcon x:Name="Arrow"
|
|
HorizontalAlignment="Center"
|
|
VerticalAlignment="Center"
|
|
Foreground="{ThemeResource PivotNextButtonForeground}"
|
|
FontFamily="{ThemeResource SymbolThemeFontFamily}"
|
|
FontSize="12"
|
|
Glyph=""
|
|
MirroredWhenRightToLeft="True"
|
|
UseLayoutRounding="False"/>
|
|
</Border>
|
|
</ControlTemplate>
|
|
|
|
<ControlTemplate x:Key="PreviousTemplate" TargetType="Button">
|
|
<Border x:Name="Root"
|
|
Background="{ThemeResource PivotPreviousButtonBackground}"
|
|
BorderBrush="{ThemeResource PivotPreviousButtonBorderBrush}"
|
|
BorderThickness="{ThemeResource PivotNavButtonBorderThemeThickness}">
|
|
<VisualStateManager.VisualStateGroups>
|
|
<VisualStateGroup x:Name="CommonStates">
|
|
<VisualState x:Name="Normal"/>
|
|
<VisualState x:Name="PointerOver">
|
|
<Storyboard>
|
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="Root" Storyboard.TargetProperty="Background">
|
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource PivotPreviousButtonBackgroundPointerOver}"/>
|
|
</ObjectAnimationUsingKeyFrames>
|
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="Root" Storyboard.TargetProperty="BorderBrush">
|
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource PivotPreviousButtonBorderBrushPointerOver}"/>
|
|
</ObjectAnimationUsingKeyFrames>
|
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="Arrow" Storyboard.TargetProperty="Foreground">
|
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource PivotPreviousButtonForegroundPointerOver}"/>
|
|
</ObjectAnimationUsingKeyFrames>
|
|
</Storyboard>
|
|
</VisualState>
|
|
<VisualState x:Name="Pressed">
|
|
<Storyboard>
|
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="Root" Storyboard.TargetProperty="Background">
|
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource PivotPreviousButtonBackgroundPressed}"/>
|
|
</ObjectAnimationUsingKeyFrames>
|
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="Root" Storyboard.TargetProperty="BorderBrush">
|
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource PivotPreviousButtonBorderBrushPressed}"/>
|
|
</ObjectAnimationUsingKeyFrames>
|
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="Arrow" Storyboard.TargetProperty="Foreground">
|
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource PivotPreviousButtonForegroundPressed}"/>
|
|
</ObjectAnimationUsingKeyFrames>
|
|
</Storyboard>
|
|
</VisualState>
|
|
</VisualStateGroup>
|
|
</VisualStateManager.VisualStateGroups>
|
|
<FontIcon x:Name="Arrow"
|
|
HorizontalAlignment="Center"
|
|
VerticalAlignment="Center"
|
|
Foreground="{ThemeResource PivotPreviousButtonForeground}"
|
|
FontFamily="{ThemeResource SymbolThemeFontFamily}"
|
|
FontSize="12"
|
|
Glyph=""
|
|
MirroredWhenRightToLeft="True"
|
|
UseLayoutRounding="False"/>
|
|
</Border>
|
|
</ControlTemplate>
|
|
</Grid.Resources>
|
|
|
|
<ScrollViewer x:Name="ScrollViewer"
|
|
Margin="{TemplateBinding Padding}"
|
|
VerticalContentAlignment="Stretch"
|
|
BringIntoViewOnFocusChange="False"
|
|
HorizontalScrollBarVisibility="Hidden"
|
|
HorizontalSnapPointsAlignment="Center"
|
|
HorizontalSnapPointsType="MandatorySingle"
|
|
Template="{StaticResource ScrollViewerScrollBarlessTemplate}"
|
|
VerticalScrollBarVisibility="Disabled"
|
|
VerticalScrollMode="Disabled"
|
|
VerticalSnapPointsType="None"
|
|
ZoomMode="Disabled">
|
|
<PivotPanel x:Name="Panel"
|
|
VerticalAlignment="Stretch"
|
|
ManipulationMode="None">
|
|
<Grid x:Name="PivotLayoutElement">
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="Auto"/>
|
|
<RowDefinition Height="*"/>
|
|
</Grid.RowDefinitions>
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="Auto"/>
|
|
<ColumnDefinition Width="*"/>
|
|
<ColumnDefinition Width="Auto"/>
|
|
</Grid.ColumnDefinitions>
|
|
<Grid.RenderTransform>
|
|
<CompositeTransform x:Name="PivotLayoutElementTranslateTransform"/>
|
|
</Grid.RenderTransform>
|
|
<ContentPresenter x:Name="LeftHeaderPresenter"
|
|
HorizontalAlignment="Stretch"
|
|
VerticalAlignment="Stretch"
|
|
Content="{TemplateBinding LeftHeader}"
|
|
ContentTemplate="{TemplateBinding LeftHeaderTemplate}"/>
|
|
<ContentControl x:Name="HeaderClipper"
|
|
Grid.Column="1"
|
|
HorizontalContentAlignment="Stretch"
|
|
UseSystemFocusVisuals="{StaticResource UseSystemFocusVisuals}">
|
|
<ContentControl.Clip>
|
|
<RectangleGeometry x:Name="HeaderClipperGeometry"/>
|
|
</ContentControl.Clip>
|
|
<Grid Background="{ThemeResource PivotHeaderBackground}">
|
|
<Grid.RenderTransform>
|
|
<CompositeTransform x:Name="HeaderOffsetTranslateTransform"/>
|
|
</Grid.RenderTransform>
|
|
<PivotHeaderPanel x:Name="StaticHeader" Visibility="Collapsed">
|
|
<PivotHeaderPanel.RenderTransform>
|
|
<CompositeTransform x:Name="StaticHeaderTranslateTransform"/>
|
|
</PivotHeaderPanel.RenderTransform>
|
|
</PivotHeaderPanel>
|
|
<PivotHeaderPanel x:Name="Header">
|
|
<PivotHeaderPanel.RenderTransform>
|
|
<CompositeTransform x:Name="HeaderTranslateTransform"/>
|
|
</PivotHeaderPanel.RenderTransform>
|
|
</PivotHeaderPanel>
|
|
<Rectangle x:Name="FocusFollower"
|
|
HorizontalAlignment="Stretch"
|
|
VerticalAlignment="Stretch"
|
|
Fill="Transparent"
|
|
Control.IsTemplateFocusTarget="True"
|
|
IsHitTestVisible="False"/>
|
|
</Grid>
|
|
</ContentControl>
|
|
<Button x:Name="PreviousButton"
|
|
Grid.Column="1"
|
|
Width="20"
|
|
Height="36"
|
|
Margin="{ThemeResource PivotNavButtonMargin}"
|
|
HorizontalAlignment="Left"
|
|
VerticalAlignment="Top"
|
|
Background="Transparent"
|
|
Opacity="0"
|
|
IsEnabled="False"
|
|
IsTabStop="False"
|
|
Template="{StaticResource PreviousTemplate}"
|
|
UseSystemFocusVisuals="False"/>
|
|
<Button x:Name="NextButton"
|
|
Grid.Column="1"
|
|
Width="20"
|
|
Height="36"
|
|
Margin="{ThemeResource PivotNavButtonMargin}"
|
|
HorizontalAlignment="Right"
|
|
VerticalAlignment="Top"
|
|
Background="Transparent"
|
|
Opacity="0"
|
|
IsEnabled="False"
|
|
IsTabStop="False"
|
|
Template="{StaticResource NextTemplate}"
|
|
UseSystemFocusVisuals="False"/>
|
|
<ContentPresenter x:Name="RightHeaderPresenter"
|
|
Grid.Column="2"
|
|
HorizontalAlignment="Stretch"
|
|
VerticalAlignment="Stretch"
|
|
Content="{TemplateBinding RightHeader}"
|
|
ContentTemplate="{TemplateBinding RightHeaderTemplate}"/>
|
|
<ItemsPresenter x:Name="PivotItemPresenter"
|
|
Grid.Row="1"
|
|
Grid.ColumnSpan="3">
|
|
<ItemsPresenter.RenderTransform>
|
|
<TransformGroup>
|
|
<TranslateTransform x:Name="ItemsPresenterTranslateTransform"/>
|
|
<CompositeTransform x:Name="ItemsPresenterCompositeTransform"/>
|
|
</TransformGroup>
|
|
</ItemsPresenter.RenderTransform>
|
|
</ItemsPresenter>
|
|
</Grid>
|
|
</PivotPanel>
|
|
</ScrollViewer>
|
|
</Grid>
|
|
</Grid>
|
|
</ControlTemplate>
|
|
</Border.Resources>
|
|
|
|
<Pivot x:Name="DockPivot"
|
|
SelectionChanged="DockPivot_SelectionChanged"
|
|
TabIndex="5"
|
|
Tapped="DockPanelTapped"
|
|
Template="{StaticResource DockPanelTemplate}">
|
|
<Pivot.Resources>
|
|
<Style TargetType="PivotHeaderItem">
|
|
<Setter Property="Foreground" Value="{ThemeResource SystemControlForegroundBaseHighBrush}"/>
|
|
<Setter Property="Background" Value="{ThemeResource SystemControlBackgroundTransparentBrush}"/>
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="PivotHeaderItem">
|
|
<Grid x:Name="Grid"
|
|
Padding="{TemplateBinding Padding}"
|
|
Background="{TemplateBinding Background}">
|
|
<Grid.RenderTransform>
|
|
<TranslateTransform x:Name="ContentPresenterTranslateTransform"/>
|
|
</Grid.RenderTransform>
|
|
<VisualStateManager.VisualStateGroups>
|
|
<VisualStateGroup x:Name="SelectionStates">
|
|
<VisualStateGroup.Transitions>
|
|
<VisualTransition From="Unselected"
|
|
GeneratedDuration="0:0:0.33"
|
|
To="UnselectedLocked"/>
|
|
<VisualTransition From="UnselectedLocked"
|
|
GeneratedDuration="0:0:0.33"
|
|
To="Unselected"/>
|
|
</VisualStateGroup.Transitions>
|
|
<VisualState x:Name="Disabled">
|
|
<VisualState.Setters>
|
|
<Setter Target="SelectedPipe.Visibility" Value="Collapsed"/>
|
|
<Setter Target="ContentPresenter.Foreground" Value="{ThemeResource PivotHeaderItemForegroundDisabled}"/>
|
|
<Setter Target="Grid.Background" Value="{ThemeResource PivotHeaderItemBackgroundDisabled}"/>
|
|
</VisualState.Setters>
|
|
</VisualState>
|
|
<VisualState x:Name="Unselected"/>
|
|
<VisualState x:Name="UnselectedLocked">
|
|
<VisualState.Setters>
|
|
<Setter Target="SelectedPipe.Visibility" Value="Collapsed"/>
|
|
<Setter Target="ContentPresenter.(UIElement.Opacity)" Value="0"/>
|
|
</VisualState.Setters>
|
|
<Storyboard>
|
|
<DoubleAnimation Duration="0"
|
|
Storyboard.TargetName="ContentPresenterTranslateTransform"
|
|
Storyboard.TargetProperty="X"
|
|
To="{ThemeResource PivotHeaderItemLockedTranslation}"/>
|
|
</Storyboard>
|
|
</VisualState>
|
|
<VisualState x:Name="Selected">
|
|
<!--
|
|
TODO: MSFT 13767760: Need to use storyboards here because
|
|
visualstate setters are bugged
|
|
-->
|
|
<Storyboard>
|
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="SelectedPipe" Storyboard.TargetProperty="Visibility">
|
|
<DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
|
|
</ObjectAnimationUsingKeyFrames>
|
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Foreground">
|
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource PivotHeaderItemForegroundSelected}"/>
|
|
</ObjectAnimationUsingKeyFrames>
|
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="Grid" Storyboard.TargetProperty="Background">
|
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource PivotHeaderItemBackgroundSelected}"/>
|
|
</ObjectAnimationUsingKeyFrames>
|
|
</Storyboard>
|
|
</VisualState>
|
|
<VisualState x:Name="UnselectedPointerOver">
|
|
<VisualState.Setters>
|
|
<Setter Target="SelectedPipe.Visibility" Value="Collapsed"/>
|
|
<Setter Target="ContentPresenter.Foreground" Value="{ThemeResource PivotHeaderItemForegroundUnselectedPointerOver}"/>
|
|
<Setter Target="Grid.Background" Value="{ThemeResource PivotHeaderItemBackgroundUnselectedPointerOver}"/>
|
|
</VisualState.Setters>
|
|
</VisualState>
|
|
<VisualState x:Name="SelectedPointerOver">
|
|
<VisualState.Setters>
|
|
<Setter Target="SelectedPipe.Visibility" Value="Visible"/>
|
|
<Setter Target="ContentPresenter.Foreground" Value="{ThemeResource PivotHeaderItemForegroundSelectedPointerOver}"/>
|
|
<Setter Target="Grid.Background" Value="{ThemeResource PivotHeaderItemBackgroundSelectedPointerOver}"/>
|
|
</VisualState.Setters>
|
|
</VisualState>
|
|
<VisualState x:Name="UnselectedPressed">
|
|
<VisualState.Setters>
|
|
<Setter Target="SelectedPipe.Visibility" Value="Collapsed"/>
|
|
<Setter Target="ContentPresenter.Foreground" Value="{ThemeResource PivotHeaderItemForegroundUnselectedPressed}"/>
|
|
<Setter Target="Grid.Background" Value="{ThemeResource PivotHeaderItemBackgroundUnselectedPressed}"/>
|
|
</VisualState.Setters>
|
|
</VisualState>
|
|
<VisualState x:Name="SelectedPressed">
|
|
<VisualState.Setters>
|
|
<Setter Target="SelectedPipe.Visibility" Value="Visible"/>
|
|
<Setter Target="ContentPresenter.Foreground" Value="{ThemeResource PivotHeaderItemForegroundSelectedPressed}"/>
|
|
<Setter Target="Grid.Background" Value="{ThemeResource PivotHeaderItemBackgroundSelectedPressed}"/>
|
|
</VisualState.Setters>
|
|
</VisualState>
|
|
</VisualStateGroup>
|
|
<VisualStateGroup x:Name="FocusStates">
|
|
<VisualState x:Name="Focused">
|
|
<VisualState.Setters>
|
|
<Setter Target="FocusPipe.Visibility" Value="Visible"/>
|
|
</VisualState.Setters>
|
|
</VisualState>
|
|
<VisualState x:Name="Unfocused"/>
|
|
</VisualStateGroup>
|
|
</VisualStateManager.VisualStateGroups>
|
|
<Rectangle x:Name="FocusPipe"
|
|
Stroke="{ThemeResource SystemControlFocusVisualPrimaryBrush}"
|
|
StrokeThickness="2"
|
|
Visibility="Collapsed"/>
|
|
<Grid Margin="4,0,4,0">
|
|
<ContentPresenter x:Name="ContentPresenter"
|
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
|
FontFamily="{TemplateBinding FontFamily}"
|
|
FontSize="{TemplateBinding FontSize}"
|
|
FontWeight="{TemplateBinding FontWeight}"
|
|
Content="{TemplateBinding Content}"
|
|
ContentTemplate="{TemplateBinding ContentTemplate}"
|
|
OpticalMarginAlignment="TrimSideBearings"/>
|
|
<Rectangle x:Name="SelectedPipe"
|
|
Height="3"
|
|
Margin="0,0,0,6"
|
|
HorizontalAlignment="Stretch"
|
|
VerticalAlignment="Bottom"
|
|
Fill="{ThemeResource AppControlTransparentAccentColorBrush}"
|
|
Visibility="Collapsed"/>
|
|
</Grid>
|
|
</Grid>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Style>
|
|
</Pivot.Resources>
|
|
<PivotItem x:Name="HistoryPivotItem"
|
|
x:Uid="HistoryPivotItem"
|
|
Margin="0,10,0,0"
|
|
AutomationProperties.AutomationId="HistoryLabel">
|
|
<PivotItem.Header>
|
|
<TextBlock x:Uid="HistoryLabel" AccessKeyInvoked="OnHistoryAccessKeyInvoked"/>
|
|
</PivotItem.Header>
|
|
<Border x:Name="DockHistoryHolder"/>
|
|
</PivotItem>
|
|
<PivotItem x:Name="MemoryPivotItem"
|
|
x:Uid="MemoryPivotItem"
|
|
Margin="0,10,0,0"
|
|
AutomationProperties.AutomationId="MemoryLabel">
|
|
<PivotItem.Header>
|
|
<TextBlock x:Uid="MemoryLabel" AccessKeyInvoked="OnMemoryAccessKeyInvoked"/>
|
|
</PivotItem.Header>
|
|
<Border x:Name="DockMemoryHolder"/>
|
|
</PivotItem>
|
|
</Pivot>
|
|
</Border>
|
|
</Grid>
|
|
</UserControl>
|