Add a secondary NavigationView
into the PaneFooter
of the main NavigationView
. Then update the selection manually in the Tapped
event handlers. Sample code:
<NavigationView x:Name="MainNavigationView"
IsBackButtonVisible="Collapsed"
IsPaneToggleButtonVisible="true"
OpenPaneLength="220"
CompactModeThresholdWidth="0"
ExpandedModeThresholdWidth="0"
MenuItemsSource="{x:Bind PrimaryButtons}"
IsSettingsVisible="False"
IsPaneOpen="true">
<NavigationView.MenuItemTemplate>
<DataTemplate x:DataType="local:HamburgerMenuButtonInfo">
<NavigationViewItem Tapped="MainMenuButton_Tapped">
<ContentPresenter Content="{x:Bind Content}" />
</NavigationViewItem>
</DataTemplate>
</NavigationView.MenuItemTemplate>
<NavigationView.PaneFooter>
<NavigationView x:Name="FooterNavigationView"
IsBackButtonVisible="Collapsed"
IsPaneToggleButtonVisible="False"
OpenPaneLength="220"
CompactModeThresholdWidth="0"
ExpandedModeThresholdWidth="0"
IsSettingsVisible="False"
MenuItemsSource="{x:Bind SecondaryButtons}"
IsPaneOpen="true">
<NavigationView.MenuItemTemplate>
<DataTemplate x:DataType="local:HamburgerMenuButtonInfo">
<NavigationViewItem Tapped="FooterMenuButton_Tapped">
<ContentPresenter Content="{x:Bind Content}" />
</NavigationViewItem>
</DataTemplate>
</NavigationView.MenuItemTemplate>
</NavigationView>
</NavigationView.PaneFooter>
</NavigationView>
Clear selection from the other NavigationView
in the Tapped
event handlers:
private void MainMenuButton_Tapped(object sender, Windows.UI.Xaml.Input.TappedRoutedEventArgs e)
{
FooterNavigationView.SelectedItem = null;
}
private void FooterMenuButton_Tapped(object sender, Windows.UI.Xaml.Input.TappedRoutedEventArgs e)
{
MainNavigationView.SelectedItem = null;
}
Tapped
event handler is not called for the settings item. The easiest workaround is to add your own settings menu item instead of setting IsSettingsVisible
to true.