-
Notifications
You must be signed in to change notification settings - Fork 777
Conductor<T>.Collection.OneActive/AllActive - IChild.Parent not reset on clear #465
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
Comments
Definitely sounds like a bug, thanks for raising it. |
So this looks like it comes out of an issue around The solution above maintains a second separate list in order to determine which items were removed. I'm not sure yet if this is the right approach. At the moment I'd recommend using something like |
I agree, it was only meant to be a workaround for cases where you cannot directly control how the items collection is cleared - e.g. A binding to UI control where the control's internal logic invokes clear directly. The internally used BindableCollection should raise a proper notification on clear. Regarding the conductor base implementation, it would also be quite usable to be able to control/override which concrete implementation of IObservableCollection is used to store the items. |
Yup, from discussions this post and Stack Overflow. it's a well known problem, but unfortunately has impacts into the WPF UI as where changing how notifications are done causes errors with some controls. It's hard to judge what the "proper notification" should be. It's possible we add a new event |
Agree, https://stackoverflow.com/a/9416535 seams to be a nice solution too, but might cause performance issues on big lists wrapped by collection views and also i wouldn't be sure if collection views are the only ones not capable of handling multiple items within a single event. In the specific case of conductors, i don't think raising multiple remove events instead of a single clear would cause problems, at least i'm not aware of a conductor conducting thousands of items. On a BindableCollection level, i would rather prefer having option for a suitable workaround, than having none. |
I've had issues with this as some more advanced controls trigger different animations when items are removed and a mass remove like that would be performance issue. Leaning further towards that custom event at the moment. |
The code above fails on 't3.Parent != null', it seems like the conductor implementation only resets the child's parent property on a normal or index-based removal, but not on a clear operation.
The root cause seems to be located within the BindableCollection implementation:
A simple (not really pretty) workaround:
=>
lets the initial example pass without errors.
The text was updated successfully, but these errors were encountered: