Skip to main content

SchedulerDataStorage.FilterAppointment Event

Hides specific appointments in the Scheduler control.

Namespace: DevExpress.XtraScheduler

Assembly: DevExpress.XtraScheduler.v24.1.dll

NuGet Package: DevExpress.Win.Scheduler

Declaration

public event PersistentObjectCancelEventHandler FilterAppointment

Event Data

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

Property Description
Cancel Gets or sets whether to cancel the operation.
Object Gets the persistent object (appointment, resource or appointment dependency) for which the event occurs. Inherited from PersistentObjectEventArgs.

Remarks

Handle the FilterAppointment event to hide specific appointments in the Scheduler control. This event fires each time when the layout of the Scheduler control changes (on resizing the control, adding a new appointment, modifying existing appointments, etc.) You can also force the layout update by calling the SchedulerViewBase.LayoutChanged method.

The FilterAppointment event occurs for each appointment in the Appointments storage, in turn. If the PersistentObjectCancelEventArgs.Cancel parameter is set to true for the currently processed appointment, then the Scheduler control does not display this appointment.

Important

Subscribe to the FilterAppointment event before storage initialization (before the PersistentObjectStorage<T>.DataSource is assigned), otherwise the filter is not applied and the SchedulerDataStorage.RefreshData method call is required for proper operation.

This event allows you to specify appointments for display. Do not modify appointment properties, and do not add or remove appointments within this event handler. An attempt to do so may result in an unhandled exception.

Example

The following example demonstrates how to filter the appointments shown within a Scheduler Control according to some condition. For this the SchedulerDataStorage.FilterAppointment event is used. The code below demonstrates how to hide all tentative appointments (those whose status is set to AppointmentStatusType.Tentative).

using DevExpress.XtraScheduler;
// ...

private void schedulerDataStorage1_FilterAppointment(object sender, PersistentObjectCancelEventArgs e) {
   // Filter all tentative appointments.
   e.Cancel = ((Appointment)e.Object).StatusId == 1;
}
See Also