I have an issue when adding thumbs to XamNumericRangeSlider. I'm adding them in code-behind and clearing all thumbs before I add the new ones. I also add them in order from highest value to lowest. I have three thumbs. My slider has min-max values of -20 and 20.
If I add thumb values of 0, 1 and 12, it works fine but if I use values like -3, -1 and 12, it doesn't work. The -3 and -1 values become the same which is probably because of the interaction mode being set to lock. This seems to be some kind of a bug in slider since the behavior changes when the values change.
I have attached a sample project where you can reproduce this. I'm using SL5 and 11.2 version of your controls. Thanks in advance!
Hi,
What you are actually seeing is because of the way the binding works in SL. What is actually happening is the Thumbs are being added to the collection with the default value of 0, and then the values are being bound in and adjusted. The behavior is actually the same in both cases; please allow me to explain why.
Values 0, 1, 12:
· The first thumb is dropped onto the slider with a value of 0. Now the binding occurs and moves the thumb to 12. No other thumbs, no interactions occur.
· The second thumb is dropped at 0, and then moved to 1. Again it can move without restriction and does.
· The last thumb is dropped at 0, and then the value 0 is bound in, nothing happens.
Values -3, -1, 12:
· The first thumb is dropped on the slider at 0. The value is bound in and it moves to 12 without issue.
· The second thumb is dropped at 0, and then moved to -1.
· The last thumb is dropped at 0, and then bound to -3. When it attempts to move it finds a locked thumb at -1 and stops.
I hope that help,
Thanks,
Rich
Thanks! That makes perfect sense.
Could it be possible to adjust the interaction mode after the thumbs are added to the slider? That would solve the problem with the least effort?
I got a chance to test this and it seems to work fine! I place the thumbs with InteractionMode.Free and after they are placed, I change the InteractionMode to Lock. Good and usable workaround.
Awesome, glad you were able to come up with an acceptable solution!