All docs
V20.2
20.2
20.1
The page you are viewing does not exist in version 20.1. This link will take you to the root page.
19.2
The page you are viewing does not exist in version 19.2. This link will take you to the root page.
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.

SchedulerControl.AppointmentsDrag Event

The resulting event that fires after the last AppointmentDrag event. Allows you to schedule appointments added to the AdditionalAppointments collection, and perform other actions.

Namespace: DevExpress.XtraScheduler

Assembly: DevExpress.XtraScheduler.v20.2.dll

Declaration

public event EventHandler<AppointmentsDragEventArgs> AppointmentsDrag
Public Event AppointmentsDrag As EventHandler(Of AppointmentsDragEventArgs)

Event Data

The AppointmentsDrag event's data class is DevExpress.XtraScheduler.AppointmentsDragEventArgs.

Remarks

In the sample below, if a user is about to schedule the "Start" appointment so that it finishes later in time than the related "Finish" appointment starts, the latter appointment is added to the AdditionalAppointments collection of the AppointmentDrag event.

DevExpress Scheduler automatically reschedules an appointment when a user drags its related appointment

void SchedulerControl1_AppointmentDrag(object sender, AppointmentDragEventArgs e) {
    if (e.SourceAppointment.Subject == "Start") {
        AppointmentBaseCollection visbileApts = schedulerControl1.ActiveView.GetAppointments();
        Appointment apt = visbileApts.Find(item => item.Subject == "Finish");
        if (apt == null)
            e.AdditionalAppointments.Clear();
        else {
            if (e.SourceAppointment != apt) {
                if (e.EditedAppointment.End > apt.Start)
                    e.AdditionalAppointments.Add(apt);
                else e.AdditionalAppointments.Clear(); 
            }
        }
    }
}

New positions for AdditionalAppointments are set in the AppointmentsDrag event handler.

private void SchedulerControl1_AppointmentsDrag(object sender, DevExpress.XtraScheduler.AppointmentsDragEventArgs e) {
    if (e.AdditionalAppointmentInfos.Count <= 0)
        return;
    AppointmentDragInfo aptInfo = e.AdditionalAppointmentInfos[0];
    if (e.PrimaryAppointmentInfos[0].EditedAppointment.End > aptInfo.SourceAppointment.Start)
        aptInfo.EditedAppointment.Start = e.PrimaryAppointmentInfos[0].EditedAppointment.End;
}
See Also