Skip to content

NavigationView UI doesn't update when setting NavigationView.SelectedItem from code-behind #10364

@HEIC-to-JPEG-Dev

Description

@HEIC-to-JPEG-Dev

Describe the bug

When the NavigationView.Selecteditem is set in code behind, the NavigationViewraises an event as expected to show this has happened, and any interrigation of which item is selected is correct, but the UI selector dissapears, with no item showing as selected.

This is required for dynamically generated content where data binding is not possible

Steps to reproduce the bug

Create a xaml NavigationView with items
Select an item in the UI - remember it in code
Select a different item in UI
Select the original selected item in code-behind - all works except the UI does not update

Expected behavior

Regardless of how the currently selected item is selected, the UI should update

Screenshots

No response

NuGet package version

WinUI 3 - Windows App SDK 1.6.5: 1.6.250205002

Windows version

Windows 11 (24H2): Build 26100

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions