SchedulerStorageBase.FilterResource Event
Hides specific resources in the Scheduler control.
Namespace: DevExpress.XtraScheduler
Assembly: DevExpress.XtraScheduler.v24.2.Core.Desktop.dll
Declaration
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 following example demonstrates how to filter the resources shown within a Scheduler Control according to some condition. For this the SchedulerDataStorage.FilterResource event is used. The code below demonstrates how to show only the first three resources.
using DevExpress.XtraScheduler;
// ...
private void schedulerDataStorage1_FilterResource(object sender, PersistentObjectCancelEventArgs e) {
SchedulerDataStorage storage = (SchedulerDataStorage) sender;
Resource res = (Resource) e.Object;
// Filter the first three resources in a collection.
e.Cancel = storage.Resources.Items.IndexOf(res) > 2 ;
}