Skip to content

Fixed menu item add when item added to the ObservableCollection#1092

Closed
crippledfaith wants to merge 3 commits intolepoco:developmentfrom
crippledfaith:Fixed-Menu-Item-Add-when-item-added-to-the-Observable-Collection
Closed

Fixed menu item add when item added to the ObservableCollection#1092
crippledfaith wants to merge 3 commits intolepoco:developmentfrom
crippledfaith:Fixed-Menu-Item-Add-when-item-added-to-the-Observable-Collection

Conversation

@crippledfaith
Copy link
Copy Markdown

@crippledfaith crippledfaith commented May 18, 2024

Pull request type

Please check the type of change your PR introduces:

  • Update
  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes

What is the current behavior?

When MenuItemsSource or FooterMenuItemsSource in MVVM binding to ObservableCollection the Item added to the collection dose not update in the UI.

Issue Number: N/A

What is the new behavior?

        [ObservableProperty]
        private ObservableCollection<object> _broserNavigationViewItem = new ObservableCollection<object>();

         BroserNavigationViewItem.Add(new NavigationViewItem()
         {
             Content = content,
             Icon = new SymbolIcon { Symbol = icon },
             TargetPageType = targetPageType,
             TargetPageTag = name,
             Template = NavigationService.GetNavigationControl().ItemTemplate
         });

NavigationView item will add the Item

Other information

@github-actions github-actions bot added controls Changes to the appearance or logic of custom controls. PR Pull request navigation Changes to navigation related controls. dotnet labels May 18, 2024
/// Gets or sets the object that represents the navigation items to be used in the footer menu.
/// </summary>
object? FooterMenuItemsSource { get; set; }
ObservableCollection<object> FooterMenuItemsSource { get; set; }
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image
I seems they are suggesting to use ObservableCollection. According to the documentation.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a recommendation to the end user, which does not mean that the library should enforce this type of collection

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 15, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

controls Changes to the appearance or logic of custom controls. dotnet gallery WPF UI Gallery navigation Changes to navigation related controls. PR Pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants