Back to Devexpress

SchedulerControl.InitNewAppointment Event

windowsforms-devexpress-dot-xtrascheduler-dot-schedulercontrol-6be13822.md

latest3.0 KB
Original Source

SchedulerControl.InitNewAppointment Event

Occurs before a new appointment is created in the Scheduler.

Namespace : DevExpress.XtraScheduler

Assembly : DevExpress.XtraScheduler.v25.2.dll

NuGet Package : DevExpress.Win.Scheduler

Declaration

csharp
public event AppointmentEventHandler InitNewAppointment
vb
Public Event InitNewAppointment As AppointmentEventHandler

Event Data

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

PropertyDescription
AppointmentGets the appointment for which the event was raised.

Remarks

Use this event to change default Appointment property values each time an end-user creates a new appointment in the SchedulerControl control (for instance, when an end-user clicks the New Appointment item within 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.

View Example

csharp
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"] = "[email protected]";
}
vb
Private Sub schedulerControl1_InitNewAppointment(ByVal sender As Object, ByVal e As DevExpress.XtraScheduler.AppointmentEventArgs) Handles schedulerControl1.InitNewAppointment
    e.Appointment.Description &= "Created at runtime at " & String.Format("{0:g}", Date.Now)
    e.Appointment.CustomFields("Amount") = 00.01R
    e.Appointment.CustomFields("ContactInfo") = "[email protected]"
End Sub

See Also

SchedulerControl Class

SchedulerControl Members

DevExpress.XtraScheduler Namespace