New to Telerik UI for WPF? Download free 30-day trial

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

Environment

Product Version 2019.1 318
Product RadGanttView for WPF

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 and override its Drop method as follows:

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

In this article