SchedulerControl.InitNewAppointment Event
Occurs before a new appointment is created in the Scheduler.
Namespace: DevExpress.XtraScheduler
Assembly: DevExpress.XtraScheduler.v19.2.dll
Declaration
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
Use this event to change the default values of the Appointment properties every time the appoointment is created in the SchedulerControl control 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).
Example
This example demonstrates how to use the SchedulerControl.InitNewAppointment
event, which occurs in all cases before a new appointment is created. This event can be used to initialize a newly created appointment with values other than the default.
Note
A complete sample project is available at https://github.com/DevExpress-Examples/how-to-use-custom-appointment-fields-in-a-custom-editing-form-e2782
private void schedulerControl1_InitNewAppointment(object sender, DevExpress.XtraScheduler.AppointmentEventArgs e)
{
e.Appointment.Description += "Created at runtime at " + String.Format("{0:g}", DateTime.Now);
e.Appointment.CustomFields["Amount"] = 00.01d;
e.Appointment.CustomFields["ContactInfo"] = "someone@somecompany.com";
}
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the InitNewAppointment event.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.