[Core] Fix Slider Maximum , Minimum binding issue #2765
Conversation
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.
The effects of this might be even more wrong than the current behavior.
<Slider
Value="{Binding Value}"
Min="{Binding Min}"
Max="{Binding Max}" />
with a context of new {Value=-50, Min=-100, Max=-1}
the min and max will be correct, but the value will be coerced at -1
Binding the
|
Looks like nothing will quite work here. With the way the current properties work, you are bound to have invalid or incorrect states. You could add a property that is guaranteed to work, SliderValues, which has a type that contains all three floats Min, Max, and Current. And then leave the existing three properties in a partially fixed state, where they work in more situations than they did before, but not all. |
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.
Huh. Seems intractable; XAML doesn't have syntax to declare dependencies between properties to control how they are assigned. So if a dependency exists (e.g. value -> min, value -> max) then there is no way to express it in XAML and honor the dependencies. Yet Windows Phone has Min
and Max
properties. So maybe I'm wrong and the dependency can be expressed? Wonder why didn't they just have a single property Percentage
of type double that varies between 0 and 1? Anyway, @StephaneDelcroix is the expert so if it is intractable, he'll know the least worst solution.
Here is an idea: Setting Min, Value, Max would set internal mutable variables This would not prevent temporary glitches in |
Description of Change
Remove validateValue handler on Maximum/Minimum properties
Use propertyChanged for Maximum/Minimum integrity
Bugs Fixed
API Changes
None
Behavioral Changes
Allow set Minimum value that greater than Maximum value, after Minimum was updated, Maximum value is changed to Max(Minimum, Maximum)
Allow set Maximum value that smaller than Minimum, after Maximum was updated, Minimum value is changed to Min(Minimum, Maximum)
PR Checklist