DragEventArgs.AcceptedOperation Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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.
public:
property DataPackageOperation AcceptedOperation { DataPackageOperation get(); void set(DataPackageOperation value); };
DataPackageOperation AcceptedOperation();
void AcceptedOperation(DataPackageOperation value);
public DataPackageOperation AcceptedOperation { get; set; }
var dataPackageOperation = dragEventArgs.acceptedOperation;
dragEventArgs.acceptedOperation = dataPackageOperation;
Public Property AcceptedOperation As DataPackageOperation
Property Value
A value or bitwise combination of values that specifies which operations can be accepted by the target of the drag event.
Examples
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;
}
Remarks
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.