-api-id | -api-type |
---|---|
P:Windows.UI.Xaml.DragEventArgs.AcceptedOperation |
winrt property |
Gets or sets a value that specifies which operations (none, move, copy, and/or link) can be accepted by the target of the drag event.
A value or bitwise combination of values that specifies which operations can be accepted by the target of the drag event.
This value is set in the DragEnter or DragOver event of the UIElement
that is a potential drop target of the drag and drop operation. It notifies the drag source of what operations it can accept, if any, for the DataPackage that is being dragged.
For more info about data operations, see the DataPackageOperation enumeration.
In this example, a ListView
accepts only text content. In the DragOver
event handler, the AcceptedOperation
is set to Copy
if the DataPackage
contains text; otherwise, AcceptedOperation
is set to None
.
private void TargetListView_DragOver(object sender, DragEventArgs e)
{
// The list accepts only text.
e.AcceptedOperation =
(e.DataView.Contains(StandardDataFormats.Text))
? DataPackageOperation.Copy : DataPackageOperation.None;
}