Freigeben über


UIElement.AllowDrop Property

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

Gets or sets a value that determines whether this UIElement can be a drop target for purposes of Silverlight drag-and-drop operations.

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

Syntax

'Declaration
Public Property AllowDrop As Boolean
public bool AllowDrop { get; set; }
<uiElement AllowDrop="bool"/>

Property Value

Type: System.Boolean
true if this UIElement can be a drop target for purposes of Silverlight drag-and-drop operations; otherwise, false. The default is false.

Remarks

Dependency property identifier field: AllowDropProperty

AllowDrop controls whether various events related to being a drop target are raised or can be handled. The events only occur if AllowDrop is true on that UIElement. These events are:

Each of the listed events is a routed event. An additional condition for receiving a bubbling drag-drop event is that both the sender and the OriginalSource objects involved in an event route must have AllowDrop set to true. For more information on routed event concepts, see Events Overview for Silverlight.

Platform Notes

For Windows platforms, you cannot handle the UIElement drag-and-drop events while running in windowless mode. For more information, see Windowless (Silverlight Plug-in Object).

For Macintosh platforms, receiving drag-and-drop events in Silverlight requires a JavaScript workaround script in the hosting HTML. You must use JavaScript events from the host HTML page to capture the user's drag-and-drop actions, and then forward these events to the Silverlight runtime API. For more information, see Handling Drag-and-Drop Events for Macintosh.

For either platform, you cannot handle the UIElement drag-and-drop events while running in full-screen mode, or in windowless mode. For more information, see FullScreen (Silverlight Plug-in Object) or Windowless (Silverlight Plug-in Object).

Drag-Drop, UAC, and Privilege Boundaries

When developing and debugging applications that use the drag-and-drop events, make sure that all participating processes (Visual Studio, the browser host, and the file list that provides the payload) are running at the same privilege level. On systems that use User Account Control (UAC), messages across lower-to-higher privilege boundaries might be suppressed, and this might prevent the Silverlight drag-and-drop events from being raised or debugged.

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.