Skip to content

Latest commit

 

History

History
42 lines (28 loc) · 1.63 KB

drageventargs_acceptedoperation.md

File metadata and controls

42 lines (28 loc) · 1.63 KB
-api-id -api-type
P:Windows.UI.Xaml.DragEventArgs.AcceptedOperation
winrt property

Windows.UI.Xaml.DragEventArgs.AcceptedOperation

-description

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.

-property-value

A value or bitwise combination of values that specifies which operations can be accepted by the target of the drag event.

-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.

-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;
}

-see-also

Drag-and-drop overview