Fix to this issue: Clicking on the same element in the hamburger view should re-open that view, like the menu items do #437

This commit is contained in:
A A 2019-04-08 19:38:19 -04:00
commit bd22807420
3 changed files with 17 additions and 0 deletions

View file

@ -109,6 +109,7 @@
PaneOpened="OnNavPaneOpened"
PaneOpening="OnNavPaneOpening"
SelectionChanged="OnNavSelectionChanged"
ItemInvoked="OnNavItemInvoked"
TabIndex="1"
UseSystemFocusVisuals="True">
<muxc:NavigationView.PaneFooter>

View file

@ -601,3 +601,17 @@ void MainPage::AnnounceCategoryName()
NarratorAnnouncement^ announcement = CalculatorAnnouncement::GetCategoryNameChangedAnnouncement(categoryName);
NarratorNotifier->Announce(announcement);
}
void MainPage::OnNavItemInvoked(_In_ Microsoft::UI::Xaml::Controls::NavigationView^ sender, _In_ Microsoft::UI::Xaml::Controls::NavigationViewItemInvokedEventArgs^ e)
{
auto item = dynamic_cast<MUXC::NavigationViewItem^>(e->InvokedItemContainer);
if (item != nullptr)
{
auto selectedItem = static_cast<NavCategory^>(item->DataContext);
if (selectedItem->Mode == Model->Mode)
{
NavView->IsPaneOpen = false;
}
}
}

View file

@ -52,6 +52,8 @@ namespace CalculatorApp
void OnNavPaneOpened(_In_ Microsoft::UI::Xaml::Controls::NavigationView^ sender, _In_ Platform::Object^ args);
void OnNavPaneClosed(_In_ Microsoft::UI::Xaml::Controls::NavigationView^ sender, _In_ Platform::Object^ args);
void OnNavSelectionChanged(_In_ Platform::Object^ sender, _In_ Microsoft::UI::Xaml::Controls::NavigationViewSelectionChangedEventArgs^ e);
void OnNavItemInvoked(_In_ Microsoft::UI::Xaml::Controls::NavigationView^ sender, _In_ Microsoft::UI::Xaml::Controls::NavigationViewItemInvokedEventArgs^ e);
void OnAboutButtonClick(_In_ Platform::Object^ sender, _In_ Windows::UI::Xaml::Controls::ItemClickEventArgs^ e);
void OnAboutFlyoutOpened(_In_ Platform::Object^ sender, _In_ Platform::Object^ e);