I have created a thumb in WPF. I use the DragDelta event to change a value using a mouse click and drag.
Here is my DragDelta code:
private void Thumb_DragDelta(object sender, System.Windows.Controls.Primitives.DragDeltaEventArgs e)
{
MyValue = e.VerticalChange;
}
This works fine, however, when clicking my button again, the value starts at the point where I clicked (0). I need the click and drag to change the value relative to the original. So I tried this:
private void Thumb_DragDelta(object sender, System.Windows.Controls.Primitives.DragDeltaEventArgs e)
{
MyValue += e.VerticalChange;
}
This works but when I drag down and then up again, the value keeps decreasing, even though I move the mouse back up. Same thing when moving the mouse up (value increases), and then move the mouse back down (value keeps increasing).
e.HorizontalChange
ande.VerticalChange
are relative to the lastDragStart
event, not the lastDragDelta
event. – rookie1024