DragDrop Class
TOC
Collapse the table of content
Expand the table of content

DragDrop Class

 

Provides helper methods and fields for initiating drag-and-drop operations, including a method to begin a drag-and-drop operation, and facilities for adding and removing drag-and-drop related event handlers.

Namespace:   System.Windows
Assembly:  PresentationCore (in PresentationCore.dll)

System.Object
  System.Windows.DragDrop

public static class DragDrop

NameDescription
System_CAPS_pubmethodSystem_CAPS_staticAddDragEnterHandler(DependencyObject, DragEventHandler)

Adds a DragEnter event handler to a specified dependency object.

System_CAPS_pubmethodSystem_CAPS_staticAddDragLeaveHandler(DependencyObject, DragEventHandler)

Adds a DragLeave event handler to a specified dependency object.

System_CAPS_pubmethodSystem_CAPS_staticAddDragOverHandler(DependencyObject, DragEventHandler)

Adds a DragOver event handler to a specified dependency object.

System_CAPS_pubmethodSystem_CAPS_staticAddDropHandler(DependencyObject, DragEventHandler)

Adds a Drop event handler to a specified dependency object.

System_CAPS_pubmethodSystem_CAPS_staticAddGiveFeedbackHandler(DependencyObject, GiveFeedbackEventHandler)

Adds a GiveFeedback event handler to a specified dependency object.

System_CAPS_pubmethodSystem_CAPS_staticAddPreviewDragEnterHandler(DependencyObject, DragEventHandler)

Adds a PreviewDragEnter event handler to a specified dependency object.

System_CAPS_pubmethodSystem_CAPS_staticAddPreviewDragLeaveHandler(DependencyObject, DragEventHandler)

Adds a PreviewDragLeave event handler to a specified dependency object.

System_CAPS_pubmethodSystem_CAPS_staticAddPreviewDragOverHandler(DependencyObject, DragEventHandler)

Adds a PreviewDragOver event handler to a specified dependency object.

System_CAPS_pubmethodSystem_CAPS_staticAddPreviewDropHandler(DependencyObject, DragEventHandler)

Adds a PreviewDrop event handler to a specified dependency object.

System_CAPS_pubmethodSystem_CAPS_staticAddPreviewGiveFeedbackHandler(DependencyObject, GiveFeedbackEventHandler)

Adds a PreviewGiveFeedback event handler to a specified dependency object.

System_CAPS_pubmethodSystem_CAPS_staticAddPreviewQueryContinueDragHandler(DependencyObject, QueryContinueDragEventHandler)

Adds a PreviewQueryContinueDrag event handler to a specified dependency object.

System_CAPS_pubmethodSystem_CAPS_staticAddQueryContinueDragHandler(DependencyObject, QueryContinueDragEventHandler)

Adds a QueryContinueDrag event handler to a specified dependency object.

System_CAPS_pubmethodSystem_CAPS_staticDoDragDrop(DependencyObject, Object, DragDropEffects)

Initiates a drag-and-drop operation.

System_CAPS_pubmethodSystem_CAPS_staticRemoveDragEnterHandler(DependencyObject, DragEventHandler)

Removes a DragEnter event handler from a specified dependency object.

System_CAPS_pubmethodSystem_CAPS_staticRemoveDragLeaveHandler(DependencyObject, DragEventHandler)

Removes a DragLeave event handler from a specified dependency object.

System_CAPS_pubmethodSystem_CAPS_staticRemoveDragOverHandler(DependencyObject, DragEventHandler)

Removes a DragOver event handler from a specified dependency object.

System_CAPS_pubmethodSystem_CAPS_staticRemoveDropHandler(DependencyObject, DragEventHandler)

Removes a Drop event handler from a specified dependency object.

System_CAPS_pubmethodSystem_CAPS_staticRemoveGiveFeedbackHandler(DependencyObject, GiveFeedbackEventHandler)

Removes a GiveFeedback event handler from a specified dependency object.

System_CAPS_pubmethodSystem_CAPS_staticRemovePreviewDragEnterHandler(DependencyObject, DragEventHandler)

Removes a PreviewDragEnter event handler from a specified dependency object.

System_CAPS_pubmethodSystem_CAPS_staticRemovePreviewDragLeaveHandler(DependencyObject, DragEventHandler)

Removes a PreviewDragLeave event handler from a specified dependency object.

System_CAPS_pubmethodSystem_CAPS_staticRemovePreviewDragOverHandler(DependencyObject, DragEventHandler)

Removes a PreviewDragOver event handler from a specified dependency object.

System_CAPS_pubmethodSystem_CAPS_staticRemovePreviewDropHandler(DependencyObject, DragEventHandler)

Removes a PreviewDrop event handler from a specified dependency object.

System_CAPS_pubmethodSystem_CAPS_staticRemovePreviewGiveFeedbackHandler(DependencyObject, GiveFeedbackEventHandler)

Removes a PreviewGiveFeedback event handler from a specified dependency object.

System_CAPS_pubmethodSystem_CAPS_staticRemovePreviewQueryContinueDragHandler(DependencyObject, QueryContinueDragEventHandler)

Removes a PreviewQueryContinueDrag event handler from a specified dependency object.

System_CAPS_pubmethodSystem_CAPS_staticRemoveQueryContinueDragHandler(DependencyObject, QueryContinueDragEventHandler)

Removes a QueryContinueDrag event handler from a specified dependency object.

NameDescription
System_CAPS_pubfieldSystem_CAPS_staticDragEnterEvent

Identifies the DragEnter  attached event.

System_CAPS_pubfieldSystem_CAPS_staticDragLeaveEvent

Identifies the DragLeave  attached event

System_CAPS_pubfieldSystem_CAPS_staticDragOverEvent

Identifies the DragOver  attached event

System_CAPS_pubfieldSystem_CAPS_staticDropEvent

Identifies the Drop  attached event

System_CAPS_pubfieldSystem_CAPS_staticGiveFeedbackEvent

Identifies the GiveFeedback  attached event

System_CAPS_pubfieldSystem_CAPS_staticPreviewDragEnterEvent

Identifies the PreviewDragEnter  attached event

System_CAPS_pubfieldSystem_CAPS_staticPreviewDragLeaveEvent

Identifies the PreviewDragLeave  attached event

System_CAPS_pubfieldSystem_CAPS_staticPreviewDragOverEvent

Identifies the PreviewDragOver  attached event

System_CAPS_pubfieldSystem_CAPS_staticPreviewDropEvent

Identifies the PreviewDrop  attached event

System_CAPS_pubfieldSystem_CAPS_staticPreviewGiveFeedbackEvent

Identifies the PreviewGiveFeedback  attached event

System_CAPS_pubfieldSystem_CAPS_staticPreviewQueryContinueDragEvent

Identifies the PreviewQueryContinueDrag  attached event

System_CAPS_pubfieldSystem_CAPS_staticQueryContinueDragEvent

Identifies the QueryContinueDrag  attached event

NameDescription
System_CAPS_pubeventSystem_CAPS_staticDragEnter

Occurs when an object is dragged into the bounds of an element that is acting as a drop target.

System_CAPS_pubeventSystem_CAPS_staticDragLeave

Occurs when an object is dragged out of the bounds of an element that is acting as a drop target without being dropped.

System_CAPS_pubeventSystem_CAPS_staticDragOver

Occurs continuously while an object is dragged within the bounds of an element that is acting as a drop target.

System_CAPS_pubeventSystem_CAPS_staticDrop

Occurs when an object is dropped within the bounds of an element that is acting as a drop target.

System_CAPS_pubeventSystem_CAPS_staticGiveFeedback

Occurs continuously while a drag-and-drop operation is in progress, and enables the drag source to give feedback to the user.

System_CAPS_pubeventSystem_CAPS_staticPreviewDragEnter

Occurs when an object is dragged into the bounds of an element that is acting as a drop target.

System_CAPS_pubeventSystem_CAPS_staticPreviewDragLeave

Occurs when an object is dragged out of the bounds of an element that is acting as a drop target without being dropped.

System_CAPS_pubeventSystem_CAPS_staticPreviewDragOver

Occurs continuously while an object is dragged within the bounds of an element that is acting as a drop target.

System_CAPS_pubeventSystem_CAPS_staticPreviewDrop

Occurs when an object is dropped within the bounds of an element that is acting as a drop target.

System_CAPS_pubeventSystem_CAPS_staticPreviewGiveFeedback

Occurs continuously while a drag-and-drop operation is in progress, and enables the drag source to give feedback to the user.

System_CAPS_pubeventSystem_CAPS_staticPreviewQueryContinueDrag

Occurs continuously while a drag-and-drop operation is in progress, and enables the drop source to end the drag-and-drop operation depending on the key/button states.

System_CAPS_pubeventSystem_CAPS_staticQueryContinueDrag

Occurs continuously while a drag-and-drop operation is in progress, and enables the drop source to end the drag-and-drop operation depending on the key/button states.

Drag-and-drop commonly refers to a method of data transfer that involves using a mouse (or some other pointing device) to select one or more objects, dragging these objects over some desired drop target in the user interface (UI), and dropping them. A drag-and-drop operation is analogous to a copy (or cut)-and-paste operation that is used to transfer data from one object or application to another. Drag-and-drop operations typically involve two parties: a drag source from which the dragged data originates and a drop target which receives the dropped data. The events and methods required for drag-and-drop operations are defined in the DragDrop class. The drag-and-drop events are attached events that can be attached to any UIElement or ContentElement. The drag source and drop target may be UI elements in the same application or in different applications. However, the drop target must know how to process the data being passed by the drag source.

System_CAPS_noteNote

The UIElement and ContentElement classes contain aliases for the drag-and-drop events so that the events appear in the class members list when these classes are inherited as a base class. When you attach an event handler to a drag-and-drop event on one of these classes, the handler is attached to the underlying DragDrop event and they receive the same instance of event data. For example, see UIElement.Drop.

The drag source initiates a drag-and-drop operation by calling the static DoDragDrop method and passing the transferred data to it. An element typically handles the following events when it is a drag source:

An element typically handles the following events when it is a drop target:

For more information and examples, see Drag and Drop Overview.

.NET Framework
Available since 3.0

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show:
© 2016 Microsoft