windowsforms-devexpress-dot-xtrascheduler-dot-schedulercontrol-c86014bb.md
Occurs before the Edit Appointment dialog window is invoked.
Namespace : DevExpress.XtraScheduler
Assembly : DevExpress.XtraScheduler.v25.2.dll
NuGet Package : DevExpress.Win.Scheduler
public event AppointmentFormEventHandler EditAppointmentFormShowing
Public Event EditAppointmentFormShowing As AppointmentFormEventHandler
The EditAppointmentFormShowing event's data class is AppointmentFormEventArgs. The following properties provide information specific to this event:
| Property | Description |
|---|---|
| Appointment | Gets the appointment for which the dialog will be shown. |
| CommandSourceType | Indicates the mechanism of the command input, e.g. keyboard, mouse, menu. |
| DialogResult | Gets or sets the return value of a dialog box. Inherited from ShowFormEventArgs. |
| Handled | Gets or sets whether an event was handled, if it was handled the default actions are not required. Inherited from ShowFormEventArgs. |
| OpenRecurrenceForm | Gets a value indicating whether the Appointment Recurrence form is displayed on the top of the Edit Appointment form. |
| Parent | Gets or sets a parent of the form being shown. Inherited from ShowFormEventArgs. |
| ReadOnly | Gets a value indicating whether an appointment is read-only. |
Handle the EditAppointmentFormShowing event to perform any actions prior to the Edit Appointment dialog being shown. For instance, a custom dialog can be substituted in place of the standard one.
This dialog can be invoked either by an end-user, or via the SchedulerControl.ShowEditAppointmentForm method. Note that the appointment which will be edited in this dialog window can be specified via the AppointmentFormEventArgs.Appointment property.
To learn how to create a custom appointment editing form, review the Getting Started document.
The following example demonstrates how to substitute the standard Edit Appointment dialog window with a custom form. Handle the SchedulerControl.EditAppointmentFormShowing event (which occurs before the Edit Appointment dialog window is invoked) and show your own custom form. Set the ShowFormEventArgs.Handled property to true , to prevent the standard form from displaying.
private void schedulerControl1_EditAppointmentFormShowing(object sender, AppointmentFormEventArgs e)
{
MyAppointmentForm form = new MyAppointmentForm(sender as SchedulerControl, e.Appointment, e.OpenRecurrenceForm);
try
{
e.DialogResult = form.ShowDialog();
e.Handled = true;
}
finally
{
form.Dispose();
}
}
Private Sub schedulerControl1_EditAppointmentFormShowing(ByVal sender As Object, ByVal e As AppointmentFormEventArgs) Handles schedulerControl1.EditAppointmentFormShowing
Dim form As New MyAppointmentForm(TryCast(sender, SchedulerControl), e.Appointment, e.OpenRecurrenceForm)
Try
e.DialogResult = form.ShowDialog()
e.Handled = True
Finally
form.Dispose()
End Try
End Sub
The following code snippets (auto-collected from DevExpress Examples) contain references to the EditAppointmentFormShowing 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.
winforms-scheduler-create-appointments-on-reminder-alert/CS/ReminderCustomActions/Form1.cs#L16
// Subscribe to invoke a custom form.
schedulerControl1.EditAppointmentFormShowing += SchedulerControl1_EditAppointmentFormShowing;
// Subscribe to hide reminder icons for occurrences in the past.
winforms-scheduler-custom-recurrence-form/CS/CustomRecurrenceFormDescendantSample/Form1.cs#L12
this.schedulerControl1.EditAppointmentFormShowing += schedulerControl1_EditAppointmentFormShowing;
this.Shown += Form1_Shown;
winforms-scheduler-create-appointments-on-reminder-alert/VB/ReminderCustomActions/Form1.vb#L18
' Subscribe to invoke a custom form.
AddHandler schedulerControl1.EditAppointmentFormShowing, AddressOf SchedulerControl1_EditAppointmentFormShowing
' Subscribe to hide reminder icons for occurrences in the past.
winforms-scheduler-custom-recurrence-form/VB/CustomRecurrenceFormDescendantSample/Form1.vb#L11
InitializeComponent()
AddHandler schedulerControl1.EditAppointmentFormShowing, AddressOf schedulerControl1_EditAppointmentFormShowing
AddHandler Shown, AddressOf Form1_Shown
See Also