I have a timeline view scheduler grouped by Resources and would like to use the drag & drop service to move objects from my DataGridView to the scheduler. How do I determine the resource assigned to the cell that's my hit target (the cell I'm currently dropping into), so I can correctly set the ResourceID for the appointment I'm creating?
private void svc_PreviewDragDrop(object sender, RadDropEventArgs e)
{
SchedulerCellElement schedulerCell = e.HitTarget as SchedulerCellElement;
if (schedulerCell != null)
{
GridDataRowElement draggedRow = e.DragInstance as GridDataRowElement;
if (draggedRow != null)
{
if (draggedRow.Data.DataBoundItem != null)
{
MainJobObject draggedMainJobObject = (MainJobObject)draggedRow.Data.DataBoundItem;
AppointmentWithObject appointment = new AppointmentWithObject(schedulerCell.Date, schedulerCell.Date.AddHours(1), draggedMainJobObject.Customer, " / ", draggedMainJobObject.MachineType);
appointment.Start = schedulerCell.Date;
appointment.End = schedulerCell.Date.AddHours(1);
//appointment.ResourceId = -- I need the resource ID HERE
scheduler.Appointments.Add(appointment);
}
}
}
}
If it's not possible, I'd be happy with any trick or workaround that helps determining the resource that's assigned to the row the cell currently resides in - even determining the row number of the cell would help.