Skip to content

Drag Around - Custom Drag Layer

The boxes set UseCustomDragLayer="true" to hide the native preview, and a <BdndDragLayer> renders our own preview positioned at SourceClientOffset - where the box's corner would be if it moved with the pointer. This gives full control over how the dragged item looks, and where: the modes below keep the preview, and the drop, on one axis (SourceClientOffsetOn(BdndAxis.Horizontal)), on a 40 px grid (SnapTo) or with its corner inside the dashed area (Clamp). The table under the board is a second layer, which shows every offset the layer's state carries as the pointer moves.

Custom preview
Drag me
IsDragging
false
InitialClientOffset
null
InitialSourceClientOffset
null
ClientOffset
null
DifferenceFromInitialOffset
null
SourceClientOffset
null
The preview, free
null
An unhandled error has occurred. Reload 🗙