forked from microsoft/calculator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainPage.xaml
189 lines (181 loc) · 10.2 KB
/
MainPage.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
<Page x:Class="CalculatorApp.MainPage"
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:muxc="using:Microsoft.UI.Xaml.Controls"
xmlns:vm="using:CalculatorApp.ViewModel"
x:Name="PageRoot"
Background="{ThemeResource AppChromeAcrylicHostBackdropMediumLowBrush}"
Loaded="OnPageLoaded"
mc:Ignorable="d">
<Page.Resources>
<automation:NarratorNotifier x:Name="NarratorNotifier"/>
<Style x:Name="CalculatorBaseStyle" TargetType="local:Calculator">
<Setter Property="Margin" Value="0,0,0,0"/>
</Style>
<Style x:Name="UnitConverterBaseStyle" TargetType="local:UnitConverter">
<Setter Property="Visibility" Value="Collapsed"/>
<Setter Property="IsEnabled" Value="False"/>
<Setter Property="Margin" Value="0,0,0,0"/>
</Style>
<Style x:Key="AboutFlyoutPresenterStyle" TargetType="FlyoutPresenter">
<Setter Property="IsTabStop" Value="False"/>
<Setter Property="AutomationProperties.AccessibilityView" Value="Raw"/>
</Style>
<Style x:Key="NavViewItemStyle" TargetType="muxc:NavigationViewItem">
<Setter Property="KeyTipPlacementMode" Value="Right"/>
</Style>
<converters:BooleanToVisibilityNegationConverter x:Key="BooleanToVisibilityNegationConverter"/>
<converters:BooleanNegationConverter x:Key="BooleanNegationConverter"/>
</Page.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="Mode">
<VisualState x:Name="ConverterWide">
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowHeight="{StaticResource AppMinWindowHeight}" MinWindowWidth="640"/>
</VisualState.StateTriggers>
</VisualState>
<VisualState x:Name="DockVisible">
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowHeight="{StaticResource AppMinWindowHeight}" MinWindowWidth="560"/>
</VisualState.StateTriggers>
</VisualState>
<VisualState x:Name="MinSizeLayout">
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowHeight="{StaticResource AppMinWindowHeight}" MinWindowWidth="{StaticResource AppMinWindowWidth}"/>
</VisualState.StateTriggers>
</VisualState>
<VisualState x:Name="DefaultLayout">
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowHeight="0" MinWindowWidth="0"/>
</VisualState.StateTriggers>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<StackPanel Visibility="Collapsed">
<!--
These buttons are only here to serve as the target for copy/paste commands
they are not to be shown, only to have the command and shortcut assigned to them.
-->
<Button x:Name="CopyButton"
x:Uid="copyButton"
Command="{x:Bind Model.CopyCommand}"/>
<Button x:Name="PasteButton"
x:Uid="pasteButton"
Command="{x:Bind Model.PasteCommand}"/>
<Button x:Name="CopyButtonAlternate"
x:Uid="copyButtonAlternate"
Command="{x:Bind Model.CopyCommand}"/>
<Button x:Name="PasteButtonAlternate"
x:Uid="pasteButtonAlternate"
Command="{x:Bind Model.PasteCommand}"/>
</StackPanel>
<local:TitleBar Grid.Row="0" IsAlwaysOnTopMode="{x:Bind Model.IsAlwaysOnTop, Mode=OneWay}"
AlwaysOnTopClick="TitleBarAlwaysOnTopButtonClick"/>
<Grid Grid.Row="1">
<Border x:Name="CalcHolder">
<!-- PLACEHOLDER!!!! This is where the calculator goes when it is delay loaded -->
</Border>
<Border x:Name="DateCalcHolder">
<!-- PLACEHOLDER!!!! This is where the date calculator goes when it is delay loaded -->
</Border>
<Border x:Name="ConverterHolder">
<!-- PLACEHOLDER!!!! This is where the converter goes when it is delay loaded -->
</Border>
</Grid>
<muxc:NavigationView x:Name="NavView"
x:Uid="NavView"
Grid.Row="1"
CompactModeThresholdWidth="Infinity"
DataContext="{x:Bind Model}"
ExpandedModeThresholdWidth="Infinity"
IsBackButtonVisible="Collapsed"
IsEnabled="{x:Bind Model.IsAlwaysOnTop, Converter={StaticResource BooleanNegationConverter}, Mode=OneWay}"
IsPaneToggleButtonVisible="{x:Bind Model.IsAlwaysOnTop, Converter={StaticResource BooleanNegationConverter}, Mode=OneWay}"
IsSettingsVisible="False"
ItemInvoked="OnNavItemInvoked"
Loaded="OnNavLoaded"
MenuItemsSource="{x:Bind CreateUIElementsForCategories(Model.Categories), Mode=OneWay}"
OpenPaneLength="{StaticResource SplitViewOpenPaneLength}"
PaneClosed="OnNavPaneClosed"
PaneOpened="OnNavPaneOpened"
PaneOpening="OnNavPaneOpening"
SelectionChanged="OnNavSelectionChanged"
TabIndex="1"
UseSystemFocusVisuals="True">
<muxc:NavigationView.PaneFooter>
<StackPanel HorizontalAlignment="Stretch" Orientation="Vertical">
<muxc:NavigationViewList x:Name="NavFooter"
Width="{x:Bind NavView.OpenPaneLength, Mode=Oneway}"
x:Load="False"
IsItemClickEnabled="True"
ItemClick="OnAboutButtonClick">
<muxc:NavigationViewList.ItemContainerTransitions>
<!-- Remove EntranceThemeTransition which is a default transition for NavigationViewList -->
<TransitionCollection/>
</muxc:NavigationViewList.ItemContainerTransitions>
<muxc:NavigationViewList.Items>
<muxc:NavigationViewItem x:Name="AboutButton"
x:Uid="AboutButton"
Style="{StaticResource NavViewItemStyle}">
<muxc:NavigationViewItem.Icon>
<FontIcon FontFamily="{StaticResource CalculatorFontFamily}" Glyph=""/>
</muxc:NavigationViewItem.Icon>
<FlyoutBase.AttachedFlyout>
<Flyout x:Name="AboutPageFlyout"
x:Uid="AboutPageFlyout"
Closed="OnAboutFlyoutClosed"
FlyoutPresenterStyle="{StaticResource AboutFlyoutPresenterStyle}"
Opened="OnAboutFlyoutOpened">
<local:AboutFlyout x:Name="AboutPage" x:Load="False"/>
</Flyout>
</FlyoutBase.AttachedFlyout>
</muxc:NavigationViewItem>
</muxc:NavigationViewList.Items>
</muxc:NavigationViewList>
</StackPanel>
</muxc:NavigationView.PaneFooter>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock x:Name="Header"
Grid.Column="0"
Margin="52,6,12,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Style="{StaticResource SubtitleTextBlockStyle}"
Text="{x:Bind Model.CategoryName, Mode=OneWay}"
Visibility="{x:Bind Model.IsAlwaysOnTop, Converter={StaticResource BooleanToVisibilityNegationConverter}, Mode=OneWay}"/>
<Button x:Name="NormalAlwaysOnTopButton"
x:Uid="EnterAlwaysOnTopButton"
Grid.Column="1"
VerticalAlignment="Top"
HorizontalContentAlignment="Center"
Style="{StaticResource SquareIconButtonStyle}"
Background="Transparent"
FontFamily="{StaticResource CalculatorFontFamily}"
AutomationProperties.AutomationId="NormalAlwaysOnTopButton"
Click="AlwaysOnTopButtonClick"
Content=""
Visibility="{x:Bind Model.DisplayNormalAlwaysOnTopOption, Mode=OneWay}">
<Button.KeyboardAccelerators>
<KeyboardAccelerator Modifiers="Menu" Key="Up"/>
</Button.KeyboardAccelerators>
</Button>
</Grid>
</muxc:NavigationView>
</Grid>
</Page>