Class DragDropSession
State for one active cross-container drag gesture, from the moment an IDragSource accepts it (see TryBeginDrag(Point, out object?, out UIElement?)) until the gesture ends.
public sealed class DragDropSession
- Inheritance
-
DragDropSession
- Inherited Members
- Extension Methods
Remarks
Created and owned entirely by Canvas - an IDragSource/IDropTarget only ever observes one handed to it, never constructs one itself.
Constructors
DragDropSession(UIElement, object, Point)
Initializes a new instance of the DragDropSession class.
public DragDropSession(UIElement source, object payload, Point screenPoint)
Parameters
sourceUIElementThe element that started the drag (see TryBeginDrag(Point, out object?, out UIElement?)).
payloadobjectThe data carried for the duration of the drag.
screenPointPointThe drag's starting position, in screen/window space.
Properties
CurrentTarget
Gets the IDropTarget currently under the cursor and willing to accept this session (see CanDrop(DragDropSession)), or null when nothing under the cursor accepts it.
public IDropTarget? CurrentTarget { get; }
Property Value
Payload
Gets the data carried for the duration of this drag, as supplied by Source.
public object Payload { get; }
Property Value
Preview
Gets the element rendered via Overlays and repositioned to follow the
cursor for the rest of the gesture - set once, from TryBeginDrag(Point, out object?, out UIElement?)'s own
preview output.
public UIElement? Preview { get; }
Property Value
ScreenPoint
Gets the drag's current position, in screen/window space - updated every frame by Canvas as the gesture continues.
public Point ScreenPoint { get; }
Property Value
Source
Gets the element that started this drag.
public UIElement Source { get; }