ISchedulerStorageBase.AppointmentInserting Event
Allows you to cancel the insertion of an appointment.
Namespace: DevExpress.XtraScheduler
Assembly: DevExpress.XtraScheduler.v24.1.Core.dll
NuGet Package: DevExpress.Scheduler.Core
Declaration
Event Data
The AppointmentInserting event's data class is PersistentObjectCancelEventArgs. The following properties provide information specific to this event:
Property | Description |
---|---|
Cancel | Gets or sets whether to cancel the operation. |
Object | Gets the persistent object (appointment, resource or appointment dependency) for which the event occurs. Inherited from PersistentObjectEventArgs. |
Remarks
The AppointmentInserting event is raised before an appointment is added to the AppointmentBaseCollection collection and allows you to cancel the operation. The event parameter’s PersistentObjectEventArgs.Object property gets the appointment being inserted. To cancel insertion, set the PersistentObjectCancelEventArgs.Cancel property to true.
Note
Do not modify the appointment’s data source or data binding within this event handler. It results in the current appointment being disposed of, and consequently, an unhandled exception occurs.
Note
The SchedulerStorageBase.AppointmentsInserted event is raised after the SchedulerStorageBase.AppointmentInserting event, when appointments are already in the storage and are saved to the external data source (if any). At the moment, you cannot prevent them from being saved.
To validate appointment insertion, you can get properties of the appointment being inserted by casting the e.Object parameter to the Appointment type.
Tip
To initialize a new appointment you can also use the SchedulerControl.InitNewAppointment event.