Cannot Update Navigation menu items at Runtime
@pomianowski is already working on this.
Since Sep 10, 2023.
- 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
I can see that the item is added in navigation item
after clearing the list and adding new items:
but its not appearing in the main window navigation
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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.