-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAppShell.xaml
More file actions
157 lines (149 loc) · 8.45 KB
/
Copy pathAppShell.xaml
File metadata and controls
157 lines (149 loc) · 8.45 KB
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
<Page x:Name="Root"
x:Class="TogglTimer.AppShell"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:controls="using:TogglTimer.Controls"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
KeyDown="AppShell_KeyDown"
TabNavigation="Cycle"
mc:Ignorable="d">
<!-- Using a Page as the root for the app provides a design time experience as well as ensures that
when it runs on Mobile the app content won't appear under the system's StatusBar which is visible
by default with a transparent background. It will also take into account the presence of software
navigation buttons if they appear on a device. An app can opt-out by switching to UseCoreWindow.
-->
<Page.Resources>
<DataTemplate x:Key="NavMenuItemTemplate" x:DataType="controls:NavMenuItem">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="48" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<!-- Showing a ToolTip and the Label is redundant. We put the ToolTip on the icon.
It appears when the user hovers over the icon, but not the label which provides
value when the SplitView is 'Compact' while reducing the likelihood of showing
redundant information when the label is shown.-->
<FontIcon x:Name="Glyph" FontSize="16" Glyph="{x:Bind SymbolAsChar}" VerticalAlignment="Center"
HorizontalAlignment="Center" ToolTipService.ToolTip="{x:Bind Label}" />
<TextBlock x:Name="Text" Grid.Column="1" Text="{x:Bind Label}"
Style="{StaticResource BodyTextBlockStyle}" TextWrapping="NoWrap" />
</Grid>
</DataTemplate>
</Page.Resources>
<Grid x:Name="LayoutRoot">
<!-- Adaptive triggers -->
<VisualStateManager.VisualStateGroups>
<VisualStateGroup>
<VisualState>
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="{StaticResource LargeWindowSnapPoint}" />
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="RootSplitView.DisplayMode" Value="CompactInline" />
<Setter Target="RootSplitView.IsPaneOpen" Value="True" />
<Setter Target="NavPaneDivider.Visibility" Value="Visible" />
</VisualState.Setters>
</VisualState>
<VisualState>
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="{StaticResource MediumWindowSnapPoint}" />
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="RootSplitView.DisplayMode" Value="CompactOverlay" />
<Setter Target="RootSplitView.IsPaneOpen" Value="False" />
<Setter Target="NavPaneDivider.Visibility" Value="Collapsed" />
</VisualState.Setters>
</VisualState>
<VisualState>
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="{StaticResource MinWindowSnapPoint}" />
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="RootSplitView.DisplayMode" Value="Overlay" />
<Setter Target="RootSplitView.IsPaneOpen" Value="False" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<!-- Top-level navigation menu + app content -->
<SplitView x:Name="RootSplitView"
DisplayMode="Inline"
OpenPaneLength="320"
PaneClosed="RootSplitView_PaneClosed"
IsTabStop="False">
<SplitView.Pane>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="6" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="48" />
<ColumnDefinition Width="48" />
</Grid.ColumnDefinitions>
<!-- A custom ListView to display the items in the pane. The automation Name is set in the ContainerContentChanging event. -->
<controls:NavMenuListView x:Name="NavMenuList"
Grid.ColumnSpan="3"
TabIndex="3"
Margin="0,52,0,0"
ContainerContentChanging="NavMenuItemContainerContentChanging"
ItemContainerStyle="{StaticResource NavMenuItemContainerStyle}"
ItemTemplate="{StaticResource NavMenuItemTemplate}"
ItemInvoked="NavMenuList_ItemInvoked" />
<Rectangle x:Name="NavPaneDivider"
Grid.Row="1"
Grid.ColumnSpan="3"
Height="1"
Fill="{ThemeResource SystemControlForegroundBaseLowBrush}"
Margin="16,0,16,6" />
<Button x:Name="FeedbackNavPaneButton"
Grid.Row="2"
Grid.Column="1"
Style="{StaticResource SplitViewPaneButtonStyle}"
Content=""
AutomationProperties.Name="Feedback"
ToolTipService.ToolTip="Feedback" />
<Button x:Name="SettingsNavPaneButton"
Grid.Row="2"
Grid.Column="2"
Style="{StaticResource SplitViewPaneButtonStyle}"
Content=""
Click="SettingsNavPaneButton_OnClick"
AutomationProperties.Name="Settings"
ToolTipService.ToolTip="Settings" />
</Grid>
</SplitView.Pane>
<!-- OnNavigatingToPage we synchronize the selected item in the nav menu with the current page.
OnNavigatedToPage we move keyboard focus to the first item on the page after it's loaded and update the Back button. -->
<Frame x:Name="frame"
Margin="0,4,0,0"
Navigating="OnNavigatingToPage"
Navigated="OnNavigatedToPage">
<Frame.ContentTransitions>
<TransitionCollection>
<NavigationThemeTransition>
<NavigationThemeTransition.DefaultNavigationTransitionInfo>
<EntranceNavigationTransitionInfo />
</NavigationThemeTransition.DefaultNavigationTransitionInfo>
</NavigationThemeTransition>
</TransitionCollection>
</Frame.ContentTransitions>
</Frame>
</SplitView>
<!-- Declared last to have it rendered above everything else, but it needs to be the first item in the tab sequence. -->
<ToggleButton x:Name="TogglePaneButton"
TabIndex="1"
Margin="0,4,0,0"
Style="{StaticResource SplitViewTogglePaneButtonStyle}"
IsChecked="{Binding IsPaneOpen, ElementName=RootSplitView, Mode=TwoWay}"
Unchecked="TogglePaneButton_Unchecked"
Checked="TogglePaneButton_Checked"
AutomationProperties.Name="Menu"
ToolTipService.ToolTip="Menu" />
</Grid>
</Page>