Skip to content

The parameters of ItemInvoked are not consistent #26108

Open

Description

@ADD-Eugenio-Lopez

Current behavior 🐛

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) 🔬

  1. Open the attached solution and compile it.
  2. Minimise the application until the overflow button appears.
  3. Set a Breakpoint in the method NavigationViewItemInvoked of the MainPage.xaml.cs
  4. Click on the overflow button and select Tabs or options in the overflow menu.
  5. Inspect eventArgs properties.

UnoNavigationViewOverflowButtonVisibility.zip

Workaround 🛠️

Implement different logic when the InvokedItemContainer is null or not to obtain the item.

Affected platforms 📱💻🖥️

All platforms 🌍

Uno.Sdk version (and other relevant versions) 📦

NuGet package(s): Uno.SDK
NuGet package version(s): 6.7.30

IDE version 🧑‍💻

Visual Studio 2026 18.11.3

Anything else we need to know? 💬

No response

Activity

  1. added
    triage/untriaged
    on Nov 5, 2026
  2. self-assigned this
    on Nov 5, 2026
  3. Xiaoy312 commented on Nov 6, 2026

    @Xiaoy312
    Contributor

    While I agree that there are some inconsistencies in term of args from that NavigationView::ItemInvoked event, as seen below: // top bar vs overflow

    Uno WinAppSDK
    Top bar: InvokedItem "First Tab…" (string) "First Tab…" (string)
    Top bar: InvokedItemContainer the tab's NavigationViewItem the tab's NavigationViewItem
    Overflow: InvokedItem the NavOption data object the NavOption data object
    Overflow: InvokedItemContainer null null
    sender.SelectedItem inside the handler the data object, both paths the data object, both paths
    Overflow: SelectionChanged.SelectedItemContainer the tab's NavigationViewItem null

    However, 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::SelectedItem which contains the data-context when used within ::ItemInvoked's handler.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

triage/untriaged

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions