[Expand]General Information
[Collapse]WinForms Controls
  .NET Core Support
 [Expand]What's Installed
 [Expand]Build an Application
 [Expand]Controls and Libraries
 [Collapse]Common Features
  [Expand]Data Binding Common Concepts
  [Expand]Data Source Wizard
  [Expand]Application Appearance and Skin Colors
  [Collapse]Filtering UI Context
    Filtering Events
    Filtering Attributes
    Base and Parent Filtering ViewModels
    Filtering UI Context Designer
   Find Panel Syntax
  [Expand]Graphics Performance and High DPI
  [Expand]Scaffolding Wizard
  [Expand]Formatting Values
   HTML-inspired Text Formatting
  [Expand]Save and Restore Layouts
   Clipboard - Copy and Paste Operations. Data Formatting
   Version Compatibility: Default Property Values
  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

Filtering UI Context

DevExpress offers a number of different filtering options for its WinForms UI controls. Use Filtering UI Context to deliver user experiences that mirror web-based filter panels. This component creates a set of editors for users to filter data that a stand-alone, data-aware control displays. The Automatic Filtering UI demo illustrates a sample filtering UI generated for the Data Grid.

Expanded Supported Data-Aware Controls

The Filtering UI Context generates filter criteria and passes it to the data-aware control, which causes the latter to apply the corresponding filters. The Filtering UI Context can be used with all DevExpress data-aware controls that support filtering by criteria expressions.

Expanded Binding Modes

The Filtering UI Context generates a filtering UI from either a data-aware control directly or from a provided filtering Model.

  • Data-Aware Client (Simple Mode)

    The Filtering UI Context generates a filtering UI directly from a selected data-aware control. For this approach, you may have a reduced number of available customization options.

  • Filtering Model (Advanced Mode)

    A Model is a separate class that declares properties that match the fields of your data-aware control's source.

    You can either create such a Model manually or use the same class a data-aware control utilizes when binding to code-first data sources like the Entity Framework.

Initially, the component's smart tag is tuned to match the simple mode; click the "Enable Advanced Binding" link to browse advanced mode settings.

Setting base and parent ViewModels are optional. See the Base and Parent Filtering ViewModels article to learn more.

Expanded Retrieve Fields and Create the Filter UI

When the component is bound to a client (e.g., a grid view) and to a filter control (e.g., an accordion control), you can retrieve data fields from the client and create the UI in the filter control. To do this, click Retrieve Fields in the component’s smart tag menu or call the RetrieveFields method in code.

After you call the RetrieveFields method in code, the following events fire.

  • FieldRetrieving - fires when a field is about to be retrieved. This event allows you not to create a layout item in the filter control for the processed field.
  • FieldRetrieved - fires after a field is retrieved. Allows you to customize the filter control’s layout item (AccordionControlElement or LayoutControlItem) created for the field.

If you use the component in the advanced mode (you provide your own filter model), you can add fields by using the AddField method, and then call the RetrieveFields method to create the filter control’s layout items.

Expanded Refresh Bindings

If data in the Filtering UI Context's source changes, you can call the ResetBinding/ResetBindings methods to manually refresh editor values.

Expanded Filtering UI

The Filtering UI Context populates either an Accordion Control or a Layout Control with items. Utilize the component's smart-tag to choose an appropriate container (or create one if none are available).

A generated Accordion\Layout item contains an editor (or multiple editors) that fits the filtered data type. For instance, to filter numeric field data, the component generates two text boxes and a RangeTrackBarControl. You can remove these editors, customize them, or switch to other editor types by clicking the link at design time (see the figure below).

The Filtering UI Context generates editors only once when you click the "Retrieve Fields" link in a component's smart tag or call the "RetrieveFields" method in code. If a data source changes, you need to re-generate a filtering UI.

Handling specific events and adding Filtering Attributes also changes a filtering UI.

Expanded See Also

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