SchedulerControl.AppointmentDrag Event

Obsolete. Occurs when an appointment is dragged above the SchedulerControl.

Namespace: DevExpress.Xpf.Scheduling

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

Declaration

[Browsable(false)]
[Obsolete("Use the SchedulerControl.DragAppointmentOver event instead (BC4918).", false)]
public event AppointmentItemDragDropEventHandler AppointmentDrag
<Browsable(False)>
<Obsolete("Use the SchedulerControl.DragAppointmentOver event instead (BC4918).", False)>
Public Event AppointmentDrag As AppointmentItemDragDropEventHandler

Event Data

The AppointmentDrag 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.

Remarks

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.

Examples

This code handles the SchedulerControl.AppointmentDrag event and cancels the drag operation if there is more than one dragged appointment.

A AppointmentDragResizeViewModel view model is created for each dragged appointment, the models are accessible using the AppointmentItemDragDropEventArgs.ViewModels property.

public void OnAppointmentDrag(DevExpress.Xpf.Scheduling.AppointmentItemDragDropEventArgs e)
{
    if (e.ViewModels.Count > 1)
        e.Allow = false;
}
See Also