Back to Devexpress

How to: Filter Resources

windowsforms-2282-controls-and-libraries-scheduler-examples-data-binding-how-to-filter-resources.md

latest1.0 KB
Original Source

How to: Filter Resources

  • Nov 13, 2018

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

csharp
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 ;
}
vb
Imports DevExpress.XtraScheduler

Private Sub schedulerDataStorage1_FilterResource(ByVal sender As Object, ByVal e As PersistentObjectCancelEventArgs)
    Dim storage As SchedulerDataStorage = CType(sender, SchedulerDataStorage)
    Dim res As Resource = CType(e.Object, Resource)
    ' Shows the first three resources in the collection.
    e.Cancel = storage.Resources.Items.IndexOf(res) > 2
End Sub