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.v20.2.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 appointment for which the edit form is shown.
Cancel Specifies whether to show the form or this action should be canceled.
FormInfo Specifies the appointment form’s information.
FormType Specifies the appointment form type.

Remarks

This event is raised before the detailed (pop-up) or compact appointment form is shown. Use the event argument’s FormType property to identify which form is used. You can set the 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 event’s argument’s 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