Expand Minimize

UIElement.AllowDrop property

Applies to Windows and Windows Phone

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

Syntax


public:
property bool AllowDrop { 
   bool get();
   void set (bool value);
}


<uiElement AllowDrop="bool"/>

Property value

Type: System.Boolean [.NET] | Platform::Boolean [C++]

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

Remarks

The value of AllowDrop determines whether various events related to being a drop target or responding to being dragged over can be handled. Such events only can be handled if AllowDrop is true on the UIElement that is a potential drop target. These events are:

Each of the listed events is a routed event. If you want to handle a bubbling drag-drop event, the potential drop target must have AllowDrop set to true, and the object where the event is handled must have AllowDrop set to true. For more info on routed event concepts, see Events and routed events overview.

The Windows Runtime implementation of drag-drop concepts permits only certain controls and input actions to initiate a drag-drop action. There is no generalized DoDragDrop method that would permit any UI element to initiate a drag-drop action. The main source of a drag-drop action in an app is when you drag the items of a list such as GridView. However once the action is initiated, any UIElement in the app can potentially be a drop target so long as AllowDrop is true on that element. Any elements that the drag-drop action passes over can handle DragEnter, DragLeave or DragOver. The initiating list view does not require AllowDrop. Instead, the value of CanDragItems is used to determine whether the items in the list can be used to start a drag-drop action.

A UI element can't be a drop target for any drag-drop action that begins from outside the current Windows Store app. This includes actions that come from another Windows Store app, which is possible for a snapped view.

Requirements

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]

Namespace

Windows.UI.Xaml
Windows::UI::Xaml [C++]

Metadata

Windows.winmd

See also

UIElement

 

 

Show:
© 2014 Microsoft