Myra
Myra copied to clipboard
Bug: NotifyCollectionChangedAction.Reset not cleaning up items
ObservableCollection implements a Clear method that calls CollectionChanged callback with a NotifyCollectionChangedEventArgs where the action is NotifyCollectionChangedAction.Reset. This case isn't implemented in ComboBox.Items_CollectionChanged, Menu.ItemsOnCollectionChanged or Grid.OnProportionsChanged (But probably should be, note how for example FileDialog.UpdateFolder calls _gridFiles.RowsProportions.Clear() in FileDialog.cs) In MultipleItemsContainerBase.cs and Desktop.cs this case is implemented but due to how the ChildrenCopy property works, the removed items will not have their desktop and parent unset.
Thanks for reporting. I've fixed this case for Menu & ComboBox. As for Grid.OnProportionsChanged, it calls InvalidateMeasure, which is enough. I dont think any additional processing in required there.
I'll look further into removed items not having Parent and Desktop unset.
In MultipleItemsContainerBase.cs and Desktop.cs this case is implemented but due to how the ChildrenCopy property works, the removed items will not have their desktop and parent unset.
It works for me:
I can confirm this is also happening with ListBox Items collections.