Skip to content

Cannot Update Navigation menu items at Runtime #751

Open
@RohitM-IN

Description

@RohitM-IN

Describe the bug

I am trying to add few Items based on configuration after the user logs in but the issue is I can see that the item is been added to the navigation menu but for some reason its not shown in the layout.

I can tell that the property is being changed but its not updating in the UI.

It works fine if I add the NavigationViewItem at constructor but not when i use a Command or for starters using the default events like for example NavigationView_PaneOpened

        private void NavigationView_PaneOpened(NavigationView sender, RoutedEventArgs args)
        {
            if (_isPaneOpenedOrClosedFromCode)
                return;

            NavigationView.MenuItems.Clear();
            NavigationView.MenuItems.Add(new NavigationViewItem("SamplePage", SymbolRegular.Home24, typeof(SamplePage)));

            _isUserClosedPane = false;
        }

To Reproduce

Try adding a NavigationViewItem after page load like in event or Relay Command ,etc

here is old data
image

I can see that the item is added in navigation item
image

after clearing the list and adding new items:
image

but its not appearing in the main window navigation

image

Expected behavior

The NavigationViewItem Should be added in Navigation menu items list

Screenshots

No response

OS version

Windows 10

.NET version

.net 7

WPF-UI NuGet version

using the git development branch's dll with commit 438edf8

Additional context

No response

Metadata

Metadata

Assignees

Labels

MVVM_DIIssues related to MVVM and Dependency Injection.bugSomething isn't workingcontrolsChanges to the appearance or logic of custom controls.navigationChanges to navigation related controls.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions