TreeView.DragItemsStarting Event

Definition

Occurs when a drag operation that involves one of the items in the view is initiated.

Equivalent WinUI 2 API for UWP: Microsoft.UI.Xaml.Controls.TreeView.DragItemsStarting (for WinUI in the Windows App SDK, see the Windows App SDK namespaces).

C#
public event TypedEventHandler<TreeView,TreeViewDragItemsStartingEventArgs> DragItemsStarting;
XAML
<TreeView DragItemsStarting="eventhandler"/>

Event Type

Windows requirements

Device family
Windows 10, version 1809 (introduced in 10.0.17763.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v7.0)

Remarks

To receive this event, set the CanDragItems property to true.

This event occurs when you start a drag-and-drop operation, including when you perform a reorder operation by drag-and-drop. When you perform custom actions as a result of a drag-and-drop operation, you typically listen to this event and provide more data using the TreeViewDragItemsStartingEventArgs.Data property.

You can inspect the items being dragged by checking the TreeViewDragItemsStartingEventArgs.Items property.

You can cancel the drag operation by setting the TreeViewDragItemsStartingEventArgs.Cancel property to true.

Applies to

Product Versions
WinRT Build 17763, Build 18362, Build 19041, Build 20348, Build 22000, Build 22621, Build 26100

See also