Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Collapse]WinForms Controls
  Prerequisites
 [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]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [Expand]Map Control
  [Collapse]Scheduler
   [Expand]Product Information
   [Expand]Getting Started
   [Expand]Fundamentals
   [Expand]Visual Elements
   [Expand]Design-Time Features
   [Collapse]Examples
    [Expand]Appearance
    [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]DateTime
    [Expand]DateNavigator
    [Expand]Forms
    [Expand]Gantt View
    [Expand]Initialization
    [Expand]Labels and Statuses
    [Expand]Layout
    [Expand]Menu
    [Expand]Printing and Reporting
    [Expand]Protection
    [Expand]Range Control
    [Expand]Recurrence
    [Expand]Reminders
    [Expand]Selection
   [Expand]End-User Capabilities
   [Expand]Member Tables
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [Expand]TreeMap 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]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

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 SchedulerStorageBase.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:

How would you rate this topic?​​​​​​​