SchedulerStorage.FilterAppointment Event
Enables specific appointments to be hidden in the Scheduler Control.
Namespace: DevExpress.Xpf.Scheduler
Assembly: DevExpress.Xpf.Scheduler.v24.2.dll
NuGet Package: DevExpress.Wpf.Scheduler
Declaration
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
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.
You can handle the FilterAppointment event to hide specific appointments in the Scheduler control. This event fires each time the layout of the Scheduler control is modified (when the control is resized, when new appointments are added, or existing ones are modified, etc.). You can also force the layout to be updated by calling the SchedulerViewBase.LayoutChanged method.
The FilterAppointment event is raised for each appointment in the AppointmentStorage, in turn. If the PersistentObjectCancelEventArgs.Cancel parameter is set to true for the currently processed appointment, then this appointment will be hidden in the Scheduler control.
Note
This event enables you to specify appointments for visualization. Do not modify appointment properties, and do not add or remove appointments within this event handler. Doing so may result in an unhandled exception.
Example
This example demonstrates how to use the SchedulerStorage.FilterAppointment
event to filter appointments shown within a Scheduler Control, according to specific conditions. Specifically, the code below hides all tentative appointments (those whose status is set to AppointmentStatusType.Tentative).
using DevExpress.XtraScheduler;
// ...
private void SchedulerStorage_FilterAppointment(object sender, PersistentObjectCancelEventArgs e) {
// Filter all tentative appointments.
e.Cancel = Convert.ToInt32(((Appointment)e.Object).StatusKey) == 1;
}