lepoco / lepoco/wpfui

Cannot Update Navigation menu items at Runtime

Open
#751 9 comments 1 reaction 1 assignee View on GitHub

@pomianowski is already working on this.

Since Sep 10, 2023.

bug controls MVVM_DI navigation
Dominant language
C#
Stars
9.6k
Forks
1k
PR merge metrics
No merged PRs in 30d

Description

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 438edf803bb21f15f747ef48d47645f0b72d1338

Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.