The event handler receives an argument of type AppointmentItemOperationEventArgs containing data related to this event.
The following
AppointmentItemOperationEventArgs properties provide information specific to this event.
Property |
Description |
Allow |
Gets or sets whether performing a particular action is allowed. |
Appointment |
Gets the appointment for which the element is raised. |
Recurring |
Gets whether the target appointment is recurring. |
Handle the CustomAllowAppointmentCreate event and sets its AppointmentItemOperationEventArgs.Allow property to manage a particular case and specify whether to allow an end-user to create a new appointment. If you do not specify the required behavior manually, the AllowAppointmentCreate manages whether creating new appointments is allowed.
The appointment to be created can be accessed using the AppointmentItemEventArgs.Appointment property.
Set the AppointmentItemOperationEventArgs.Allow property to false to prevent an appointment from being created.
Note
The SchedulerControl uses the System.Windows.Input.CommandManager class to manage commands executed by the ribbon or context menu items. The System.Windows.Input.CommandManager.RequerySuggested event is fired when any changes that can affect the command's ability to execute (e.g., change of focus) have been made. It notifies the command that is should raise the System.Windows.Input.ICommand.CanExecuteChanged event, which makes the CustomAllowAppointmentCreate event to fire as well. This chain of events can occur involuntarily, so make sure that the event handler does not contain any code that may slow the application performance.

Example
MainWindow.xaml.cs |
private void schedulerControl1_CustomAllowAppointmentCreate(object sender, AppointmentItemOperationEventArgs e)
{
DateTimeRange selectedIntervalRange = schedulerControl1.SelectedInterval;
TimeInterval selectedInterval = new TimeInterval(selectedIntervalRange.Start, selectedIntervalRange.End);
e.Allow = IsIntervalAllowed(selectedInterval);
}
|
MainWindow.xaml.vb |
Private Sub schedulerControl1_CustomAllowAppointmentCreate(ByVal sender As Object, ByVal e As AppointmentItemOperationEventArgs)
'Retrieve the selected interval:
Dim selectedIntervalRange As DateTimeRange = schedulerControl1.SelectedInterval
Dim selectedInterval As New TimeInterval(selectedIntervalRange.Start, selectedIntervalRange.End)
'Check whether the selected interval intersects with the resticted interval:
'If true, restrict appointment creation
e.Allow = IsIntervalAllowed(selectedInterval)
End Sub
|