lepoco / lepoco/wpfui

NavigationControl.SelectedItem no longer returns the selected child of the parent NavigationViewItem

Open
#778 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C#
Stars
9.6k
Forks
1k
PR merge metrics
No merged PRs in 30d

Description

Describe the bug

When a child NvaigationViewItem is selected (aka one located in NavigationViewItem.MenuItems), the NavigationControl will set the parent NavigationViewItem as the selected item.

As a result, I can no longer retrieve a via MenuItem id or tag or anything to be able to tell why the page of the child item is being shown, resulting in being unable to initialize the page in any meaningful way.

To Reproduce

Create a NavigationCotnrol with menu items that contain a child menu item.

Select the child menu item from the Navigation menu directly.

SelectedItem will become the parent NavigationViewItem.

Expected behavior

SelectedItem should be the selected Child NavigationViewItem

Screenshots

No response

OS version

Windows 11 Pro for Workstations | 22H2 | Build: 22621.2361

.NET version

.Net 7.0.5

WPF-UI NuGet version

N/A
Commit:
https://github.com/lepoco/wpfui/commit/faed583a2772590072628be83af80057733117a7

Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source file or test is named in the issue. Reproduce the behavior with a NavigationControl containing nested NavigationViewItems, then trace the navigation selection entry point and existing selection handling. Done means SelectedItem references the selected child NavigationViewItem when it is chosen directly from the menu.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
desktop
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.