This documentation is archived and is not being maintained.
DragDrop Class
Visual Studio 2010
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.
Assembly: PresentationCore (in PresentationCore.dll)
The DragDrop type exposes the following members.
| Name | Description | |
|---|---|---|
![]() ![]() | AddDragEnterHandler | Adds a DragEnter event handler to a specified dependency object. |
![]() ![]() | AddDragLeaveHandler | Adds a DragLeave event handler to a specified dependency object. |
![]() ![]() | AddDragOverHandler | Adds a DragOver event handler to a specified dependency object. |
![]() ![]() | AddDropHandler | Adds a Drop event handler to a specified dependency object. |
![]() ![]() | AddGiveFeedbackHandler | Adds a GiveFeedback event handler to a specified dependency object. |
![]() ![]() | AddPreviewDragEnterHandler | Adds a PreviewDragEnter event handler to a specified dependency object. |
![]() ![]() | AddPreviewDragLeaveHandler | Adds a PreviewDragLeave event handler to a specified dependency object. |
![]() ![]() | AddPreviewDragOverHandler | Adds a PreviewDragOver event handler to a specified dependency object. |
![]() ![]() | AddPreviewDropHandler | Adds a PreviewDrop event handler to a specified dependency object. |
![]() ![]() | AddPreviewGiveFeedbackHandler | Adds a PreviewGiveFeedback event handler to a specified dependency object. |
![]() ![]() | AddPreviewQueryContinueDragHandler | Adds a PreviewQueryContinueDrag event handler to a specified dependency object. |
![]() ![]() | AddQueryContinueDragHandler | Adds a QueryContinueDrag event handler to a specified dependency object. |
![]() ![]() | DoDragDrop | Initiates a drag-and-drop operation. |
![]() ![]() | RemoveDragEnterHandler | Removes a DragEnter event handler from a specified dependency object. |
![]() ![]() | RemoveDragLeaveHandler | Removes a DragLeave event handler from a specified dependency object. |
![]() ![]() | RemoveDragOverHandler | Removes a DragOver event handler from a specified dependency object. |
![]() ![]() | RemoveDropHandler | Removes a Drop event handler from a specified dependency object. |
![]() ![]() | RemoveGiveFeedbackHandler | Removes a GiveFeedback event handler from a specified dependency object. |
![]() ![]() | RemovePreviewDragEnterHandler | Removes a PreviewDragEnter event handler from a specified dependency object. |
![]() ![]() | RemovePreviewDragLeaveHandler | Removes a PreviewDragLeave event handler from a specified dependency object. |
![]() ![]() | RemovePreviewDragOverHandler | Removes a PreviewDragOver event handler from a specified dependency object. |
![]() ![]() | RemovePreviewDropHandler | Removes a PreviewDrop event handler from a specified dependency object. |
![]() ![]() | RemovePreviewGiveFeedbackHandler | Removes a PreviewGiveFeedback event handler from a specified dependency object. |
![]() ![]() | RemovePreviewQueryContinueDragHandler | Removes a PreviewQueryContinueDrag event handler from a specified dependency object. |
![]() ![]() | RemoveQueryContinueDragHandler | Removes a QueryContinueDrag event handler from a specified dependency object. |
| Name | Description | |
|---|---|---|
![]() | DragEnter | Occurs when an object is dragged into the bounds of an element. |
![]() | DragLeave | Occurs when an object is dragged out of the bounds of an element. |
![]() | DragOver | Occurs when an object is dragged over the bounds of an element. |
![]() | Drop | Occurs when an object is dropped within the bounds of an element. |
![]() | GiveFeedback | Occurs when a drag-and-drop operation is started, and enables the drop target to send feedback information to the drop source. |
![]() | PreviewDragEnter | Occurs when an object is dragged into the bounds of an element. |
![]() | PreviewDragLeave | Occurs when an object is dragged out of the bounds of an element. |
![]() | PreviewDragOver | Occurs when an object is dragged over the bounds of an element. |
![]() | PreviewDrop | Occurs when an object is dropped within the bounds of the drop target. |
![]() | PreviewGiveFeedback | Occurs when a drag-and-drop operation is started, and enables the drop target to send feedback information to the drop source. |
![]() | PreviewQueryContinueDrag | Occurs when there is a change in the keyboard or mouse button states during a drag-and-drop operation, and enables the drop source to cancel the drag-and-drop operation depending on the key/button states. |
![]() | QueryContinueDrag | Occurs when there is a change in the keyboard or mouse button states during a drag-and-drop operation, and enables the drop source to cancel the drag-and-drop operation depending on the key/button states. |
| Name | Description | |
|---|---|---|
![]() ![]() | DragEnterEvent | Identifies the DragEnter attached event. |
![]() ![]() | DragLeaveEvent | Identifies the DragLeave attached event |
![]() ![]() | DragOverEvent | Identifies the DragOver attached event |
![]() ![]() | DropEvent | Identifies the Drop attached event |
![]() ![]() | GiveFeedbackEvent | Identifies the GiveFeedback attached event |
![]() ![]() | PreviewDragEnterEvent | Identifies the PreviewDragEnter attached event |
![]() ![]() | PreviewDragLeaveEvent | Identifies the PreviewDragLeave attached event |
![]() ![]() | PreviewDragOverEvent | Identifies the PreviewDragOver attached event |
![]() ![]() | PreviewDropEvent | Identifies the PreviewDrop attached event |
![]() ![]() | PreviewGiveFeedbackEvent | Identifies the PreviewGiveFeedback attached event |
![]() ![]() | PreviewQueryContinueDragEvent | Identifies the PreviewQueryContinueDrag attached event |
![]() ![]() | QueryContinueDragEvent | Identifies the QueryContinueDrag attached event |
The following example demonstrates how to use a DragDrop object.
Private Sub DragStarted() m_IsDown = False Dim serializedObject As String = m_OriginalElement.OuterXml Dim data As DataObject = New DataObject() data.SetData(m_MyFormat.Name, serializedObject) Dim effects As DragDropEffects = _ DragDrop.DoDragDrop(MyCanvas, data, DragDropEffects.Copy Or DragDropEffects.Move) If effects And DragDropEffects.Move Then ' Remove the element. m_OriginalElement.ParentNode.RemoveChild(m_OriginalElement) m_OriginalElement = Nothing End If End Sub
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Show:
