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

Get start and end datetime from GanttView PreviewDragStart

1 Answer 40 Views
GanttView
This is a migrated thread and some comments may be shown as answers.
Damon
Top achievements
Rank 1
Damon asked on 23 May 2016, 08:46 AM

//GanttView PreviewDragStart

private void DragDropService_PreviewDragStart(object sender, PreviewDragStartEventArgs e)
{

if (e.DragInstance is GanttViewTaskElement)
      {
        e.CanStart = true;  

//want to get start and end datetime
      }

}

From above event how can i get Start and End datetime from e.DragInstance

1 Answer, 1 is accepted

Sort by
0
Accepted
Dess | Tech Support Engineer, Principal
Telerik team
answered on 25 May 2016, 12:29 PM
Hello Damon,

Thank you for writing. 

You can find below a sample code snippet demonstrating how to access the start/end date of the dragged task element:
 
this.radGanttView1.GanttViewElement.DragDropService.PreviewDragStart += DragDropService_PreviewDragStart;
 
private void DragDropService_PreviewDragStart(object sender, Telerik.WinControls.PreviewDragStartEventArgs e)
{
    GanttViewTaskElement taskElement = e.DragInstance as GanttViewTaskElement;
    if (taskElement != null)
    {
        e.CanStart = true;
        GanttViewDataItem item = ((GanttViewTaskItemElement)taskElement.Parent).Data;
        Console.WriteLine("Start: " + item.Start + " End: " + item.End);
    }
}

I hope this information helps. Should you have further questions I would be glad to help.

Regards,
Dess
Telerik
Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms.For more information check out this blog post and share your thoughts.
Tags
GanttView
Asked by
Damon
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or