Drag and Drop Appointments
- 3 minutes to read
Drag and Drop Events
Starting with v19.1, the SchedulerControl provides events that allow you to control drag and drop operations at all stages. The image below illustrates the drag-drop event flow.
The SchedulerControl.StartAppointmentDrag event occurs when the user starts dragging selected Scheduler appointments. The following three events are fired repeatedly while the user drags appointments within a Scheduler’s view:
- SchedulerControl.QueryContinueAppointmentDrag - allows you to cancel the drag-drop operation.
- SchedulerControl.DragAppointmentOver - allows you to implement a custom dragging behavior.
- SchedulerControl.GiveAppointmentDragFeedback - allows you to specify the feedback, e.g., change the cursor type.
Setting the SchedulerControl.QueryContinueAppointmentDrag‘s Action property to Drop raises the SchedulerControl.DropAppointment event, which allows you to customize the drop behavior.
If the SchedulerControl.QueryContinueAppointmentDrag‘s Action property is set to Cancel, the SchedulerControl.DropAppointment event is skipped.
The SchedulerControl.CompleteAppointmentDragDrop event occurs when a drag-drop operation initialized within the Scheduler has been completed.
When the user initiates dragging from outside the Scheduler, the SchedulerControl.StartAppointmentDrag event does not fire. The StartAppointmentDragFromOutside event occurs instead. Only the SchedulerControl.DragAppointmentOver event is raised repeatedly while the user drags appointments within a view. The SchedulerControl.CompleteAppointmentDragDrop event does not fire in this scenario.
Tip
The SchedulerControl.AppointmentDrag and SchedulerControl.AppointmentDrop events are obsolete. If you try to simultaneously handle any of these two events and the events listed above, the SchedulerControl throws an exception.
Restricting Drag and Drop Operations
The Scheduler control provides options and events that allow you to control drag-and-drop operations.
Property | Description |
---|---|
SchedulerControl.AllowAppointmentDrag | Controls the end-user’s capability to drag and drop appointments to another location (time slot or date). You can override this global behavior by handling the SchedulerControl.CustomAllowAppointmentDrag event. |
SchedulerControl.AllowAppointmentDragBetweenResources | Allows you to restrict dragging appointments to another resource area only. |
SchedulerControl.AllowAppointmentConflicts | Allows you to restrict dragging appointments to the time interval another appointment occupies. |
SchedulerControl.AppointmentDragMode | Specifies how an appointment fits in the time cell(s) when dragged to another time interval. |
SchedulerControl.KeepResourceDistanceOnAppointmentDrag | Specifies whether the scheduler puts all dragged appointments into the same target resource or tries to keep their original distribution. |
SchedulerControl.ScrollOnDrag | Specifies whether the user can scroll the scheduler’s view area by dragging an appointment to the viewport’s border. |
The SchedulerControl.CustomAllowAppointmentDrag event fires when the end-user attempts to drag the appointment to another time interval. Use this event to specify a particular case when the end-user can drag an appointment. If you do not specify the behavior manually, the SchedulerControl.AllowAppointmentDrag property manages whether end-users can drag appointments.
The SchedulerControl.CustomAllowAppointmentDragBetweenResources event fires when the end-user attempts to drag the appointment. Use this event to specify a particular case when the end-user can drag an appointment to another resource area. If you do not specify the behavior manually, the SchedulerControl.AllowAppointmentDragBetweenResources property manages whether end-users can drag appointments.