amwx / FluentAvalonia

Control library focused on fluent design and bringing more WinUI controls into Avalonia
MIT License
1.05k stars 97 forks source link

NavigationView doesn't expand to highlight selectedItem in collapsed menu #511

Closed Coloris closed 3 months ago

Coloris commented 10 months ago

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

amwx commented 9 months ago

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