Browse Source

Add custom title and icons for nav menu

pull/5/head
Ionite 2 years ago
parent
commit
a1fcd71d16
No known key found for this signature in database
  1. 54
      StabilityMatrix/MainWindow.xaml
  2. 12
      StabilityMatrix/MainWindow.xaml.cs

54
StabilityMatrix/MainWindow.xaml

@ -7,17 +7,49 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"> mc:Ignorable="d">
<NavigationView <Grid>
x:Name="MainNavigationView" <Grid.RowDefinitions>
Loaded="MainNavigationView_OnLoaded" <RowDefinition Height="32"/>
SelectionChanged="MainNavigationView_OnSelectionChanged" <RowDefinition/>
Header="Stability Matrix"> </Grid.RowDefinitions>
<Grid x:Name="AppTitleBar">
<Image Source="Assets\LockScreenLogo.scale-200.png"
HorizontalAlignment="Left"
Width="16" Height="16"
Margin="8,0"/>
<TextBlock x:Name="AppTitleTextBlock"
Text="{StaticResource AppTitle}"
TextWrapping="NoWrap"
Style="{StaticResource CaptionTextBlockStyle}"
VerticalAlignment="Center"
Margin="28,0,0,0"/>
</Grid>
<NavigationView
Grid.Row="1"
x:Name="MainNavigationView"
Loaded="MainNavigationView_OnLoaded"
SelectionChanged="MainNavigationView_OnSelectionChanged"
Header="Stability Matrix">
<NavigationView.MenuItems> <NavigationView.MenuItems>
<NavigationViewItem Content="Launch" Tag="LaunchPage" /> <NavigationViewItem Content="Launch" Tag="LaunchPage">
<NavigationViewItem Content="Install" Tag="InstallPage" /> <NavigationViewItem.Icon>
</NavigationView.MenuItems> <SymbolIcon Symbol="Play" />
</NavigationViewItem.Icon>
</NavigationViewItem>
<Frame x:Name="ContentFrame"/> <NavigationViewItem Content="Install" Tag="InstallPage">
</NavigationView> <NavigationViewItem.Icon>
<SymbolIcon Symbol="Repair" />
</NavigationViewItem.Icon>
</NavigationViewItem>
</NavigationView.MenuItems>
<Frame x:Name="ContentFrame"/>
</NavigationView>
</Grid>
</Window> </Window>

12
StabilityMatrix/MainWindow.xaml.cs

@ -2,6 +2,11 @@ using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Controls;
using System; using System;
using System.Linq; using System.Linq;
using Windows.ApplicationModel.Core;
using Windows.UI.ViewManagement;
using Microsoft.UI;
using Microsoft.UI.Windowing;
using WinRT.Interop;
namespace StabilityMatrix namespace StabilityMatrix
{ {
@ -12,10 +17,11 @@ namespace StabilityMatrix
{ {
public MainWindow() public MainWindow()
{ {
this.InitializeComponent(); InitializeComponent();
Title = "Stability Matrix";
WindowOptions.TrySetCustomTitle(this, AppTitleBar);
} }
private void ButtonNavInstallPage_OnClick(object sender, RoutedEventArgs e) private void ButtonNavInstallPage_OnClick(object sender, RoutedEventArgs e)
{ {
ContentFrame.Navigate(typeof(InstallPage)); ContentFrame.Navigate(typeof(InstallPage));

Loading…
Cancel
Save