Skip to main content

SchedulerDataStorage.FilterResource Event

Hides specific resources in the Scheduler control.

Namespace: DevExpress.XtraScheduler

Assembly: DevExpress.XtraScheduler.v23.2.dll

NuGet Package: DevExpress.Win.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

Handle the FilterResource event to hide specific resources 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 FilterResource event is raised for each resource in the Resources storage. If the PersistentObjectCancelEventArgs.Cancel parameter is set to true for the currently processed resource, then the Scheduler control does not display this resource. Specifically, the resource is hidden when appointments are grouped by resources (see the SchedulerControl.GroupType topic).

Important

Subscribe to the FilterResource event before storage initialization (before the PersistentObjectStorage<T>.DataSource is assigned), otherwise the filter is not applied.

Example

The example below shows how to filter resources in a scheduler. The filter shows the first three resources only.

using DevExpress.XtraScheduler;

private void schedulerDataStorage1_FilterResource(object sender, PersistentObjectCancelEventArgs e) {
    SchedulerDataStorage storage = (SchedulerDataStorage) sender;
    Resource res = (Resource) e.Object;
    // Shows the first three resources in the collection.
    e.Cancel = storage.Resources.Items.IndexOf(res) > 2 ;
}
See Also