I\'ve slider that its value is bind to some property, and the property updates it all the time. While dragging the [thumb on] slider I want to stop this update value of slider f
Added a flag to indicate dragging and only send out value changed events when the slider is being dragged.
public class CustomSlider:Slider
{
public bool IsDragging { get; protected set; }
protected override void OnThumbDragCompleted(System.Windows.Controls.Primitives.DragCompletedEventArgs e)
{
IsDragging = false;
base.OnThumbDragCompleted(e);
}
protected override void OnThumbDragStarted(System.Windows.Controls.Primitives.DragStartedEventArgs e)
{
IsDragging = true;
base.OnThumbDragStarted(e);
}
protected override void OnValueChanged(double oldValue, double newValue)
{
if (!IsDragging)
{
base.OnValueChanged(oldValue, newValue);
}
}
}