-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Fix Picker ItemDisplayBinding doesn't support MVVM properly #29922
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
base: main
Are you sure you want to change the base?
Fix Picker ItemDisplayBinding doesn't support MVVM properly #29922
Conversation
Hey there @@devanathan-vaithiyanathan! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue25634.cs
Outdated
Show resolved
Hide resolved
/azp run MAUI-UITests-public |
Azure Pipelines successfully started running 1 pipeline(s). |
{ | ||
App.WaitForElement("PickerButton"); | ||
App.Tap("PickerButton"); | ||
VerifyScreenshot(); |
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.
/azp run MAUI-UITests-public |
Azure Pipelines successfully started running 1 pipeline(s). |
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.
@jsuarezruiz , pending snapshots has been added. |
/azp run MAUI-UITests-public |
Azure Pipelines successfully started running 1 pipeline(s). |
@@ -264,6 +264,27 @@ static void OnItemsSourceChanged(BindableObject bindable, object oldValue, objec | |||
|
|||
void OnItemsSourceChanged(IList oldValue, IList newValue) | |||
{ | |||
if (oldValue is not null) |
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 logic is duplicated, can extract it to a method.
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.
Inside the methods, check items.Count == 0 before iterating to avoid unnecessary loops
Note
Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!
Issue Details
Picker does not refresh displayed item when bound property changes through ItemDisplayBinding
Description of Change
Added support to automatically refresh the Picker display when a bound item's property changes. Subscribed to property change events in the items source, and updated the display when the property defined in ItemDisplayBinding changes. Also handled item additions and removals by updating the subscriptions accordingly.
Issues Fixed
Fixes #25634
Tested the behavior in the following platforms.
iOS-BeforeFix.mov
iOS-AfterFix.mov