Skip to main content

SchedulerControl.AllowAppointmentConflicts Event

Occurs when the scheduler finds appointments that are in conflict, and the OptionsCustomization.AllowAppointmentConflicts property is set to Custom.

Namespace: DevExpress.Xpf.Scheduler

Assembly: DevExpress.Xpf.Scheduler.v24.1.dll

NuGet Package: DevExpress.Wpf.Scheduler

Declaration

public event AppointmentConflictEventHandler AllowAppointmentConflicts

Event Data

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

Property Description
Appointment Gets the appointment for which the event was raised. Inherited from AppointmentEventArgs.
AppointmentClone Gets the clone of the appointment being processed in the SchedulerControl.AllowAppointmentConflicts or the SchedulerControl.AllowAppointmentConflicts events.
Conflicts Gets the collection of appointments which are considered to be conflicting with the current appointment.
Interval Gets the time interval which the event was raised for.

The event data class exposes the following methods:

Method Description
RemoveConflictsWithDifferentResource(AppointmentBaseCollection, Object) Removes all the conflicting appointments from the specified collection whose Appointment.ResourceId doesn’t match the specified Id.

Remarks

Important

You are viewing documentation for the legacy WPF Scheduler control. If you’re starting a new project, we strongly recommend that you use a new control declared in the DevExpress.Xpf.Scheduling namespace. If you decide to upgrade an existing project in order to switch to the updated scheduler control, see the Migration Guidelines document.

Handle the AllowAppointmentConflicts event to manually decide whether the current appointment conflicts with any other appointments. The appointment’s copy to be checked can be accessed via the AppointmentEventArgs.Appointment property.

Note

The AllowAppointmentConflicts event is fired only if the OptionsCustomization.AllowAppointmentConflicts property is set to AppointmentConflictsMode.Custom.

This event’s arguments provide the AppointmentConflictEventArgs.Conflicts property, which returns the collection of appointments that are considered to be conflicting by the SchedulerControl. All these appointments conflict with the current appointment, since their time intervals intersect and they are assigned the same resource. If the Conflicts collection is empty, this means that there are no conflicting appointments.

The AppointmentConflictEventArgs.AppointmentClone property contains an appointment modified due to an end-user’s action. This is the appointment that intersects with existing ones. The Appointment property provides access to the current appointment before modification. So, when an appointment is dragged, its clone may conflict with original appointment, and the Conflicts collection may contain one element - the original appointment.

Note

If you determine that the current appointment has no conflicts, you should clear the Conflicts collection in this event’s handler. If you determine that the current appointment has at least one conflict, then the Conflicts collection should contain at least one object that is different from the current appointment. The non-empty Conflicts collection cancels the user’s action that caused a conflict. The common practice is to clear the Conflicts collection at the beginning, and populate it with any appointment if the user’s action should be canceled. You can even create a fake appointment for this purpose and add it to the collection.

Note

The source appointment (accessed via the AppointmentEventArgs.Appointment property) or its copy isn’t considered to be conflicting if it’s present in the Conflicts collection. There should be other appointments in this collection, to indicate the conflict.

See Also