Skip to content

NavigationViewItem are multiselect after navigate #1531

@woltek

Description

@woltek

Describe the bug

After using NavigateWithHierarchy() from A to B and go back, both of my menu (A and B) are visually selected.

first time using page/navigation, so may be i miss or misunderstand something.

Image 1: i go on tab search 2: i clic on my folder, NavigateWithHierarchy to explorer 3. Both tab seems selected 4. after clic on BreadCrum or NavigationViewItem 'Recherche', it navigate successfully but both tab seems still selected

To Reproduce

MainWindow ctr :

     //init navigation service
     var lNavService = App.GetService<INavigationService>(); // App.GetService = shortcut to get my services
     lNavService.SetNavigationControl(RootNavigation); //RootNavigation = NavigationView
     RootNavigation.BreadcrumbBar = BreadcrumbBar; 

MainWindow NavigationView :

    <ui:NavigationView Grid.Row="2"
                   x:Name="RootNavigation" 
                   IsBackButtonVisible="Collapsed"
                   OpenPaneLength="200"
                   ScrollViewer.CanContentScroll="False"
                   IsPaneOpen="False"
                   MenuItemsSource="{Binding Main.NavigationItems ,Mode=TwoWay}"
                   >
        <ui:NavigationView.Header>
    
            <ui:BreadcrumbBar x:Name="BreadcrumbBar" FontSize="8" >
                <ui:BreadcrumbBar.ItemTemplate>
                    <DataTemplate>
                        <TextBlock Text="{Binding Content}" />
                    </DataTemplate>
                </ui:BreadcrumbBar.ItemTemplate>
            </ui:BreadcrumbBar>
    
        </ui:NavigationView.Header>
    
    </ui:NavigationView>

Naviguation item source

     NavigationItems =
     [
         new NavigationViewItem()
         {
             Content = "Explorateur",
             Icon = new SymbolIcon { Symbol = SymbolRegular.Folder24 },
             TargetPageType = typeof(P_Explorer),
         },
            new NavigationViewItem()
         {
             Content = "Recherche",
             Icon = new SymbolIcon { Symbol = SymbolRegular.Search24 },
             TargetPageType = typeof(P_Search),
         },
            new NavigationViewItem()
         {
             Content = "Detail",
             TargetPageType = typeof(P_NodeDetail),
             Visibility = System.Windows.Visibility.Collapsed
         }
     ];

way i NavigateWithHierarchy :

     var lNavService = App.GetService<INavigationService>();
     lNavService.NavigateWithHierarchy(typeof(P_Explorer)); 

Expected behavior

only tab i navigate on must be selected

Screenshots

No response

OS version

Win 11

.NET version

.NET 8

WPF-UI NuGet version

4.0.3

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions