Cette documentation est archivée et n’est pas conservée.

DragDrop, classe

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.

Espace de noms: System.Windows
Assembly : PresentationCore (dans presentationcore.dll)
Espace de noms XML :  http://schemas.microsoft.com/winfx/2006/xaml/presentation

public static class DragDrop
public final class DragDrop
public final class DragDrop
Vous ne pouvez pas utiliser cette classe managée dans XAML.

Drag-and-drop functionality is designed to work both within an application and between applications. Dragging data between Windows Presentation Foundation (WPF) and non-WPF applications is also supported.

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 = Nothing
    End If
End Sub


Les membres statiques publics (Shared en Visual Basic) de ce type sont thread-safe. Il n'est pas garanti que les membres d'instance soient thread-safe.

Microsoft .NET Framework 3.0 est pris en charge sur Windows Vista, Microsoft Windows XP SP2 et Windows Server 2003 SP1.

.NET Framework

Prise en charge dans : 3.0