lepoco / lepoco/wpfui

NavigationView SelectionChanged event not firing

Open
#1,183 3 comments 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

The SelectionChanged event in the NavigationView control does not fire when a new item is selected.

To Reproduce
  1. Create a NavigationView control in a WPF application.
  2. Add several NavigationViewItems to the control.
  3. Implement the SelectionChanged event handler in the code-behind.
  4. Run the application and attempt to select different items in the NavigationView.
Expected behavior

The SelectionChanged event should fire each time a different item is selected, allowing appropriate handling of the selection change.

Screenshots

No response

OS version

Windows 11 pro 23H2

.NET version

.NET 8

WPF-UI NuGet version

WPF-UI 3.0.5

Additional context
 <ui:NavigationView
     x:Name="sidebarNavigationView"
     IsPaneToggleVisible="True"
     OpenPaneLength="130"
     SelectionChanged="sidebarNavigationView_SelectionChanged">
     <ui:NavigationView.MenuItems>
         <ui:NavigationViewItem Content="Collections">
             <ui:NavigationViewItem.Icon>
                 <ui:SymbolIcon Style="{StaticResource LargeSymbolIconStyle}" Symbol="Folder48" />
             </ui:NavigationViewItem.Icon>
         </ui:NavigationViewItem>
         <ui:NavigationViewItem Content="Environments">
             <ui:NavigationViewItem.Icon>
                 <ui:SymbolIcon Style="{StaticResource LargeSymbolIconStyle}" Symbol="AppsListDetail24" />
             </ui:NavigationViewItem.Icon>
         </ui:NavigationViewItem>
         <ui:NavigationViewItem Content="History">
             <ui:NavigationViewItem.Icon>
                 <ui:SymbolIcon Style="{StaticResource LargeSymbolIconStyle}" Symbol="History48" />
             </ui:NavigationViewItem.Icon>
         </ui:NavigationViewItem>
     </ui:NavigationView.MenuItems>
     <ui:NavigationView.FooterMenuItems>
         <ui:NavigationViewItem Content="Settings">
             <ui:NavigationViewItem.Icon>
                 <ui:SymbolIcon Symbol="Settings24" />
             </ui:NavigationViewItem.Icon>
         </ui:NavigationViewItem>
     </ui:NavigationView.FooterMenuItems>
 </ui:NavigationView>

private void sidebarNavigationView_SelectionChanged(NavigationView sender, RoutedEventArgs args)
{
System.Windows.MessageBox.Show("Selection changed ! ");
}

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

Start by reproducing the issue in a WPF application with the supplied NavigationView XAML and SelectionChanged handler. Inspect the NavigationView selection event path and verify that selecting different NavigationViewItems invokes the handler as expected.

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
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.