Table of Contents

Interface IDropTarget

Namespace
Icy.Input.DragDrop
Assembly
IcyUI.dll

Opts a UIElement into receiving a DragDropSession started by an IDragSource elsewhere in the tree.

public interface IDropTarget
Extension Methods

Remarks

Unlike ordinary pointer routing, a Canvas re-hit-tests every frame while a DragDropSession is active (see DragDropSession's own remarks), checking each candidate from the hit leaf up through its ancestors for the first one implementing this interface whose CanDrop(DragDropSession) returns true - that becomes CurrentTarget until the cursor moves somewhere else or the session ends.

Methods

CanDrop(DragDropSession)

Called every time the current candidate target changes to this element, before OnDragEnter(DragDropSession).

bool CanDrop(DragDropSession session)

Parameters

session DragDropSession

The active drag session.

Returns

bool

true if this element accepts session's payload right now (checked again, every frame the cursor stays over it, and once more at drop time before OnDrop(DragDropSession) fires).

OnDragEnter(DragDropSession)

Called once, when this element becomes CurrentTarget (after CanDrop(DragDropSession) returned true).

void OnDragEnter(DragDropSession session)

Parameters

session DragDropSession

The active drag session.

OnDragLeave(DragDropSession)

Called once, when this element stops being CurrentTarget - the cursor moved elsewhere, or the session ended without a drop here.

void OnDragLeave(DragDropSession session)

Parameters

session DragDropSession

The active drag session.

OnDragOver(DragDropSession)

Called every frame the cursor stays over this element while it's still CurrentTarget, after the initial OnDragEnter(DragDropSession).

void OnDragOver(DragDropSession session)

Parameters

session DragDropSession

The active drag session.

OnDrop(DragDropSession)

Called once, when the drag ends while this element is CurrentTarget and CanDrop(DragDropSession) still returns true.

void OnDrop(DragDropSession session)

Parameters

session DragDropSession

The active drag session.