This is a migrated thread and some comments may be shown as answers.

Drag and Drop

1 Answer 81 Views
GanttView
This is a migrated thread and some comments may be shown as answers.
Rahul
Top achievements
Rank 1
Rahul asked on 24 Apr 2013, 07:58 AM
Dear Telerik,

We are using 2013Q1 version of GanttView as per online documentation i have implemented drag and drop functionality

On xaml inside RadGanttView

<telerik:RadGanttView.DragDropBehavior>

<custom:CustomDragDropBehavior />

</telerik:RadGanttView.DragDropBehavior>

In My Code-Bind

public class CustomDragDropBehavior : Telerik.Windows.Controls.GanttView.GanttDragDropBehavior

{

protected override void Drop(SchedulingDragDropState state)

{

 

 

var task = state.DraggedItem as TabsGanttTask;

}


}

When i drag and drop my task i m not getting update start date time and end date time from above code.

Could you please advise how to achieve the same.



1 Answer, 1 is accepted

Sort by
0
Vladi
Telerik team
answered on 26 Apr 2013, 01:16 PM
Hello,

When creating custom GanttDragDropBehavior in order to get the new Start and End values you should use the state.DestinationSlot property in the method or call the base Drop() method first and then access them from the updated state.DraggedItem. This is an expected behavior because the base Drop() method sets the new values to the Task.

The next code snippet shows how to get the new and old Start and End times in the Drop() method with both approaches:
protected override void Drop(Telerik.Windows.Controls.Scheduling.SchedulingDragDropState state)
{
    base.Drop(state);
  
    var task = state.DraggedItem as GanttTask;
    var newStart = (DateTime)task.Start;
    var newEnd = (DateTime)task.End;
}

or
protected override void Drop(Telerik.Windows.Controls.Scheduling.SchedulingDragDropState state)
{
    var slot = state.DestinationSlot;
    var newStart = (DateTime)slot.Start;
    var newEnd = (DateTime)slot.End;
 
    base.Drop(state);
}

Hope this is helpful.

Greetings,
Vladi
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
GanttView
Asked by
Rahul
Top achievements
Rank 1
Answers by
Vladi
Telerik team
Share this question
or