다음을 통해 공유


DragEventHandler Delegate

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Represents the method that will handle the DragEnter, DragLeave, DragOver, and Drop events of a UIElement.

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

Syntax

'Declaration
Public Delegate Sub DragEventHandler ( _
    sender As Object, _
    e As DragEventArgs _
)
public delegate void DragEventHandler(
    Object sender,
    DragEventArgs e
)

Parameters

  • sender
    Type: System.Object
    The object where the event handler is attached.

Remarks

The events that this delegate supports are routed events that use the bubbling routing strategy. The DragEventArgs object has a Handled property. Handled can be set to true to mark the event occurrence as handled and to prevent handlers from being invoked further along the event route. These events cannot have handlers attached that are invoked even when another handler marks Handled as true. This is because AddHandler requires a RoutedEvent identifier, and the events that use DragEventArgs do not expose such an identifier. For more information about the Handled concept and routed events in general, see Events Overview for Silverlight.

Drag-and-drop events in Silverlight 5 support a scenario of enabling a Silverlight UIElement to be a drop target for a file list that is dragged from another area of the UI. The drag origin can be outside the Silverlight content area or the browser host.

True drag-and-drop support that carries a data payload from one object to another is limited to this particular scenario in Silverlight 5. However, you can enable related scenarios by using mouse capture, and by transmitting your own data or using event data from the mouse events. You might also use mouse positional information to adjust object layout properties of objects that captured the mouse. For more information about how to use mouse capture in this manner, see How to: Drag and Drop Objects in UI Layout.

NoteNote:

Previous versions of Silverlight included different classes named DragEventArgs and DragEventHandler, which existed in one of the SDK client libraries. The purpose of the previous DragEventArgs and DragEventHandler types was specific to scenarios that involve a Thumb control part, with Thumb also originally defined in SDK assemblies. For more information on the equivalent API in Silverlight 5, see Thumb.

Version Information

Silverlight

Supported in: 5, 4

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.