Skip to main content

SchedulerStorage.FilterResource Event

Enables specific resources to be hidden in the Scheduler Control.

Namespace: DevExpress.Xpf.Scheduler

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

NuGet Package: DevExpress.Wpf.Scheduler

Declaration

public event PersistentObjectCancelEventHandler FilterResource

Event Data

The FilterResource 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.

Handle the FilterResource event to hide specific resources in the Scheduler control. This event fires each time the layout of the Scheduler control is modified (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 FilterResource event is raised in turn for each resource in the ResourceStorage. If the PersistentObjectCancelEventArgs.Cancel parameter is set to true for the currently processed resource, this resource will be hidden in the Scheduler control. Specifically, the resource will not be displayed when appointments are grouped by resources (see the SchedulerControl.GroupType topic).

Example

This example demonstrates how to use the SchedulerStorage.FilterResource event to filter resources shown within a Scheduler Control according to some conditions. Specifically, the code below shows only the first three resources.

using DevExpress.XtraScheduler;
// ...

private void SchedulerStorage_FilterResource(object sender, PersistentObjectCancelEventArgs e) {
    Resource res = (Resource)e.Object;
    // Filter the first three resources in a collection.
    e.Cancel = schedulerControl1.Storage.ResourceStorage.Items.IndexOf(res) > 2;
}
See Also