# Get Old and New Parent of a Task after Reordering via Drag and Drop

## Environment

<table>
    <tbody>
	    <tr>
	    	<th scope="row">Product Version</th>
	    	<td>2019.1 318</td>
	    </tr>
	    <tr>
	    	<th scope="row">Product</th>
	    	<td>RadGanttView for WPF</td>
	    </tr>
    </tbody>
</table>

## Description

How to acquire the old and new parent of a task after reorder via drag and drop.

## Solution

For the purpose you can define a [custom GanttDragDropBehavior](https://www.telerik.com/products/wpf/documentation/controls/radganttview/features/drag-and-drop/dragdrop-custom-behaviors) and override its **Drop** method as follows:

```C#
  	protected override void Drop(SchedulingDragDropState state)
  	{
		var task = state.DraggedItem as GanttTask;
		var item = this.Gantt.ExpandCollapseService.HierarchicalCollectionAdapter.GetItemWrapperByItemKey(task);
		var previousParent = item.Parent;
		base.Drop(state);
		var newItem = this.Gantt.ExpandCollapseService.HierarchicalCollectionAdapter.GetItemWrapperByItemKey(task);
		var newParent = newItem.Parent;
  	}
```

## See Also

* [Custom GanttDragDropBehavior](https://www.telerik.com/products/wpf/documentation/controls/radganttview/features/drag-and-drop/dragdrop-custom-behaviors)
