A newer version of this page is available. Switch to the current version.

FilterElement Class

Serves as a base for classes that represent Filter Elements.

Namespace: DevExpress.Xpf.Core.FilteringUI

Assembly: DevExpress.Xpf.Grid.v19.1.dll


public abstract class FilterElement :


To connect Filter Elements to your control:

  1. Put them to a container (for example, AccordionControl).
  2. Specify the field names of columns you want to filter using the FilterElement.FieldName property.
  3. Specify the container’s attached FilterElement.Context property to bind the filter elements to the control’s filtering context. With this context, your control sends the filter elements available values, format settings, and other information and retrieves filters criteria from the filter elements.
<dxa:AccordionControl dxfui:FilterElement.Context="{Binding Path=FilteringContext, ElementName=grid}">
   <dxa:AccordionItem Header="Price ($)">
      <dxfui:RangeFilterElement FieldName="Price"/>
   <dxa:AccordionItem Header="Trademark"> 
      <dxfui:CheckedListFilterElement FieldName="TrademarkID"/> 
   <dxa:AccordionItem Header="Transmission Type"> 
      <dxfui:RadioListFilterElement FieldName="TransmissionTypeID" /> 

<dxg:GridControl Name="grid" />  


Demo: Filtering UI

Requires installation of WPF Subscription. Download

Filter Behavior

If a data-bound control does not provide a filtering UI (for example, Charts and Data Editors), you can use the FilterBehavior to allow the Filter Elements to filter the control’s data.


Demo: FilterBehavior - ListBoxEdit Filtering

Requires a WPF Subscription. Download

The following code sample shows how to use the FilterBehavior to make the Filter Elements work with the ListBoxEdit.

  1. Add the FilterBehavior to the behaviors of a container that holds the Filter Elements. The FilterBehavior automatically specifies the FilterElement.Context properties.
  2. Specify the FilterBehavior.ItemsSource property to allow the Filter Elements to get unique filter values.
  3. Specify the FilterBehavior.Fields property to configure edit settings and predefined filters.
  4. Bind a data-bound control’s filter criteria to the FilterBehavior.ActualFilterCriteria object.
        <dxfui:FilterBehavior x:Name="filterBehavior" 
                              ItemsSource="{Binding ElementName=listBoxEdit, Path=ItemsSource}">
            <dxfui:FilterField FieldName="CategoryName">
                <dxe:ComboBoxEditSettings ItemsSource="{Binding Categories}"/>
            <dxfui:FilterField FieldName="UnitsInStock">
                        <dxfui:PredefinedFilter Filter="?p > 0" Name="In stock" />
                        <dxfui:PredefinedFilter Filter="?p = 0" Name="Out of stock" />
    <dxfui:CheckedListFilterElement FieldName="CategoryName" />
    <dxfui:PredefinedFiltersElement FieldName="UnitsInStock" />
    <dxfui:CheckBoxFilterElement FieldName="Discontinued" />
<!-- -->
<dxe:ListBoxEdit Name="listBoxEdit" ItemsSource="{Binding Products}"
                 FilterCriteria="{Binding ElementName=filterBehavior, Path=ActualFilterCriteria}"/>
See Also