I don't know UWP but I will try to help.
While you are using drag and drop inside one control type you should still differentiate between source and destination.
DragEventHandler
is for drag events on the destination only.
Source (UIElement events)
Destination (
DragEventHandler[
^])
- DragEnter (initialisation)
- DragOver (check if dropping at position possible)
- Drop (when dropping possible)
- DragLeave (optional cleanup when dropping not possible)
All checking should be implemented on the destination side (can the piece be dropped at the current position, is the move allowed). To check if the move is allowed use the
OriginalSource
member of the passed
DragEventArgs
.
Then it would be only necessary to handle DragStarting to check if there is something to drag. But that can be omitted when disabling dragging for fields that are empty (initialise upon start, disable after successful move, and enable upon drop).