FluentAvalonia icon indicating copy to clipboard operation
FluentAvalonia copied to clipboard

NavigationView doesn't expand to highlight selectedItem in collapsed menu

Open Coloris opened this issue 1 year ago • 1 comments

Describe the bug When assigning the SelectedItem property from my ViewModel to a child MenuItem in a hierarchical NavigationView, the change doesn't seem to be reflected in the NavigationView when the menu is collapsed. If the menu is collapsed, the NavigationView doesn't automatically expand to highlight the selection of a child MenuItem.

Screenshots

Desktop/Platform (please complete the following information): OS: Windows 11 FluentAvalonia Version : 2.0.4 (latest) Avalonia Version : 11.0.6

Additional context For now I can use the IsExpanded property as a workaround

Coloris avatar Jan 08 '24 14:01 Coloris

When assigning the SelectedItem property from my ViewModel to a child MenuItem in a hierarchical NavigationView, the change doesn't seem to be reflected in the NavigationView when the menu is collapsed.

I can't reproduce this.

If the menu is collapsed, the NavigationView doesn't automatically expand to highlight the selection of a child MenuItem. Additional context For now I can use the IsExpanded property as a workaround

This is correct. If you want to expand a parent item upon a child item's selection, you'll have to do it yourself. WinUI's gallery does this here: https://github.com/microsoft/WinUI-Gallery/blob/e7d6204669a79fca27963f657892b46634c67908/WinUIGallery/Navigation/NavigationRootPage.xaml.cs#L440

amwx avatar Feb 03 '24 22:02 amwx