-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
BindableLayout should dispatch layout changes when collection changes from background thread #24714
base: main
Are you sure you want to change the base?
Conversation
Hey there @albyrock87! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good. I wonder why we never dispatched before.
@PureWeen not sure if this rings any bells. I recall EZ was always sad we did dispatching for some things and we should have always done something different. But I may be mixing multiple thoughts here...
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
… from background thread
affaee5
to
1cc4786
Compare
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
Adding the do not merge as I believe this is still undergoing discussions. |
Description of Change
Quoting https://learn.microsoft.com/en-us/dotnet/maui/fundamentals/data-binding/?view=net-maui-8.0
In MAUI we're used to
Binding
marshaling, so when doingBindableLayout.ItemsSource={Binding MyCollection}
we give for granted this will be automatically marshaled to the main thread which is true forINotifyPropertyChanged
event.maui/src/Controls/src/Core/BindingExpression.cs
Line 717 in c4479e6
maui/src/Controls/src/Core/BindingExpression.cs
Line 742 in c4479e6
INotifyCollectionChanged
(likeINotifyPropertyChanged
) should be also taken into account in this context.This is the main cause of the issue #10918 reported a while ago.
This PR introduces the use of
IDispatcher
when reacting to collection changed event.Issues Fixed
Fixes #10918