[Settings]Fix using navigation items in scan mode (#22545)

This commit is contained in:
Laszlo Nemeth
2022-12-12 17:34:21 +01:00
committed by GitHub
parent cd1b7dbc2c
commit 6cbb094cfb
2 changed files with 12 additions and 0 deletions

View File

@@ -36,6 +36,7 @@
IsTitleBarAutoPaddingEnabled="False" IsTitleBarAutoPaddingEnabled="False"
PaneClosed="NavigationView_PaneClosed" PaneClosed="NavigationView_PaneClosed"
PaneOpened="NavigationView_PaneOpened" PaneOpened="NavigationView_PaneOpened"
SelectionChanged="NavigationView_SelectionChanged"
SelectedItem="{x:Bind ViewModel.Selected, Mode=OneWay}"> SelectedItem="{x:Bind ViewModel.Selected, Mode=OneWay}">
<NavigationView.Resources> <NavigationView.Resources>
<SolidColorBrush <SolidColorBrush

View File

@@ -4,6 +4,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Microsoft.PowerToys.Settings.UI.Helpers;
using Microsoft.PowerToys.Settings.UI.Services; using Microsoft.PowerToys.Settings.UI.Services;
using Microsoft.PowerToys.Settings.UI.ViewModels; using Microsoft.PowerToys.Settings.UI.ViewModels;
using Microsoft.UI.Xaml; using Microsoft.UI.Xaml;
@@ -225,5 +226,15 @@ namespace Microsoft.PowerToys.Settings.UI.Views
{ {
await Launcher.LaunchUriAsync(new Uri("https://aka.ms/powerToysGiveFeedback")); await Launcher.LaunchUriAsync(new Uri("https://aka.ms/powerToysGiveFeedback"));
} }
private void NavigationView_SelectionChanged(NavigationView sender, NavigationViewSelectionChangedEventArgs args)
{
NavigationViewItem selectedItem = args.SelectedItem as NavigationViewItem;
if (selectedItem != null)
{
Type pageType = selectedItem.GetValue(NavHelper.NavigateToProperty) as Type;
NavigationService.Navigate(pageType);
}
}
} }
} }