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