fix(combobox): fix binding to an old DataSource when both ItemsSource and SelectedItem are bound#12995
fix(combobox): fix binding to an old DataSource when both ItemsSource and SelectedItem are bound#12995ramezgerges wants to merge 8 commits intounoplatform:masterfrom
Conversation
fd78d15 to
1ecfe7d
Compare
src/Uno.UI/UI/Xaml/DependencyPropertyDetailsCollection.Bindings.cs
Outdated
Show resolved
Hide resolved
src/Uno.UI/UI/Xaml/DependencyPropertyDetailsCollection.Bindings.cs
Outdated
Show resolved
Hide resolved
src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml_Controls/Given_ComboBox.cs
Show resolved
Hide resolved
… and SelectedItem are bound
…ssionComparer a singleton
1d6644c to
b8c016e
Compare
| set | ||
| { | ||
| if (!_disposed | ||
| && _value != null |
There was a problem hiding this comment.
This is likely going to have an impact on animations. Let's see what the CI says.
There was a problem hiding this comment.
Indeed. We need to make the AreDifferent check for a reason that so far eludes me, but I guess we can use the old Value, but I'm not sure if there are specific cases that should actually call the getter instead of using the old value. Let's see what tests fail after the small change I just did.
Edit: _value.Value is pretty much equivalent to _value.GetPrecedenceSpecificValue(), so we're back to square one
| { | ||
| if (_precedenceSpecificGetter == null && _dataContextType != null) | ||
| { | ||
| _precedenceSpecificGetter = BindingPropertyHelper.GetValueGetter(_dataContextType, PropertyName, _precedence, _allowPrivateMembers); |
There was a problem hiding this comment.
This code is probably wrong. I think it should have been BindingPropertyHelper.GetPrecedenceSpecificValueGetter but I have no idea if that's the root cause.
There was a problem hiding this comment.
This is indeed interesting. Looking at 5fe335c, this was originally the case, and there this test:
was added at that time and that specifying a precedence to GetValueGetter was enough to make it precedence specific.
GitHub Issue (If applicable): closes #11956
PR Type
What kind of change does this PR introduce?
What is the current behavior?
What is the new behavior?
Copilot Summary
🤖 Generated by Copilot at 87d757c
This pull request enhances the
ImmutableList<T>andDependencyPropertyclasses, and adds a new feature for synchronizing the selection of an items control with the current item of a collection view. It modifies theImmutableList<T>.Insertmethod, theDependencyProperty.Registermethod, and theSelector.IsSynchronizedWithCurrentItemPropertyfield. It also fixes a bug in theImmutableList<T>array copying logic and adds a custom comparer class for dependency property bindings.PR Checklist
Please check if your PR fulfills the following requirements:
Screenshots Compare Test Runresults.Other information
Internal Issue (If applicable):