-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Fix: RangeBase should not write coerced values back when DataContext is changing #11918
Fix: RangeBase should not write coerced values back when DataContext is changing #11918
Conversation
My instinct is this is a general issue and should probably be addressed at a lower level.
|
You can test this PR using the following package version. |
This control has always had the issue that the order you set the properties in XAML matters, if the value comes first it will be clamped to the defaults before the desired min and max are set. There seem to be issues with coercion at both ends of the lifetime. |
An alternative solution might just be to make the default Minimum and Maximum values min and max double values. |
probably an idea for now. But the underlaying issue should be solved anyway. |
You can test this PR using the following package version. |
@timunie I'm currently using a hybrid of this pr and big default min max values in my app with no issues, the big limits are belt and braces and probably not needed. |
We need to wait for @maxkatz6 to check and merge this PR. Currently his workload is different 😉 |
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.
ISupportInitialize could help with XAML order, but not with DataContext reloading. Will keep this as a hack for now...
…is changing (#11918) * Add failing test for RangeBase overriding Value on DataContext changed * Add bool flag to skip coercing min, max and value while DataContext is changing
What does the pull request do?
solves an issue where the bound value was changed when data context was changed or cleared
What is the current behavior?
coerced value was written back to the datacontext which is a recent regression
What is the updated/expected behavior with this PR?
regression doesn't happen anymore
How was the solution implemented (if it's not obvious)?
added a bool flag skipping the coerce if the datacontext is beeing changed
Checklist
Breaking changes
Obsoletions / Deprecations
Fixed issues
Fixes #11870
fyi @ahopper : I tested this branch with your sample and it was solved for me. I'd be happy if you can verify this PR.
@grokys Hope you don't mind I took a look into it. If the fix is wrong, feel free to cherry-pick the Unit-Test.