locked
Stopping the movement of a slider with binding

    Question

  • Is it possible to stop the movement of a slider after it has hit a certain point using data binding? I am currently using MVVM and binding a value in my VM to a slider using 2-way binding. Let's say for example that the slider goes between 0 and 10. Is there a way to stop it halfway at 5 and be able to change the stopping point programmatically?
    Thursday, July 19, 2012 6:48 PM

All replies

  • Hi,

    I think you can implement a ValueConverter to do the job. Also, you can set smallchange / largechange properties and then have the converter return a single value after certain range to stop it from sliding further.

    -Sagar

    Thursday, July 19, 2012 10:10 PM
    Moderator
  • I don't want the slider to stop and remain immovable though. I just want it to be able to slide between 0 and 5 in this case. Would that be possible with a value converter? Just return 5 if the value is over 5?
    Friday, July 20, 2012 12:23 AM
  • Right, that seems to be the logic. Below 5 you can return the actual value and have it continue with the natural behavior. 

    -Sagar

    Friday, July 20, 2012 12:18 PM
    Moderator
  • So I tried implementing this with a Value Converter and it did not work. Any other ideas?

    Tuesday, July 31, 2012 10:56 PM