# HandleDragAndDrop(DragAndDropArgs)

> Override this function to control the drag and drop behavior of the TreeView.

## Definition

* **Type:** Method
* **Namespace:** [UnityEditor.IMGUI.Controls](/engine/6000.5/script-reference/unityeditor/imgui/controls.md)
* **Assembly:** UnityEditor.CoreModule

```csharp
protected virtual DragAndDropVisualMode HandleDragAndDrop(TreeView<TIdentifier>.DragAndDropArgs args)
```

### Parameters

**** (\[DragAndDropArgs]\(/engine/6000.5/script-reference/unityeditor/imgui/controls/treeview1/draganddropargs)): Drag and drop arguments.

### Returns

| Type                                                                                          | Description |
| --------------------------------------------------------------------------------------------- | ----------- |
| [DragAndDropVisualMode](/engine/6000.5/script-reference/unityeditor/draganddropvisualmode.md) |             |

### Remarks

This function is called continously when a drag and drop operation is active and the cursor is over the TreeView. Note that the drag and drop operation can have been initiated outside the TreeView.

Use the state in [DragAndDrop](/engine/6000.5/script-reference/unityeditor/draganddrop.md) to determine the objects for the drag and drop. This function returns a [DragAndDropVisualMode](/engine/6000.5/script-reference/unityeditor/draganddropvisualmode.md) value that controls the cursor state.

You control TreeView drag and drop in the following order:\\

1. override [TreeView\<TIdentifier>.CanStartDrag](/engine/6000.5/script-reference/unityeditor/imgui/controls/treeview1/canstartdrag.md) to enable dragging TreeViewItems.\\

2. override [TreeView\<TIdentifier>.SetupDragAndDrop](/engine/6000.5/script-reference/unityeditor/imgui/controls/treeview1/setupdraganddrop.md) to set which TreeViewItems are dragged.\\

3. override [TreeView\<TIdentifier>.HandleDragAndDrop](/engine/6000.5/script-reference/unityeditor/imgui/controls/treeview1/handledraganddrop.md) to control the drag and drop behavior of the TreeView.\\
