You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
The parameters of ItemInvoked are not consistent #26108
In a NavigationView with the PaneDisplayMode set to Top, when a tab is selected, the ItemInvoked event is triggered; the problem is that the event parameters of type NavigationViewItemInvokedEventArgs are not always the same. If the selected item is a visible tab, the value of InvokedItem contains the text displayed on the tab, and to retrieve the selected item, you must set it to the Tap property of the NavigationViewItem and access it via the InvokedItemContainer; whereas if an item from the overflow menu is selected, then InvokedItem contains the selected item and InvokedItemContainer is null.
Expected behavior 🎯
Ensure that the parameters of the ItemInvoked event always contain the data in the same property, so that logic relating to that event can always be handled in the same way.
How to reproduce it (as minimally and precisely as possible) 🔬
Open the attached solution and compile it.
Minimise the application until the overflow button appears.
Set a Breakpoint in the method NavigationViewItemInvoked of the MainPage.xaml.cs
Click on the overflow button and select Tabs or options in the overflow menu.
Activity
Xiaoy312 commentedon Nov 6, 2026
While I agree that there are some inconsistencies in term of args from that NavigationView::ItemInvoked event, as seen below: // top bar vs overflow
InvokedItem"First Tab…"(string)"First Tab…"(string)InvokedItemContainerNavigationViewItemNavigationViewItemInvokedItemNavOptiondata objectNavOptiondata objectInvokedItemContainernullnullsender.SelectedIteminside the handlerSelectionChanged.SelectedItemContainerNavigationViewItemnullHowever, they are in line with the windows behaviors, despite not exactly being as "expected". So, we are not going to stray away from windows here.
That said, you can use
NavigationView::SelectedItemwhich contains the data-context when used within::ItemInvoked's handler.