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.47k stars 725 forks source link

Update `INotifyCollectionChanged` events in `MenuItems` and `FooterMenuItems` of the `NavigationView` #1098

Closed ioswald closed 3 months ago

ioswald commented 4 months ago

Pull request type

Please check the type of change your PR introduces:

What is the current behavior?

If you modify a databound observable collection to navigationview menu/footer items and then modify that list later in the program, the ui will not update with the new items.

Issue Number: N/A

What is the new behavior?

Ui now updates when binding source is updated.

Other information

ioswald commented 4 months ago

Fixed stackoverflow due to recursive call from collection change event when updating from binding source.

crippledfaith commented 4 months ago

Hi please look at (https://github.com/lepoco/wpfui/pull/1092) You don't need to add the items to another collection as it is an observable collection, any change to the collection will change the items.

ioswald commented 3 months ago

The initial items get added to the observable collection and update when you set the itemssource, but you aren't adding a binding to the itemssource; they're just being added from one to the other; so if the itemssource changes after the initial binding is done; the items do not update.