Drag&Drop doesn't work correctly with touch events
- Dominant language
- C#
- Stars
- 7.7k
- Forks
- 1.3k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 61
Description
* .NET Core Version: can reproduce with .NET 5
* Windows version: 1909
* Does the bug reproduce also in WPF for .NET Framework 4.8?: Yes
* Is this bug related specifically to tooling in Visual Studio (e.g. XAML Designer, Code editing, etc...)? No
**Problem description:**
I was doing a WPF application that needs to have a "Drag & Drop" functionality that can work with mouse and touch events. I started to use the the Gong WPF DragDrop library (https://github.com/punker76/gong-wpf-dragdrop) but there was something wrong with the touch event.
So I decided to implement a self made Drag & Drop in a little side project. There are two ListBox (the source and the destination ListBox), the source can drag a ListBoxItem into the destination ListBox.
With the PreviewMouseLeftButtonDown event the "System.Windows.DragDrop.DoDragDrop(...)" block while we are doing the drag but that doesn't happen with the PreviewTouchDown event, so the drag is automatically canceled and we cannot drag the item anymore.
**Actual behavior:**
There seems to be an exception in the DoDragDrop method when we are in touch event.
**Expected behavior:**
Should continue the drag and hang while we are dragging the item from the source list to the destination list
**Minimal repro:**
Here is a WPF project where you can test the behavior:
[TestDragDropSelfMade.zip NET 50](https://github.com/dotnet/wpf/files/5788061/TestDragDropSelfMade_net50.zip)
[TestDragDropSelfMade.zip NET 48](https://github.com/dotnet/wpf/files/5787959/TestDragDropSelfMade.zip)
Contributor guide
Assessment
This issue has not been assessed yet.