Back to Devexpress

SchedulerControl.EditAppointmentFormShowing Event

windowsforms-devexpress-dot-xtrascheduler-dot-schedulercontrol-c86014bb.md

latest7.6 KB
Original Source

SchedulerControl.EditAppointmentFormShowing Event

Occurs before the Edit Appointment dialog window is invoked.

Namespace : DevExpress.XtraScheduler

Assembly : DevExpress.XtraScheduler.v25.2.dll

NuGet Package : DevExpress.Win.Scheduler

Declaration

csharp
public event AppointmentFormEventHandler EditAppointmentFormShowing
vb
Public Event EditAppointmentFormShowing As AppointmentFormEventHandler

Event Data

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

PropertyDescription
AppointmentGets the appointment for which the dialog will be shown.
CommandSourceTypeIndicates the mechanism of the command input, e.g. keyboard, mouse, menu.
DialogResultGets or sets the return value of a dialog box. Inherited from ShowFormEventArgs.
HandledGets or sets whether an event was handled, if it was handled the default actions are not required. Inherited from ShowFormEventArgs.
OpenRecurrenceFormGets a value indicating whether the Appointment Recurrence form is displayed on the top of the Edit Appointment form.
ParentGets or sets a parent of the form being shown. Inherited from ShowFormEventArgs.
ReadOnlyGets a value indicating whether an appointment is read-only.

Remarks

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.

Example

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.

View Example

csharp
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();
    }
}
vb
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

csharp
// 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

csharp
this.schedulerControl1.EditAppointmentFormShowing += schedulerControl1_EditAppointmentFormShowing;
this.Shown += Form1_Shown;

winforms-scheduler-create-appointments-on-reminder-alert/VB/ReminderCustomActions/Form1.vb#L18

vb
' 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

vb
InitializeComponent()
AddHandler schedulerControl1.EditAppointmentFormShowing, AddressOf schedulerControl1_EditAppointmentFormShowing
AddHandler Shown, AddressOf Form1_Shown

See Also

ShowEditAppointmentForm

InplaceEditorShowing

SchedulerControl Class

SchedulerControl Members

DevExpress.XtraScheduler Namespace