Skip to content

Conversation

@adamgauthier
Copy link
Contributor

@adamgauthier adamgauthier commented Sep 24, 2019

ObservableCollection is designed so
NotifyCollectionChangedEventArgs.OldItems is not populated when .Clear()
is called on the collection. Because of this, Caliburn conductors can't
unset the Parent property on all conducted IChild.

There are multiple solutions to this issue that have been discussed, but
I feel like adding a new CollectionCleared event to BindableCollection
is the best compromise considering it doesn't break any existing code
and only extends existing ObservableCollection functionality.

Fixes #465

@adamgauthier
Copy link
Contributor Author

More discussion in #465 and on stackoverflow.

@adamgauthier
Copy link
Contributor Author

Caliburn.Micro.Core.Tests.EventAggregatorSubscribing.Caliburn.Micro.Core.Tests.EventAggregatorSubscribing.A_valid_subscriber_is_assigned_as_a_handler_its_message_type
Assert.True() Failure
Expected: True
Actual:   False

Not sure why that test is failing, everything is green locally. 🤔

ObservableCollection<T> is designed so
NotifyCollectionChangedEventArgs.OldItems is not populated when .Clear()
is called on the collection. Because of this, Caliburn conductors can't
unset the Parent property on all conducted IChild.

There are multiple solutions to this issue that have been discussed, but
I feel like adding a new CollectionCleared event to BindableCollection
is the best compromise considering it doesn't break any existing code
and only extends existing ObservableCollection functionality.
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

Successfully merging this pull request may close these issues.

Conductor<T>.Collection.OneActive/AllActive - IChild.Parent not reset on clear

1 participant