[Expand]General Information
[Collapse]WinForms Controls
  .NET Core Support
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications, and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Property Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Gantt Control
  [Expand]Chart Control
  [Expand]Map Control
   [Expand]Product Information
    Getting Started
   [Expand]Scheduler Elements and Structure
   [Expand]Data Binding
   [Expand]Import and Export
   [Expand]Time Zones
   [Expand]Design-Time Features
   [Expand]End-User Capabilities
   [Expand]Member Tables
   [Expand]Visual Elements
    [Collapse]Data Binding
      How to: Create Appointments with Custom Fields
      How to: Prevent Appointments and Resources from Reloading
      How to: Use the FetchAppointments Event for Faster Appointment Loading
      How to: Filter Appointments
      How to: Filter Resources
      How to: Enable Multi-Resource Appointments
      How to: Bind the Scheduler with Multi-resource Appointments to XPO
    [Expand]Data Exchange
    [Expand]Date and Time
    [Expand]Gantt View
    [Expand]Labels and Statuses
    [Expand]Printing and Reporting
    [Expand]Range Control
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Sunburst Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Report and Dashboard Server
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

How to: Filter Appointments

Expanded FilterAppointment event

The following example demonstrates how to filter the appointments shown within a Scheduler Control according to some condition. For this the SchedulerDataStorage.FilterAppointment event is used. The code below demonstrates how to hide all tentative appointments (those whose status is set to AppointmentStatusType.Tentative).

Expanded Filter Control

You can use the FilterControl to provide the end-user with a flexible tool to build complex filter criteria.

Suppose your appointment has a custom field CustomFieldPrice, mapped as follows:

Place the FilterControl onto the form. Name it filterControlForAppointments. Specify the SchedulerStorage.Appointments storage as the source control of the FilterControl using the FilterControl.SourceControl property.

At runtime, you'll be able to construct a complex criterion, as illustrated in the following picture:

The filter string, obtained via the FilterControl.FilterString property, looks as follows:

[AllDay] = True And [Subject] Like 'R%' And [Description] Like '%Check%' And [Start] Between(#2009-12-13#, #2009-12-25#) And [CustomFieldPrice] >= 10.00m Or [Status] = 3 And [Label] = 7

This filter leaves the Scheduler appointments with Status equal to 'Out Of Office' labeled 'Need Preparation', and also, all-day appointments which start between 13 and 25 December, 2009, having a subject starting with 'R', containing string "Check" in the description, and priced equal to or higher than 10.

To apply this criterion to the scheduler appointment storage, use this code:

Is this topic helpful?​​​​​​​