DragEventArgs DragEventArgs DragEventArgs DragEventArgs Class

Definition

Provides data for drag-and-drop events.

public : sealed class DragEventArgs : RoutedEventArgs, IDragEventArgs, IDragEventArgs2, IDragEventArgs3public sealed class DragEventArgs : RoutedEventArgs, IDragEventArgs, IDragEventArgs2, IDragEventArgs3Public NotInheritable Class DragEventArgs Inherits RoutedEventArgs Implements IDragEventArgs, IDragEventArgs2, IDragEventArgs3// This API is not available in Javascript.
Inheritance
DragEventArgsDragEventArgsDragEventArgsDragEventArgs
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Inherited Members

Inherited properties

Remarks

DragEventArgs is used as event data for these events:

The Control class has pre-wired event handlers that Control derived types can override to provide class-based handling for the drag-drop events, and these methods also use DragEventArgs as a parameter. These methods are:

The Windows Runtime implementation of drag-drop concepts permits only certain controls and input actions to initiate a drag-drop action. There is no generalized DoDragDrop method that would permit any UI element to initiate a drag-drop action. The main source of a drag-drop action is when you drag the items of a list such as GridView. For a list item drag-drop action, the Data value in event data can potentially be modified from the control-defined default data about the item. This is done by handling the DragItemsStarting event, and working with the DataPackage object that is obtained from the DragItemsStartingEventArgs.Data property in the event data.

Properties

AcceptedOperation AcceptedOperation AcceptedOperation AcceptedOperation

Gets or sets a value that specifies which operations are allowed by the originator of the drag event.

public : DataPackageOperation AcceptedOperation { get; set; }public DataPackageOperation AcceptedOperation { get; set; }Public ReadWrite Property AcceptedOperation As DataPackageOperation// This API is not available in Javascript.
Value
DataPackageOperation DataPackageOperation DataPackageOperation DataPackageOperation

A member of the DataPackageOperation enumeration that specifies which operations are allowed by the originator of the drag event.

AllowedOperations AllowedOperations AllowedOperations AllowedOperations

Gets the allowed data package operations (none, move, copy, and/or link) for the drag and drop operation.

public : DataPackageOperation AllowedOperations { get; }public DataPackageOperation AllowedOperations { get; }Public ReadOnly Property AllowedOperations As DataPackageOperation// This API is not available in Javascript.
Additional features and requirements
Device family
Windows 10 Anniversary Edition (introduced v10.0.14393.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v3)

Remarks

For more info about the allowed data operations, see DataPackageOperation.

This value is set in the DragStarting event handler. See the DragStartingEventArgs.AllowedOperations property.

See Also

Data Data Data Data

Gets or sets a data object (DataPackage ) that contains the data associated with the corresponding drag event. This value is not useful in all event cases; specifically, the event must be handled by a valid drop target.

public : DataPackage Data { get; set; }public DataPackage Data { get; set; }Public ReadWrite Property Data As DataPackage// This API is not available in Javascript.
Value
DataPackage DataPackage DataPackage DataPackage

The data object that contains data payload that is associated with the corresponding drag event.

DataView DataView DataView DataView

Gets a read-only copy of the Data object.

public : DataPackageView DataView { get; }public DataPackageView DataView { get; }Public ReadOnly Property DataView As DataPackageView// This API is not available in Javascript.
Value
DataPackageView DataPackageView DataPackageView DataPackageView

A read-only copy of the Data object.

DragUIOverride DragUIOverride DragUIOverride DragUIOverride

Gets the visual representation of the data being dragged.

public : DragUIOverride DragUIOverride { get; }public DragUIOverride DragUIOverride { get; }Public ReadOnly Property DragUIOverride As DragUIOverride// This API is not available in Javascript.
Value
DragUIOverride DragUIOverride DragUIOverride DragUIOverride

The visual representation of the data being dragged. The default is null.

Handled Handled Handled Handled

Gets or sets a value that indicates the present state of the event handling for a routed event as it travels the route.

public : PlatForm::Boolean Handled { get; set; }public bool Handled { get; set; }Public ReadWrite Property Handled As bool// This API is not available in Javascript.
Value
PlatForm::Boolean bool bool bool

true if the event is marked handled; otherwise, false. The default value is false.

Remarks

The events that use DragEventArgs for event data are routed events. Setting the value of the Handled property to true from an event handler can influence how a routed event behaves: it prevents handlers further along the route from being invoked. However, a handler that was attached by calling AddHandler with handledEventsToo is still invoked. For more info on the routed event concept, see Events and routed events overview.

See Also

Modifiers Modifiers Modifiers Modifiers

Gets a flag enumeration indicating the current state of the SHIFT, CTRL, and ALT keys, as well as the state of the mouse buttons.

public : DragDropModifiers Modifiers { get; }public DragDropModifiers Modifiers { get; }Public ReadOnly Property Modifiers As DragDropModifiers// This API is not available in Javascript.
Value
DragDropModifiers DragDropModifiers DragDropModifiers DragDropModifiers

One or more members of the DragDropModifiers flag enumeration.

Remarks

The effect of a drag-and-drop operation can be adjusted depending on the state of a particular key. For example, data may either be copied or moved depending on whether the CTRL or SHIFT keys are pressed during the drag-and-drop operation.

Methods

GetDeferral() GetDeferral() GetDeferral() GetDeferral()

Supports asynchronous drag-and-drop operations by creating and returning a DragOperationDeferral object.

public : DragOperationDeferral GetDeferral()public DragOperationDeferral GetDeferral()Public Function GetDeferral() As DragOperationDeferral// This API is not available in Javascript.
Returns

A deferral object that you can use to identify when the generation of the data package is complete.

Remarks

The GetDeferral method allows your app to call a function during a drag-and-drop operation, so that your app can asynchronously generate the DataPackage object for the target app.

GetPosition(UIElement) GetPosition(UIElement) GetPosition(UIElement) GetPosition(UIElement)

Returns a drop point that is relative to a specified UIElement.

public : Point GetPosition(UIElement relativeTo)public Point GetPosition(UIElement relativeTo)Public Function GetPosition(relativeTo As UIElement) As Point// This API is not available in Javascript.
Parameters
relativeTo
UIElement UIElement UIElement UIElement

The UIElement for which to get a relative drop point.

Returns

A point in the coordinate system that is relative to the element specified in relativeTo.

Remarks

For drag-drop operations involving a UI container, you typically call GetPosition using a relativeTo reference to the object that is the sender of the event. This gives the relative position within the container.

If this DragEventArgs is associated with the UIElement.Drop event, then the return value of GetPosition is the drop point.

See Also

See Also