UIElement.AllowDrop UIElement.AllowDrop UIElement.AllowDrop UIElement.AllowDrop Property


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

public : Platform::Boolean AllowDrop { get; set; }
bool AllowDrop(); void AllowDrop(bool allowdrop);
public bool AllowDrop { get; set; }
Public ReadWrite Property AllowDrop As bool
<uiElement AllowDrop="bool"/>
Property Value
bool bool

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


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:

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 UWP app. This includes actions that come from another UWP app, which is possible for a snapped view.

See Also