Skip to main content

SchedulerControl.AppointmentAdding Event

Occurs when the user adds an appointment to the Scheduler.

Namespace: DevExpress.UI.Xaml.Scheduler

Assembly: DevExpress.UI.Xaml.Scheduler.v21.2.dll

NuGet Package: DevExpress.Uwp.Controls

Declaration

public event EventHandler<AppointmentAddingEventArgs> AppointmentAdding

Event Data

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

Property
Appointments
Calendar
EventSource

Remarks

The AppointmentAdding is a deferred event. You can process the event in a synchronous mode pausing the SchedulerControl. For example, it can be useful if you want to prompt the user to save changes.

To pause the SchedulerControl, use the event’s GetDeferral method. It returns an EventDeferral object. To resume the SchedulerControl’s processing, call the EventDeferral.Complete method.

Important

If you don’t call the EventDeferral.Complete method after calling the GetDeferral method, the SchedulerControl’s processing never resumes.

The example below illustrates how to use the EventDeferral to prompt the user to save changes.

 private async void  Scheduler_AppointmentAdding(object sender, DevExpress.UI.Xaml.Scheduler.AppointmentAddingEventArgs e) {
    var deferral = e.GetDeferral();
    var dialog = new MessageDialog("Do you want to add a new Appointment?", "Confirmation");
    dialog.Commands.Add(new Windows.UI.Popups.UICommand { Label = "Yes", Id = 0 });
    dialog.Commands.Add(new Windows.UI.Popups.UICommand { Label = "No", Id = 1 });
    var res = await dialog.ShowAsync();

    e.Cancel = (int)res.Id == 1;
    deferral.Complete();
}
See Also