Freigeben über


DragEventArgs Class

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

Provides data for drag-and-drop events in Silverlight.

Inheritance Hierarchy

System.Object
  System.EventArgs
    System.Windows.RoutedEventArgs
      System.Windows.DragEventArgs

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

Syntax

'Declaration
Public NotInheritable Class DragEventArgs _
    Inherits RoutedEventArgs
public sealed class DragEventArgs : RoutedEventArgs

The DragEventArgs type exposes the following members.

Properties

  Name Description
Public propertySupported by Silverlight for Windows Phone Data Gets a data object (implements IDataObject) that contains the data associated with the corresponding drag event. This value is not useful in all event cases; see Remarks.
Public propertySupported by Silverlight for Windows Phone Handled Gets or sets a value that indicates the present state of the event handling for a routed event as it travels the route.
Public propertySupported by Silverlight for Windows Phone OriginalSource Gets a reference to the object that raised the event. (Inherited from RoutedEventArgs.)

Top

Methods

  Name Description
Public methodSupported by Silverlight for Windows Phone Equals(Object) Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodSupported by Silverlight for Windows Phone Finalize Allows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.)
Public methodSupported by Silverlight for Windows Phone GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
Public methodSupported by Silverlight for Windows Phone GetPosition Returns a drop point that is relative to a specified UIElement.
Public methodSupported by Silverlight for Windows Phone GetType Gets the Type of the current instance. (Inherited from Object.)
Protected methodSupported by Silverlight for Windows Phone MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public methodSupported by Silverlight for Windows Phone ToString Returns a string that represents the current object. (Inherited from Object.)

Top

Remarks

This class provides event data for the following events:

Each of these events is a routed event that uses the bubbling routing strategy. DragEventArgs 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.

DragEventArgs contains a Data property. However the value of that property is only useful when the event data corresponds to a Drop event. For more information about this restriction, see Data.

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 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

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1

Platforms

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

Thread Safety

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