Update value binding trigger

5 posts, 0 answers
  1. Justin Lee
    Justin Lee avatar
    149 posts
    Member since:
    Dec 2009

    Posted 17 Dec 2011 Link to this post

    I have a Slider that is bound to a property in a ViewModel (using mvvm).  The viewmodel is set up to save the object whenever the value is changed.  However with a slider, the property gets updated many times as you slide it - which I only want it to update after the slide is finished (mouse click is released).  The NumericUpDown has a UpdateValueEvent that you can set to LostFocus.  Does the slider have anything like this?  I have tried setting IsDeferredDraggingEnabled to true, but it appears that only affects when the ValueChanged event is fired. 

    Thanks,
    Justin
  2. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 21 Dec 2011 Link to this post

    Hi Justin Lee,

     I really think that the IsDeferredDraggingEnabled set to true fits in your scenario. This way the setter in the ViewModels' property that is bound to the Value of RadSlider will be fired only when the Slider's Thumb has been released. Please elaborate more on your scenario if this is not what you need.

    All the best,
    Petar Mladenov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. DevCraft banner
  4. Justin Lee
    Justin Lee avatar
    149 posts
    Member since:
    Dec 2009

    Posted 21 Dec 2011 Link to this post

    Yes, it would fit my scenario - if it worked...  In your example, if you bind the view model to the usercontrol (this.DataContext = new SliderViewModel()...), then add a textblock to the grid:
    <TextBox Text="{Binding VmValue}" Margin="0,50,0,0"></TextBox>

    The textblock's text will update constantly as you move the slider (whether IsDeferredDraggingEnabled is true or false).  Which means the value (VmValue) is getting updated constantly.  (or you can just put a break point in the VmValue property and see that it updates as soon as you start to move the slider)

    The IsDeferredDraggingEnabled property only seems to affect when the ValueChanged event is fired.  It does not affect when the databound value is updated.

    I don't know if its considered a bug or not - but regardless, I'd like to know if there is a workaround.

    Thanks,
    Justin
  5. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 26 Dec 2011 Link to this post

    Hello Justin Lee,

    Can you confirm that your VisualStudio does not override the Telerik Dlls to use an older installed version on your machine?
    I am afraid you have used the dlls from the "DLLs" folder in the archive I sent you in the last reply. The behavior you described is expected in these dlls- Q3 2010 SP1 (1314). But I can assure you that the Q2 2011 (712) version ( the dll in the Bin//Debug in the project is 712) and the Q3 2011 (1116) provide a fixed version of RadSlider for this scenario. You can examine this video - I tested the scenario you suggested with the Q2 and Q3 dlls. Please excuse me for the inconvenience caused.

    Greetings,
    Petar Mladenov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  6. Justin Lee
    Justin Lee avatar
    149 posts
    Member since:
    Dec 2009

    Posted 27 Dec 2011 Link to this post

    Ok.  I'm currently using Q1 2011.  I'll consider upgrading to Q2 or Q3 to resolve the issue.

    Thanks,
    Justin
Back to Top
DevCraft banner