Silverlight / WPF - how to bind the silverlight slider value to the datagrid in mvvm

Asked By Ramachandran on 28-Jun-12 05:25 AM
Earn up to 10 extra points for answering this tough question.
how to bind the silverlight slider value to the datagrid in mvvm. refer me one example........
[)ia6l0 iii replied to Ramachandran on 28-Jun-12 12:25 PM
In MVVM, we need to bind the slider value to a ViewModel property
<Slider Name="sampleSlider" Minimum="1" Maximum="100" Value="{Binding SomeProperty, Mode=TwoWay}" ValueChanged="sampleSlider_ValueChanged" />

And in your viewmodel, assign to a property. 
private int _someProperty ;
public int SomeProperty 

{
get
{
return _someProperty ;
}
set
{
_someProperty = value;
}
}


And then you use the viewmodel with the datagrid. 

Otherwise, you can use the slider DragCompleted event handler to make updates to the datagrid. 
Jitendra Faye replied to Ramachandran on 29-Jun-12 12:33 AM
Follow this link-

http://stackoverflow.com/questions/5324758/wpf-problem-with-binding-the-event-for-slider-control-using-mvvm


Hope this will help you,