mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-11-27 14:59:16 +08:00
Fix Navigation Footer items crashing the Settings app
This commit is contained in:
parent
769fbe1161
commit
6ca19a53bb
@ -225,22 +225,20 @@
|
||||
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/VideoConferenceMute.png}"
|
||||
IsEnabled="{x:Bind ViewModel.IsVideoConferenceBuild, Mode=OneWay}" />
|
||||
</NavigationView.MenuItems>
|
||||
<NavigationView.PaneFooter>
|
||||
<StackPanel Orientation="Vertical">
|
||||
<NavigationViewItem
|
||||
x:Uid="OOBE_NavViewItem"
|
||||
Icon="{ui:FontIcon Glyph=}"
|
||||
Tapped="OOBEItem_Tapped" />
|
||||
<NavigationViewItem
|
||||
x:Uid="WhatIsNew_NavViewItem"
|
||||
Icon="{ui:FontIcon Glyph=}"
|
||||
Tapped="WhatIsNewItem_Tapped" />
|
||||
<NavigationViewItem
|
||||
x:Uid="Feedback_NavViewItem"
|
||||
Icon="{ui:FontIcon Glyph=}"
|
||||
Tapped="FeedbackItem_Tapped" />
|
||||
</StackPanel>
|
||||
</NavigationView.PaneFooter>
|
||||
<NavigationView.FooterMenuItems>
|
||||
<NavigationViewItem
|
||||
x:Uid="OOBE_NavViewItem"
|
||||
Icon="{ui:FontIcon Glyph=}"
|
||||
Tapped="OOBEItem_Tapped" />
|
||||
<NavigationViewItem
|
||||
x:Uid="WhatIsNew_NavViewItem"
|
||||
Icon="{ui:FontIcon Glyph=}"
|
||||
Tapped="WhatIsNewItem_Tapped" />
|
||||
<NavigationViewItem
|
||||
x:Uid="Feedback_NavViewItem"
|
||||
Icon="{ui:FontIcon Glyph=}"
|
||||
Tapped="FeedbackItem_Tapped" />
|
||||
</NavigationView.FooterMenuItems>
|
||||
<i:Interaction.Behaviors>
|
||||
<ic:EventTriggerBehavior EventName="ItemInvoked">
|
||||
<ic:InvokeCommandAction Command="{x:Bind ViewModel.ItemInvokedCommand}" />
|
||||
|
@ -347,7 +347,11 @@ namespace Microsoft.PowerToys.Settings.UI.Views
|
||||
if (selectedItem != null)
|
||||
{
|
||||
Type pageType = selectedItem.GetValue(NavHelper.NavigateToProperty) as Type;
|
||||
NavigationService.Navigate(pageType);
|
||||
if (pageType != null)
|
||||
{
|
||||
// pageType might be null because of the navigation bar footer items.
|
||||
NavigationService.Navigate(pageType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -108,9 +108,13 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
{
|
||||
var item = navigationView.MenuItems
|
||||
.OfType<NavigationViewItem>()
|
||||
.First(menuItem => (string)menuItem.Content == (string)args.InvokedItem);
|
||||
var pageType = item.GetValue(NavHelper.NavigateToProperty) as Type;
|
||||
NavigationService.Navigate(pageType);
|
||||
.FirstOrDefault(menuItem => (string)menuItem.Content == (string)args.InvokedItem, null);
|
||||
if (item != null)
|
||||
{
|
||||
// item might be null because of the navigation bar footer items.
|
||||
var pageType = item.GetValue(NavHelper.NavigateToProperty) as Type;
|
||||
NavigationService.Navigate(pageType);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnBackRequested(NavigationView sender, NavigationViewBackRequestedEventArgs args)
|
||||
|
Loading…
Reference in New Issue
Block a user