Silverlight / WPF - how to fetch the new value of the slider value changed

Asked By Ramachandran on 29-Jun-12 09:30 AM
Super Man replied to Ramachandran on 29-Jun-12 01:34 PM

<Slider ValueChanged="Slider_ValueChanged"></Slider>


      private void Slider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)

      {

        Double newValue = e.NewValue;

        //... use newValue

      }


DL M replied to Ramachandran on 30-Jun-12 02:56 AM
Using JQuery try setting the value using the "value" method, then calling the slider "refresh" method like this:

$('.your-slider').val('20');
$('.your-slider').slider('refresh');
[)ia6l0 iii replied to Ramachandran on 01-Jul-12 09:45 AM
The ValueChanged event provides the RoutedPropertyChangedEventArgs which has the old value and the new value properties. 

private void newSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
{
        double oldValue = e.OldValue;
double newValue = e.NewValue;
}


Hope this helps.