SchedulerControl.AppointmentDrop Event
Occurs when an appointment is dropped onto the SchedulerControl.
Namespace: DevExpress.Xpf.Scheduler
Assembly: DevExpress.Xpf.Scheduler.v14.2.dll
#Declaration
#Event Data
The AppointmentDrop event's handler receives an argument of the AppointmentDragEventArgs type. The following properties provide information specific to this event:
Property | Description |
---|---|
Allow | Specifies whether the appointment can be dragged along the time cells. |
Edited |
Gets the appointment being edited in the drag-and-drop event. |
Force |
Gets or sets whether the View is forced to query appointments from the storage. |
Handled | Gets or sets whether the drag-and-drop operation is handled, and therefore no default processing is required. |
Hit |
Gets the time interval represented by the time cell to which an appointment was dragged. |
Hit |
Gets the resource to which an appointment was dragged. |
New |
Gets or sets the IDs of resources for a new appointment. |
Source |
Gets the source appointment in the drag-and-drop event. |
#Remarks
Use the AppointmentDrop event to manage, with the drag-and-drop action, appointments within the scheduler. Information, which is provided by the event's argument properties, allows you to deny, cancel or handle specifically the event.
For instance, you have access to the appointment before dragging (the AppointmentDragEventArgs.SourceAppointment property), to the time interval where the appointment was dropped (the AppointmentDragEventArgs.HitInterval property), to the resource associated with a new appointment location (the AppointmentDragEventArgs.HitResource property). The AppointmentDragEventArgs.NewAppointmentResourceIds property can be used for assignment of resources to a relocated appointment.
#Examples
The following code snippet illustrates how to specify resources to be associated with the AppointmentDragEventArgs.EditedAppointment in the SchedulerControl.AppointmentDrop event. Handle this event and assign the second and fifth resources to the relocated appointment.
using DevExpress.XtraScheduler;
// ...
private void schedulerControl1_AppointmentDrop(object sender, AppointmentDragEventArgs e) {
ResourceIdCollection rid = new ResourceIdCollection();
rid.AddRange(new object[] { this.schedulerControl1.Storage.ResourceStorage[2].Id,
this.schedulerControl1.Storage.ResourceStorage[5].Id });
e.NewAppointmentResourceIds = rid;
e.Handled = true;
}