punker76 / gong-wpf-dragdrop

The GongSolutions.WPF.DragDrop library is a drag'n'drop framework for WPF
BSD 3-Clause "New" or "Revised" License
2.28k stars 400 forks source link

Relative position triggers drag under wrong circumstances #499

Open VacuumBreather opened 3 months ago

VacuumBreather commented 3 months ago

Describe the bug The library uses a relative mouse position to determine whether a drag operation has started. Unfortunately this position is relative to a UI Element, not the MainWindow. This has the result that if a "ScrollIntoView" operation is triggered by a click, the drag operation is started, despite the user not having moved the mouse. Instead the element that was clicked on has moved, therefore changig the relative position.

To Reproduce Steps to reproduce the behavior:

  1. Create a ListBox with large enough item container styles.
  2. Scroll so one element is only half in-view.
  3. Click on the element and hold the mouse button down.
  4. Observe that the element gets scrolled fully into view, which triggers the drag operation

Expected behavior Drag should only happen when the mouse is moved, not when an element is moved.