Skip to content

Commit 97ba361

Browse files
committed
Merged PR 21140: update info about drag-drop ops
update info about drag-drop ops
1 parent d5f63d7 commit 97ba361

3 files changed

Lines changed: 33 additions & 12 deletions

File tree

windows.ui.xaml/drageventargs_acceptedoperation.md

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,33 @@ public Windows.ApplicationModel.DataTransfer.DataPackageOperation AcceptedOperat
1010
# Windows.UI.Xaml.DragEventArgs.AcceptedOperation
1111

1212
## -description
13-
Gets or sets a value that specifies which operations are allowed by the originator of the drag event.
14-
1513

14+
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.
1615

1716
## -property-value
18-
A member of the [DataPackageOperation](../windows.applicationmodel.datatransfer/datapackageoperation.md) enumeration that specifies which operations are allowed by the originator of the drag event.
17+
18+
A value or bitwise combination of values that specifies which operations can be accepted by the target of the drag event.
1919

2020
## -remarks
2121

22+
This value is set in the [DragEnter](uielement_dragenter.md) or [DragOver](uielement_dragover.md) 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](../windows.applicationmodel.datatransfer/datapackage.md) that is being dragged.
23+
24+
For more info about data operations, see the [DataPackageOperation](../windows.applicationmodel.datatransfer/datapackageoperation.md) enumeration.
25+
2226
## -examples
2327

28+
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`.
29+
30+
```csharp
31+
private void TargetListView_DragOver(object sender, DragEventArgs e)
32+
{
33+
// The list accepts only text.
34+
e.AcceptedOperation =
35+
(e.DataView.Contains(StandardDataFormats.Text))
36+
? DataPackageOperation.Copy : DataPackageOperation.None;
37+
}
38+
```
39+
2440
## -see-also
2541

2642
[Drag-and-drop overview](/windows/uwp/design/input/drag-and-drop)

windows.ui.xaml/drageventargs_allowedoperations.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,21 @@ public Windows.ApplicationModel.DataTransfer.DataPackageOperation AllowedOperati
1010
# Windows.UI.Xaml.DragEventArgs.AllowedOperations
1111

1212
## -description
13-
Gets the allowed data package operations (none, move, copy, and/or link) for the drag and drop operation.
14-
1513

14+
Gets a value that specifies which operations (none, move, copy, and/or link) are allowed by the source of the drag event.
1615

1716
## -property-value
18-
The allowed data operations.
17+
18+
A value or bitwise combination of values that specifies which operations are allowed by the source of the drag event.
1919

2020
## -remarks
21-
For more info about the allowed data operations, see [DataPackageOperation](../windows.applicationmodel.datatransfer/datapackageoperation.md).
2221

23-
This value is set in the [DragStarting](uielement_dragstarting.md) event handler. See the DragStartingEventArgs.AllowedOperations property.
22+
This value is set in the [UIElement.DragStarting](uielement_dragstarting.md) event handler via the [DragStartingEventArgs.AllowedOperations](dragstartingeventargs_allowedoperations.md) property. It can then be read from this property in the [DragEnter](uielement_dragenter.md) and [DragOver](uielement_dragover.md) events of the `UIElement` that is a potential drop target of the drag and drop operation. It notifies the target which data package operations (none, move, copy, and/or link) are allowed by the source.
23+
24+
For more info about the allowed data operations, see the [DataPackageOperation](../windows.applicationmodel.datatransfer/datapackageoperation.md) enumeration.
2425

2526
## -examples
2627

2728
## -see-also
29+
2830
[Drag-and-drop overview](/windows/uwp/design/input/drag-and-drop), [DragStarting](uielement_dragstarting.md), DragStartingEventArgs.AllowedOperations, [CoreDragOperation.AllowedOperations](../windows.applicationmodel.datatransfer.dragdrop.core/coredragoperation_allowedoperations.md)

windows.ui.xaml/dragstartingeventargs_allowedoperations.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,18 @@ public Windows.ApplicationModel.DataTransfer.DataPackageOperation AllowedOperati
1010
# Windows.UI.Xaml.DragStartingEventArgs.AllowedOperations
1111

1212
## -description
13-
Gets or sets the allowed data package operations (none, move, copy, and/or link) for the drag and drop operation.
14-
1513

14+
Gets or sets a value that specifies which operations (none, move, copy, and/or link) are allowed by the source of the drag event.
1615

1716
## -property-value
18-
The allowed data operations.
17+
18+
A value or bitwise combination of values that specifies which operations are allowed by the source of the drag event.
1919

2020
## -remarks
21-
For more info about the allowed data operations, see [DataPackageOperation](../windows.applicationmodel.datatransfer/datapackageoperation.md).
21+
22+
This value is set in the [UIElement.DragStarting](uielement_dragstarting.md) event handler. It can then be read from the [DragEventArgs.AllowedOperations](drageventargs_allowedoperations.md) property in the [DragEnter](uielement_dragenter.md) and [DragOver](uielement_dragover.md) events of the `UIElement` that is a potential drop target of the drag and drop operation. It notifies the target which data package operations (none, move, copy, and/or link) are allowed by the source.
23+
24+
For more info about the allowed data operations, see the [DataPackageOperation](../windows.applicationmodel.datatransfer/datapackageoperation.md) enumeration.
2225

2326
## -examples
2427

0 commit comments

Comments
 (0)