Skip to content

Commit 89a7a75

Browse files
committed
gui: NavigationView
1 parent e67be0a commit 89a7a75

File tree

3 files changed

+121
-86
lines changed

3 files changed

+121
-86
lines changed

src/electrifier/Views/FileManagerPage.xaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@
5757
<MenuFlyoutItem Text="Zoom Out"
5858
IsEnabled="False" />
5959
</MenuBarItem>
60+
<MenuBarItem Title="Help">
61+
<MenuFlyoutItem Text="About"
62+
IsEnabled="False" />
63+
</MenuBarItem>
6064
</MenuBar>
6165
<Grid x:Name="ContentAreaGrid"
6266
x:Uid="ContentAreaGrid"

src/electrifier/Views/ShellPage.xaml

Lines changed: 95 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@
1414
See the License for the specific language governing permissions and
1515
limitations under the License.
1616
-->
17+
1718
<!-- TODO: Insert MenuItemsSource -->
1819
<!-- TODO: IsPaneToggleButtonVisible = True -> PaneToggle-Style and overlap -->
1920
<!-- TODO: <NavigationMode />-->
21+
2022
<Page x:Class="electrifier.Views.ShellPage"
2123
xmlns:behaviors="using:electrifier.Behaviors"
2224
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
@@ -28,7 +30,6 @@
2830
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
2931
Loaded="OnLoaded">
3032
<Grid>
31-
<!-- #region MainWindow -> AppTitleBar -->
3233
<Grid x:Name="AppTitleBar"
3334
Height="{Binding ElementName=NavigationViewControl, Path=CompactPaneLength}"
3435
HorizontalAlignment="Stretch"
@@ -59,18 +60,16 @@
5960
</StackPanel>
6061
</StackPanel>
6162
</Grid>
62-
<!-- #endregion MainWindow -> AppTitleBar -->
63-
64-
<!--#region NavigationViewControl-->
6563
<NavigationView x:Name="NavigationViewControl"
6664
AlwaysShowHeader="True"
6765
CompactPaneLength="72"
66+
DisplayModeChanged="NavigationViewControl_DisplayModeChanged"
6867
IsBackButtonVisible="Visible"
69-
IsBackEnabled="True"
68+
IsBackEnabled="False"
7069
IsPaneOpen="True"
7170
IsPaneToggleButtonVisible="True"
7271
IsSettingsVisible="True"
73-
DisplayModeChanged="NavigationViewControl_DisplayModeChanged">
72+
IsTitleBarAutoPaddingEnabled="True">
7473
<!--<NavigationView.IsTitleBarAutoPaddingEnabled />-->
7574
<!--
7675
TODO: Update item titles by updating <x:Uid>.Content entries in Strings/en-us/Resources.resw.
@@ -96,68 +95,84 @@
9695
<FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}"
9796
Glyph="&#xe8d1;" />
9897
</NavigationViewItem.Icon>
98+
<NavigationViewItem.MenuItems>
99+
<NavigationViewItem Content="Home"
100+
Icon="Home"
101+
ToolTipService.ToolTip="Go to Editor Home"
102+
Tag="Editor Home" />
103+
<NavigationViewItemSeparator />
104+
<NavigationViewItem x:Uid="NavigationView_Footer_BucketList"
105+
helpers:NavigationHelper.NavigateTo="electrifier.ViewModels.WebViewViewModel"
106+
IsEnabled="False">
107+
Bucket List
108+
<NavigationViewItem.Icon>
109+
<!-- Glyph="&" -->
110+
<FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}"
111+
Glyph="&#xeb41;" />
112+
</NavigationViewItem.Icon>
113+
</NavigationViewItem>
114+
</NavigationViewItem.MenuItems>
99115
</NavigationViewItem>
100-
101116
<NavigationViewItemSeparator />
102-
103-
<NavigationViewItem x:Uid="NavigationView_FileManager"
104-
Visibility="Collapsed"
105-
helpers:NavigationHelper.NavigateTo="electrifier.ViewModels.FileManagerViewModel">
106-
File Manager
117+
<NavigationViewItem x:Uid="NavigationView_Editors">
118+
Editors
107119
<NavigationViewItem.Icon>
108-
<!-- Glyph "&#xec50" => "FileExplorer" -->
109-
<FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}"
110-
Glyph="&#xec50;" />
111-
</NavigationViewItem.Icon>
112-
<!-- TODO: Create SubItems -->
113-
<!--<NavigationViewItem.MenuItems>
114-
<NavigationViewItem Content="Create new"
115-
Icon="NewFolder"
116-
ToolTipService.ToolTip="Create new"
117-
Tag="SamplePage5" />
118-
<NavigationViewItem Content="Upload file"
119-
Icon="OpenLocal"
120-
ToolTipService.ToolTip="Upload file"
121-
Tag="SamplePage6" />
122-
</NavigationViewItem.MenuItems>-->
123-
</NavigationViewItem>
124-
<NavigationViewItem x:Uid="NavigationView_WebView"
125-
Visibility="Collapsed"
126-
helpers:NavigationHelper.NavigateTo="electrifier.ViewModels.WebViewViewModel">
127-
Web Browser
128-
<NavigationViewItem.Icon>
129-
<!-- Glyph "&#xeb41" => Website -->
120+
<!-- Glyph="&" -->
130121
<FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}"
131-
Glyph="&#xeb41;" />
122+
Glyph="&#xe713;" />
132123
</NavigationViewItem.Icon>
124+
<NavigationViewItem.MenuItems>
125+
<NavigationViewItem Content="Home"
126+
Icon="Home"
127+
ToolTipService.ToolTip="Go to Editor Home"
128+
Tag="Editor Home" />
129+
<NavigationViewItemSeparator />
130+
<NavigationViewItem x:Uid="NavigationView_Footer_ClipboardEditor"
131+
helpers:NavigationHelper.NavigateTo="electrifier.ViewModels.WebViewViewModel"
132+
IsEnabled="False">
133+
Clipboard History
134+
<NavigationViewItem.Icon>
135+
<!-- Glyph="&" -->
136+
<FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}"
137+
Glyph="&#xeb41;" />
138+
</NavigationViewItem.Icon>
139+
</NavigationViewItem>
140+
<NavigationViewItem x:Uid="NavigationView_Footer_ResourcesEditor"
141+
helpers:NavigationHelper.NavigateTo="electrifier.ViewModels.WebViewViewModel"
142+
IsEnabled="False">
143+
Resources
144+
<NavigationViewItem.Icon>
145+
<!-- Glyph="&" -->
146+
<FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}"
147+
Glyph="&#xeb41;" />
148+
</NavigationViewItem.Icon>
149+
</NavigationViewItem>
150+
<NavigationViewItem x:Uid="NavigationView_Footer_TextEditor"
151+
helpers:NavigationHelper.NavigateTo="electrifier.ViewModels.WebViewViewModel"
152+
IsEnabled="False">
153+
Text
154+
<NavigationViewItem.Icon>
155+
<!-- Glyph="&" -->
156+
<FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}"
157+
Glyph="&#xeb41;" />
158+
159+
</NavigationViewItem.Icon>
160+
<!--<MenuFlyout>
161+
162+
</MenuFlyout>
163+
<MenuFlyoutSubItem>
164+
165+
</MenuFlyoutSubItem>-->
166+
167+
</NavigationViewItem>
168+
</NavigationViewItem.MenuItems>
133169
</NavigationViewItem>
134170
</NavigationView.MenuItems>
135-
<!-- #region FooterMenuItems -->
136171
<NavigationView.FooterMenuItems>
137-
<NavigationViewItem x:Uid="NavigationView_Footer_TextEditor"
138-
helpers:NavigationHelper.NavigateTo="electrifier.ViewModels.WebViewViewModel"
139-
IsEnabled="False">
140-
Text Editor
141-
<NavigationViewItem.Icon>
142-
<!-- Glyph="&" -->
143-
<FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}"
144-
Glyph="&#xeb41;" />
145-
</NavigationViewItem.Icon>
146-
</NavigationViewItem>
147-
<NavigationViewItem x:Uid="NavigationView_Footer_ResourceExtractor"
148-
helpers:NavigationHelper.NavigateTo="electrifier.ViewModels.WebViewViewModel"
149-
IsEnabled="False">
150-
Calculator
151-
<NavigationViewItem.Icon>
152-
<!-- Glyph="&" -->
153-
<FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}"
154-
Glyph="&#xeb41;" />
155-
</NavigationViewItem.Icon>
156-
</NavigationViewItem>
157172
<NavigationViewItem x:Uid="NavigationView_Footer_ContactList"
158173
helpers:NavigationHelper.NavigateTo="electrifier.ViewModels.WebViewViewModel"
159174
IsEnabled="False">
160-
Contact List
175+
Contacts
161176
<NavigationViewItem.Icon>
162177
<!-- Glyph="&" -->
163178
<FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}"
@@ -174,16 +189,6 @@
174189
Glyph="&#xeb41;" />
175190
</NavigationViewItem.Icon>
176191
</NavigationViewItem>
177-
<NavigationViewItem x:Uid="NavigationView_Footer_BucketList"
178-
helpers:NavigationHelper.NavigateTo="electrifier.ViewModels.WebViewViewModel"
179-
IsEnabled="False">
180-
Bucket List
181-
<NavigationViewItem.Icon>
182-
<!-- Glyph="&" -->
183-
<FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}"
184-
Glyph="&#xeb41;" />
185-
</NavigationViewItem.Icon>
186-
</NavigationViewItem>
187192
<NavigationViewItem x:Uid="NavigationView_Footer_Favorites"
188193
helpers:NavigationHelper.NavigateTo="electrifier.ViewModels.WebViewViewModel"
189194
IsEnabled="False">
@@ -212,23 +217,37 @@
212217
Glyph="&#xec50;" />
213218
</NavigationViewItem.Icon>
214219
<NavigationViewItem.MenuItems>
215-
<NavigationViewItem Content="Desktop"
216-
Icon="Folder"
220+
<NavigationViewItem Content="Home"
221+
Icon="Home"
217222
ToolTipService.ToolTip="Go to Desktop folder"
218223
Tag="FileExplorer Desktop Folder" />
219-
<NavigationViewItemSeparator />
220-
<NavigationViewItem Content="My Pictures"
221-
Icon="Pictures"
222-
ToolTipService.ToolTip="Pictures"
223-
Tag="FileExplorer Pictures Folder" />
224-
<NavigationViewItem Content="My Documents"
224+
<NavigationViewItem Content="Documents"
225225
Icon="Document"
226226
ToolTipService.ToolTip="Documents"
227227
Tag="FileExplorer Documents Folder" />
228+
<NavigationViewItem Content="Downloads"
229+
Icon="Download"
230+
ToolTipService.ToolTip="Downloads"
231+
Tag="FileExplorer Downloads Folder" />
232+
<NavigationViewItem Content="Music"
233+
Icon="MusicInfo"
234+
ToolTipService.ToolTip="Music"
235+
Tag="FileExplorer Music Folder" />
236+
<NavigationViewItem Content="Pictures"
237+
Icon="Pictures"
238+
ToolTipService.ToolTip="Pictures"
239+
Tag="FileExplorer Pictures Folder" />
240+
<NavigationViewItem Content="Videos"
241+
Icon="Video"
242+
ToolTipService.ToolTip="Videos"
243+
Tag="FileExplorer Videos Folder" />
228244
<NavigationViewItemSeparator />
245+
<NavigationViewItem Content="Settings"
246+
Icon="Setting"
247+
ToolTipService.ToolTip="Settings"
248+
Tag="FileExplorer Settings" />
229249
</NavigationViewItem.MenuItems>
230250
</NavigationViewItem>
231-
<NavigationViewItemSeparator />
232251
<NavigationViewItem x:Uid="NavigationView_Footer_Workbench"
233252
helpers:NavigationHelper.NavigateTo="electrifier.ViewModels.WorkbenchViewModel">
234253
Workbench
@@ -239,7 +258,6 @@
239258
</NavigationViewItem.Icon>
240259
</NavigationViewItem>
241260
</NavigationView.FooterMenuItems>
242-
<!-- #endregion FooterMenuItems -->
243261
<NavigationView.HeaderTemplate>
244262
<DataTemplate>
245263
<Grid>
@@ -265,6 +283,5 @@
265283
<Frame x:Name="NavigationFrame" />
266284
</Grid>
267285
</NavigationView>
268-
<!--#endregion NavigationViewControl-->
269286
</Grid>
270287
</Page>

src/electrifier/Views/ShellPage.xaml.cs

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,27 @@
1-
using electrifier.Contracts.Services;
2-
using electrifier.Helpers;
3-
using electrifier.ViewModels;
1+
/*
2+
Copyright 2024 Thorsten Jung, aka tajbender
3+
https://www.electrifier.org
44
5-
using Microsoft.UI.Xaml;
6-
using Microsoft.UI.Xaml.Controls;
7-
using Microsoft.UI.Xaml.Input;
8-
using Microsoft.UI.Xaml.Media;
5+
Licensed under the Apache License, Version 2.0 (the "License");
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
16+
*/
917

1018
using Windows.System;
19+
using Microsoft.UI.Xaml;
20+
using Microsoft.UI.Xaml.Input;
21+
using Microsoft.UI.Xaml.Controls;
22+
using electrifier.ViewModels;
23+
using electrifier.Helpers;
24+
using electrifier.Contracts.Services;
1125

1226
namespace electrifier.Views;
1327

@@ -52,7 +66,7 @@ private void OnLoaded(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
5266
private void MainWindow_Activated(object sender, WindowActivatedEventArgs args)
5367
{
5468
//App.AppTitleBar = AppTitleBarTextBlock;
55-
}
69+
}
5670

5771
private void NavigationViewControl_DisplayModeChanged(NavigationView sender, NavigationViewDisplayModeChangedEventArgs args)
5872
{

0 commit comments

Comments
 (0)