Skip to main content

SchedulerControl.InitNewAppointment Event

Occurs before a new appointment is created in the scheduler control.

Namespace: DevExpress.Xpf.Scheduler

Assembly: DevExpress.Xpf.Scheduler.v14.2.dll

#Declaration

public event AppointmentEventHandler InitNewAppointment

#Event Data

The InitNewAppointment event's handler receives an argument of the AppointmentEventArgs type. The following properties provide information specific to this event:

Property Description
Appointment Gets the appointment for which the event was raised.

#Remarks

Use the InitNewAppointment event to change the default values of the Appointment properties every time a new appointment is created in the SchedulerControl by an end-user (for instance, when an end-user clicks the New Appointment item of the context menu, or uses the in-place editor).

#Examples

This example demonstrates how to use the SchedulerControl.InitNewAppointment event, which occurs in all cases before a new appointment is created. This event is useful, for example, when it is necessary to initialize the newly created appointments with values other than the standard defaults.

The following code changes the all-day option for the newly created appointments to true, sets its label to Important and location - to "New office".

using DevExpress.XtraScheduler;
// ...

private void schedulerControl1_InitNewAppointment(object sender, AppointmentEventArgs e) {
   // Make the appointment all-day.
   e.Appointment.AllDay = true;

   // Set its label to "important".
   e.Appointment.LabelId = 1;

   // Set its location.
   e.Appointment.Location = "New office";
}
See Also