Table of Contents

Method DndContext

Namespace
Velvet
Assembly
Velvet.Docs.dll

DndContext(Action<DragStartArgs>?, Action<DragOverArgs>?, Action<DragEndArgs>?, Action<DragCancelArgs>?, DndCollisionDetection?, DragActivation?, string?, string?, string?, FiberElementProps?, StyleOverrides?, Func<VisualElement, Action>?, VNode?[]?, string?, string?, string?, IReadOnlyDictionary<string, string>?, IReadOnlyDictionary<string, string>?)

Drag-and-drop scope. A real container element (the FocusScope precedent: the element is the stable scope identity and cleanup anchor). Draggables and droppables pair with their nearest ancestor scope at event time; one drag may be active per mounted tree at a time. Any existing container can be a scope via props (DndContext) — this factory is convenience.

public static ElementNode DndContext(Action<DragStartArgs>? onDragStart = null, Action<DragOverArgs>? onDragOver = null, Action<DragEndArgs>? onDragEnd = null, Action<DragCancelArgs>? onDragCancel = null, DndCollisionDetection? collisionDetection = null, DragActivation? activation = null, string? className = null, string? key = null, string? name = null, FiberElementProps? props = null, StyleOverrides? styles = null, Func<VisualElement, Action>? refCallback = null, VNode?[]? children = null, string? whileHoverClass = null, string? whileTapClass = null, string? whileFocusClass = null, IReadOnlyDictionary<string, string>? data = null, IReadOnlyDictionary<string, string>? aria = null)

Parameters

onDragStart Action<DragStartArgs>

Fired once when a press crosses its activation constraint.

onDragOver Action<DragOverArgs>

Fired when the winning drop target CHANGES (including to null).

onDragEnd Action<DragEndArgs>

Fired on release; state written here flushes synchronously like any discrete input handler. Over is null when dropped on nothing.

onDragCancel Action<DragCancelArgs>

Fired when a drag aborts (Escape, pointer cancel, lost capture, or the source/scope unmounting mid-drag).

collisionDetection DndCollisionDetection

Collision strategy; null means RectIntersection.

activation DragActivation

Scope-wide activation default; a per-draggable override wins.

className string
key string
name string
props FiberElementProps
styles StyleOverrides
refCallback Func<VisualElement, Action>
children VNode[]
whileHoverClass string
whileTapClass string
whileFocusClass string
data IReadOnlyDictionary<string, string>
aria IReadOnlyDictionary<string, string>

Returns

ElementNode

The created ElementNode.