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

DevTools not updating tree #4577

Closed
grokys opened this issue Aug 28, 2020 · 1 comment · Fixed by #4578
Closed

DevTools not updating tree #4577

grokys opened this issue Aug 28, 2020 · 1 comment · Fixed by #4578

Comments

@grokys
Copy link
Member

grokys commented Aug 28, 2020

#4533 has broken DevTools in that nodes aren't getting updated when the logical/visual tree gets updated:

5RasFgY4Kv

@grokys
Copy link
Member Author

grokys commented Aug 28, 2020

This seems to be because TreeNodeCollection adds CollectionChanged handlers direct to the inner AvaloniaList<T>:

public event NotifyCollectionChangedEventHandler CollectionChanged
{
add => _inner.CollectionChanged += value;
remove => _inner.CollectionChanged -= value;
}

Meaning that when the event is raised the sender will be for the inner collection. However CollectionChangedEventManager tries to use sender as a key to look up the collection:

if (sender is INotifyCollectionChanged incc && _entries.TryGetValue(incc, out var listeners))

Which is then not found because the sender isn't the collection that the event was registered with.

grokys added a commit that referenced this issue Aug 28, 2020
#4577 was caused because the `sender` of the `CollectionChanged` event didn't correspond to the collection that the event listener was registered on. Instead create an `Entry` object for each collection and put the event handler on that.
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 a pull request may close this issue.

1 participant