SchedulerControl.InitNewAppointment Event

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

Namespace: DevExpress.Xpf.Scheduler

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

Declaration

public event AppointmentEventHandler InitNewAppointment
Public Event InitNewAppointment As AppointmentEventHandler

Event Data

The InitNewAppointment event's data class is AppointmentEventArgs. The following properties provide information specific to this event:

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

Remarks

IMPORTANT

You are viewing documentation for the legacy WPF Scheduler control. If you're starting a new project, we strongly recommend that you use a new control declared in the DevExpress.Xpf.Scheduling namespace. If you decide to upgrade an existing project in order to switch to the updated scheduler control, see the Migration Guidelines document.

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 instance, 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.LabelKey = 1;

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