This is a migrated thread and some comments may be shown as answers.

Update value binding trigger

4 Answers 102 Views
Slider
This is a migrated thread and some comments may be shown as answers.
Justin Lee
Top achievements
Rank 1
Justin Lee asked on 17 Dec 2011, 07:21 PM
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

4 Answers, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 21 Dec 2011, 02:03 PM
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 >>

0
Justin Lee
Top achievements
Rank 1
answered on 21 Dec 2011, 03:24 PM
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
0
Petar Mladenov
Telerik team
answered on 26 Dec 2011, 02:15 PM
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 >>

0
Justin Lee
Top achievements
Rank 1
answered on 27 Dec 2011, 04:10 PM
Ok.  I'm currently using Q1 2011.  I'll consider upgrading to Q2 or Q3 to resolve the issue.

Thanks,
Justin
Tags
Slider
Asked by
Justin Lee
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Justin Lee
Top achievements
Rank 1
Share this question
or