lepoco / wpfui

WPF UI provides the Fluent experience in your known and loved WPF framework. Intuitive design, themes, navigation and new immersive controls. All natively and effortlessly.
https://wpfui.lepo.co
MIT License
7.04k stars 667 forks source link

Navigation issue with dynamically added NavigationViewItem #1076

Open gunpal5 opened 2 months ago

gunpal5 commented 2 months ago

Describe the bug

I am trying to add a NavigationViewItem dynamically into the NavigationView. Its correctly showing the newly added item into the left navigation pane. but navigation service is not able to navigate by the TargetPageTag.

To Reproduce

var nav = _navigationService.GetNavigationControl();
var selected = nav.SelectedItem;
selected.MenuItems.Clear();
var mn = new NavigationViewItem()
{
    Content = project.ProjectName,
    Icon = new SymbolIcon { Symbol = SymbolRegular.TableLightning24 },
    TargetPageType = typeof(ProjectPage),
    TargetPageTag = "ProjectPage"
};
selected.MenuItems.Add(mn);

_navigationService.Navigate("ProjectPage");

Expected behavior

Navigation service should navigate to the newly added NavigationViewItem with the TargetPageTag

Screenshots

No response

OS version

Windows 11

.NET version

.net 8.0

WPF-UI NuGet version

3.0.4

Additional context

No response

FSRobot commented 2 months ago

try update to least,it's works on me