SchedulerControl.StartAppointmentDragFromOutside Event

Occurs when the user drags an object in the Scheduler from an external source.

Namespace: DevExpress.Xpf.Scheduling

Assembly: DevExpress.Xpf.Scheduling.v20.1.dll

Declaration

public event StartAppointmentDragFromOutsideEventHandler StartAppointmentDragFromOutside
Public Event StartAppointmentDragFromOutside As StartAppointmentDragFromOutsideEventHandler

Event Data

The StartAppointmentDragFromOutside event's data class is DevExpress.Xpf.Scheduling.StartAppointmentDragFromOutsideEventArgs.

Remarks

The CompleteAppointmentDragDrop event does not fire if the drag-drop operation has been initialized outside the Scheduler.

The example below illustrates how to implement drag-drop from a text editor and GridControl.

 private void Scheduler_StartAppointmentDragFromOutside(object sender,
  StartAppointmentDragFromOutsideEventArgs e) {

  // if the user is dragging GridControl data
  if (e.Data.GetDataPresent(typeof(RecordDragDropData))) {
    var rddData = (RecordDragDropData) e.Data.GetData(typeof(RecordDragDropData));
    foreach (var appData in rddData.Records.Cast<AppointmentData>()) {
      var appointment = new AppointmentItem {
        Subject = appData.Subject,
        Location = appData.Location
      };
      appointment.End = appointment.Start + appData.Length;
      e.DragAppointments.Add(appointment);
    }
  }

  // if the user is dragging text
  if (e.Data.GetDataPresent(typeof(string))) {
    var subject = (string) e.Data.GetData(typeof(string));
    var appointment = new AppointmentItem { Subject = subject };
    e.DragAppointments.Add(appointment);
  }
}
See Also