Skip to main content
A newer version of this page is available. .

DxScheduler.AppointmentFormShowing Event

Fires before the appointment form is shown.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v23.1.dll

NuGet Package: DevExpress.Blazor

Declaration

[Parameter]
public EventCallback<SchedulerAppointmentFormEventArgs> AppointmentFormShowing { get; set; }

Event Data

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

Property Description
Appointment Specifies the target appointment. Inherited from SchedulerAppointmentOperationEventArgs.
Cancel Gets or sets a value indicating whether the event should be canceled. Inherited from CancelEventArgs.
FormInfo Specifies the appointment form information.
FormType Specifies the appointment form type.
Title Specifies the appointment form’s title.

Remarks

This event is raised before the extended or compact appointment form is shown. Use the event argument’s FormType property to identify which form is used. You can set the event argument’s Cancel property to true to not show the appointment form.

<DxScheduler StartDate="@DateTime.Today"
             DataStorage="@DataStorage"
             ActiveViewType="SchedulerViewType.WorkWeek"
             AppointmentFormShowing="OnAppointmentFormShowing">
    @*...*@
</DxScheduler>

@code {
    void OnAppointmentFormShowing(SchedulerAppointmentFormEventArgs args) {
        if (args.FormType == SchedulerAppointmentFormType.CompactEditForm) { 
            args.Cancel = true;
        }
    }
    // ...
}

Use the SchedulerAppointmentOperationEventArgs.Appointment property to access the appointment for which the form is displayed. The FormInfo property stores form settings.

If an appointment contains custom properties, you need to pass information about them to the edit form. Implement a SchedulerAppointmentFormInfo descendant and declare the corresponding properties in the class. Then, handle the AppointmentFormShowing event and assign a custom descendant instance to the event argument’s FormInfo property.

For more information, refer to the following help topic: Custom Appointment Form.

<DxScheduler StartDate="@DateTime.Today"
             DataStorage="@DataStorage"
             ActiveViewType="SchedulerViewType.WorkWeek"
             AppointmentFormShowing="OnAppointmentFormShowing">
    @*...*@
</DxScheduler>

@code {
    public class CustomAppointmentFormInfo : SchedulerAppointmentFormInfo {
        public CustomAppointmentFormInfo(DxSchedulerAppointmentItem AppointmentItem, DxSchedulerDataStorage DataStorage)
            : base(AppointmentItem, DataStorage) { }

        public bool IsAccepted {
            get { return (bool)CustomFields["IsAccepted"]; }
            set { CustomFields["IsAccepted"] = value; }
        }
    }

    void OnAppointmentFormShowing(SchedulerAppointmentFormEventArgs args) {
        args.FormInfo = new CustomAppointmentFormInfo(args.Appointment, DataStorage);
    }
}

The AppointmentFormClosing event is raised before the appointment form is closed.

See Also