mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 11:48:06 +01:00
Fix Navigation Footer items crashing the Settings app
This commit is contained in:
@@ -225,8 +225,7 @@
|
|||||||
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=}"
|
||||||
@@ -239,8 +238,7 @@
|
|||||||
x:Uid="Feedback_NavViewItem"
|
x:Uid="Feedback_NavViewItem"
|
||||||
Icon="{ui:FontIcon Glyph=}"
|
Icon="{ui:FontIcon Glyph=}"
|
||||||
Tapped="FeedbackItem_Tapped" />
|
Tapped="FeedbackItem_Tapped" />
|
||||||
</StackPanel>
|
</NavigationView.FooterMenuItems>
|
||||||
</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,9 +347,13 @@ 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;
|
||||||
|
if (pageType != null)
|
||||||
|
{
|
||||||
|
// pageType might be null because of the navigation bar footer items.
|
||||||
NavigationService.Navigate(pageType);
|
NavigationService.Navigate(pageType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void ReceiveMessage(JsonObject json)
|
private void ReceiveMessage(JsonObject json)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -108,10 +108,14 @@ 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);
|
||||||
|
if (item != null)
|
||||||
|
{
|
||||||
|
// item might be null because of the navigation bar footer items.
|
||||||
var pageType = item.GetValue(NavHelper.NavigateToProperty) as Type;
|
var pageType = item.GetValue(NavHelper.NavigateToProperty) as Type;
|
||||||
NavigationService.Navigate(pageType);
|
NavigationService.Navigate(pageType);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void OnBackRequested(NavigationView sender, NavigationViewBackRequestedEventArgs args)
|
private void OnBackRequested(NavigationView sender, NavigationViewBackRequestedEventArgs args)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user