Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

Predefined Filters

Filter Elements allow end users to create complex filters. If you are working with DevExpress v18.2, you can also enable Predefined Filters.

#Specify Predefined Filters

  1. Create a PredefinedFilter and specify its PredefinedFilter.Name and PredefinedFilter.Filter properties.
  2. Add the predefined filter to the PredefinedFilterCollection and specify the ColumnBase.PredefinedFilters property.

The following code sample shows how to specify predefined filters for the MPGCity column:

<Window ...
        xmlns:dxfui="http://schemas.devexpress.com/winfx/2008/xaml/core/filteringui">

<dxg:GridControl Name="grid">
  <!-- -->              
  <dxg:GridColumn FieldName="MPGCity">
      <dxg:GridColumn.PredefinedFilters>
          <dxfui:PredefinedFilterCollection>
              <dxfui:PredefinedFilter Filter="?p >= 25" Name="More than 25" />
              <dxfui:PredefinedFilter Filter="?p >= 15 AND ?p &lt; 25" Name="From 15 to 25" />
              <dxfui:PredefinedFilter Filter="?p &lt; 15" Name="Less than 15" />
          </dxfui:PredefinedFilterCollection>
      </dxg:GridColumn.PredefinedFilters>
  </dxg:GridColumn>
</dxg:GridControl> 

#Apply Predefined Filters

#Predefined Filters Element

You can show predefined filters in the PredefinedFiltersElement:

<dxg:GridControl x:Name="grid" ... />
<!-- ... -->
<dxfui:PredefinedFiltersElement Context="{Binding FilteringContext, ElementName=grid}" FieldName="MPGCity" /> 

#Filter Editor

You can select predefined filters in the Filter Editor:

#Excel-style Drop-down Filter

You can select predefined filters in the Excel-style Drop-down Filter: