locked
Stopping the movement of a slider with binding

    Question

  • I am trying to stop the movement of a slider programmatically. Is this possible? I have a simple slider bound (2-way) to a property in my view model. Let's say the slider goes from 1-10. I want to be able to set 5 as a stopping point in the code behind and not allow the slider to move past this point. I have tried just setting it in the property's set function, but I believe that is being called too late to stop the slider from moving. I also tried using a Value Converter (as suggested in this thread). I bound the property to the slider's Value using a value converter that returned the value if it was less than 5 and just returned 5 otherwise. This had no effect on the slider's movement.

    So what I want to know is, is this even possible? Is there some earlier event I need to handle in order to stop the slider from moving? Thank you so much!

    Tuesday, July 31, 2012 11:02 PM

Answers

  • Sorry I don't quite understand what you mean. I need to programmatically stop this slider at a random location, not always 5.

    Also, in case anyone else is interested, I found out there is no way to get the slider to come to a complete stop like I want it to. I just have it so it jumps back to where I would want it to stop using data binding.

    • Marked as answer by ejcarp Monday, August 06, 2012 9:01 PM
    Monday, August 06, 2012 9:01 PM

All replies

  • How about create a slider with 0-5 and combine a fake slider?

    NEU_ShieldEdge

    Thursday, August 02, 2012 8:57 AM
  • Sorry I don't quite understand what you mean. I need to programmatically stop this slider at a random location, not always 5.

    Also, in case anyone else is interested, I found out there is no way to get the slider to come to a complete stop like I want it to. I just have it so it jumps back to where I would want it to stop using data binding.

    • Marked as answer by ejcarp Monday, August 06, 2012 9:01 PM
    Monday, August 06, 2012 9:01 PM