Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: NotifyCollectionChangedAction.Reset not cleaning up items #261

Open
minimalism opened this issue Sep 7, 2020 · 3 comments
Open

Bug: NotifyCollectionChangedAction.Reset not cleaning up items #261

minimalism opened this issue Sep 7, 2020 · 3 comments

Comments

@minimalism
Copy link
Contributor

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.

@minimalism minimalism changed the title NotifyCollectionChangedAction.Reset not cleaning up items Bug: NotifyCollectionChangedAction.Reset not cleaning up items Sep 7, 2020
rds1983 pushed a commit that referenced this issue Nov 10, 2020
@rds1983
Copy link
Owner

rds1983 commented Nov 10, 2020

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.

@rds1983
Copy link
Owner

rds1983 commented Nov 12, 2020

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:
image

@Nornec
Copy link

Nornec commented Oct 29, 2021

I can confirm this is also happening with ListBox Items collections.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants