Skip to main content
A newer version of this page is available. .

Filtering UI Context

  • 3 minutes to read

The Filtering UI Context produces a set of editors end-users can utilize to filter data a stand-alone, data-aware control displays. The Automatic Filtering UI demo illustrates a sample filtering UI generated for the Data Grid.

Filtering UI Context - Thumbnail

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:

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 which match fields of your data-aware control’s source.

    
    public partial class ProductFilteringModel {
        public string Category_Name { get; set; }
        public int Doors { get; set; }
        public decimal Price { get; set; }
        public bool? InStock { get; set; }
    }
    

    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.

Filtering UI Context - Smarttags

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

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).

Filtering UI Context - Container

A generated Accordion\Layout item contains an editor (or multiple editors) that fits the filtered data type. For instance, to filter a numeric field’s 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).

Filtering UI Context - Change Type

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.

See Also