NavigationView SelectionChanged event not firing
Nobody has claimed this yet.
- 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
- Create a NavigationView control in a WPF application.
- Add several NavigationViewItems to the control.
- Implement the SelectionChanged event handler in the code-behind.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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