/// <summary> /// Clamp the input between min and max. /// </summary> /// <param name="d"></param> /// <param name="baseValue"></param> /// <returns></returns> private static object CoerceSliderValue(DependencyObject d, object baseValue) { VerticalSlider v = (VerticalSlider)d; double x = (double)baseValue; x = x < v.Minimum ? v.Minimum : x; x = x > v.Maximum ? v.Maximum : x; return(x); }
private static void OnSliderValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { VerticalSlider v = (VerticalSlider)d; d.CoerceValue(ValueProperty); }