Event Args Class
public ref class DragEventArgs sealed : RoutedEventArgs
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)] /// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)] /// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)] /// [Windows.Foundation.Metadata.WebHostHidden] class DragEventArgs final : RoutedEventArgs
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)] [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)] [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)] [Windows.Foundation.Metadata.WebHostHidden] public sealed class DragEventArgs : RoutedEventArgs
Public NotInheritable Class DragEventArgs Inherits RoutedEventArgs
Windows 10 requirements
Windows 10 (introduced in 10.0.10240.0)
Windows.Foundation.UniversalApiContract (introduced in v1.0)
DragEventArgs is used as event data for these events:
These events are routed events. Changing the value of the Handled property of DragEventArgs from an event handler can influence how a routed event behaves. For more info on the routed event concept, see Events and routed events overview.
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.
|Windows version||SDK version||Value added|
Gets or sets a value that specifies which operations are allowed by the originator of the drag event.
Equivalent WinUI property: Microsoft.UI.Xaml.DragEventArgs.AcceptedOperation.
Gets the allowed data package operations (none, move, copy, and/or link) for the drag and drop operation.
Equivalent WinUI property: Microsoft.UI.Xaml.DragEventArgs.AllowedOperations.
Gets or sets a data object (@"Windows.ApplicationModel.DataTransfer.DataPackage?text=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.
Equivalent WinUI property: Microsoft.UI.Xaml.DragEventArgs.Data.
Gets a read-only copy of the Data object.
Equivalent WinUI property: Microsoft.UI.Xaml.DragEventArgs.DataView.
Gets the visual representation of the data being dragged.
Equivalent WinUI property: Microsoft.UI.Xaml.DragEventArgs.DragUIOverride.
Gets or sets a value that indicates the present state of the event handling for a routed event as it travels the route.
Equivalent WinUI property: Microsoft.UI.Xaml.DragEventArgs.Handled.
Gets a flag enumeration indicating the current state of the SHIFT, CTRL, and ALT keys, as well as the state of the mouse buttons.
Equivalent WinUI property: Microsoft.UI.Xaml.DragEventArgs.Modifiers.
Gets a reference to the object that raised the event. This is often a template part of a control rather than an element that was declared in your app UI.
Equivalent WinUI property: Microsoft.UI.Xaml.RoutedEventArgs.OriginalSource.(Inherited from RoutedEventArgs)
Supports asynchronous drag-and-drop operations by creating and returning a DragOperationDeferral object.
Equivalent WinUI method: Microsoft.UI.Xaml.DragEventArgs.GetDeferral.
Returns a drop point that is relative to a specified UIElement.
Equivalent WinUI method: Microsoft.UI.Xaml.DragEventArgs.GetPosition.