SchedulerControl.AppointmentDrop Event


Use the DropAppointment event instead (BC4918).

Occurs when an appointment is dropped onto the SchedulerControl.

Namespace: DevExpress.Xpf.Scheduling

Assembly: DevExpress.Xpf.Scheduling.v21.2.dll


[Obsolete("Use the SchedulerControl.DropAppointment event instead (BC4918).", false)]
public event AppointmentItemDragDropEventHandler AppointmentDrop

Event Data

The AppointmentDrop event's data class is AppointmentItemDragDropEventArgs. The following properties provide information specific to this event:

Property Description
Allow Specifies whether the appointment can be dragged or dropped along the time cells.
CopyEffect Indicates whether the appointment is copied when drag-and-dropping it to another location.
HitInterval Gets the datetime range represented by the time cell to which an appointment is dragged.
HitResource Indicates the resource to which an appointment is dragged.
IsExternalDragDrop Indicates whether the appointment is dragged-and-dropped from the external component.
ViewModels Provides access to the list of View Models for dragged appointments.


You can cancel the drag-and-drop operation by setting the AppointmentItemDragDropEventArgs.Allow property to false in the event handler.

The original appointment (before dragging) is accessible using the AppointmentEditViewModelBase.Appointment property of the AppointmentDragResizeViewModel object contained in the AppointmentItemDragDropEventArgs.ViewModels collection.

You have access to the time interval where the appointment was dropped (AppointmentItemDragDropEventArgs.HitInterval) and the resource associated with a new appointment location (AppointmentItemDragDropEventArgs.HitResource).


This code snippet handles the SchedulerControl.AppointmentDrop event and determines whether the AppointmentDragResizeViewModel.Start property of the first appointment model in the collection of dragged appointments equals the SchedulerItemBase.Start property of the original appointment, available using the AppointmentEditViewModelBase.Appointment property. If this condition is met, a drop operation is allowed.

This restriction applies only to appointments with the “FixedTime” custom field value set to true.

Visually, appointments can only move between resources, preserving their Start and End times.

View Example

public void OnAppointmentDrop(DevExpress.Xpf.Scheduling.AppointmentItemDragDropEventArgs e)
    AppointmentDragResizeViewModel draggedViewModel = e.ViewModels.First() as AppointmentDragResizeViewModel;
    if (draggedViewModel.CustomFields["FixedTime"] != null)
        if ((bool)draggedViewModel.CustomFields["FixedTime"] &&
            (draggedViewModel.Start != draggedViewModel.Appointment.Start))
            e.Allow = false;
See Also