Back to Devexpress

Filter Editor and Filter Panel

windowsforms-6226-controls-and-libraries-pivot-grid-data-shaping-filtering-filter.md

latest10.7 KB
Original Source

Filter Editor and Filter Panel

  • Feb 24, 2026
  • 4 minutes to read

You can filter data in the Filter Editor and Filter Panel at runtime or in code.

Run Demo: Excel Style Filtering

The Pivot Grid synchronizes filters applied in the pop-up filter and Filter Editor. You can customize the resulting filter sting or clear it to reset the applied filters.

Filter Editor

Use the Filter Editor dialog to apply complex filter conditions at runtime. Users can use the Show Filter Editor context menu command or Edit Filter button to invoke the Filter Editor window.

Show Filter EditorThe Show Filter Editor context menu command can be used if PivotGridOptionsFilterPopup.FieldFilterPopupMode is set to Excel.Edit FilterThe Edit Filter button in the Filter Panel invokes the Filter Editor dialog.

Handle the PivotGridControl.PopupMenuShowing event to hide the Show Filter Editor context menu item and prevent users from invoking the Filter Editor.

The PivotGridControl.OptionsFilter.DefaultFilterEditorView property specifies the Filter Editor’s display style. The image displays the VisualAndText style:

Use the PivotGridFieldOptions.ShowInFilter property to hide a field and its criteria in the Filter Editor.

The list below shows the main members related to the Filter Editor.

ActiveFilterProvides access to settings of the filter applied to the PivotGridControl‘s data.ActiveFilterCriteriaGets or sets the filter criteria applied to the PivotGridControl‘s data.ActiveFilterStringGets or sets a string that specifies the filter criteria applied to the PivotGridControl‘s data.ActiveFilterEnabledGets or sets whether to apply the filter criteria specified using the PivotGridControl.ActiveFilterCriteria or PivotGridControl.ActiveFilterString.ActiveFilterCriteriaChangedOccurs when the filter criteria, currently applied to the PivotGridControl, is changed.FieldFilterPopupModeGets or sets the field’s filter popup mode for all fields.FieldFilterPopupModeGets or sets the field’s pop-up filter mode.DefaultFilterEditorViewGets or sets the how a user can edit criteria in the Filter Editor.UseAdvancedFilterEditorControlSpecifies whether WinForms data-aware controls should use the advanced Filter Editor Control that features a single-tab interface and enhanced text criteria builder.

To enable the Classic mode, set the PivotGridOptionsFilterPopup.FieldFilterPopupMode option to FieldFilterPopupMode.Classic.

Note that this mode does not synchronizes values applied in the pop-up filter and the Filter Editor.

Run Demo: Filtering

csharp
pivotGridControl.OptionsFilterPopup.FieldFilterPopupMode = FieldFilterPopupMode.Classic;
vb
pivotGridControl.OptionsFilterPopup.FieldFilterPopupMode = FieldFilterPopupMode.Classic

Filter Panel

You can customize the resulting filter sting in the Filter Panel or clear it to reset the applied filters.

Enable the PivotGridOptionsCustomization.AllowFilter option and specify a filter condition to display the Filter Panel.

The following options are available:

OptionDescription
Close Filter buttonCloses the panel and clears the filter
Enable Filter checkboxEnables/disables the current filter.
MRU Filter buttonDisplays MRU filter list.
Edit Filter buttonInvokes the Filter Editor to build complex filter criteria.
MRU filter listDisplays the last filters applied to the Pivot Grid.

Note

The MRU list is not available if the filter criteria display style is Visual (the WindowsFormsSettings.FilterCriteriaDisplayStyle property value equals Visual).

Filtering in Code

The PivotGridControl contains the following properties that allows you to manage active filters:

ActiveFilterCriteriaGets or sets the filter criteria applied to the PivotGridControl‘s data.ActiveFilterStringGets or sets a string that specifies the filter criteria applied to the PivotGridControl‘s data.ActiveFilterEnabledGets or sets whether to apply the filter criteria specified using the PivotGridControl.ActiveFilterCriteria or PivotGridControl.ActiveFilterString.

The example below shows how to filter a Pivot Grid Control’s underlying data source. The filter selects records that contain ‘USA’ strings in the Country field and ‘Beverages’ in the Category field:

csharp
using DevExpress.Data.Filtering;

//...

pivotgridControl1.ActiveCriteriaString = "[" + fieldCountry + 
                "] = 'UK' And [" + fieldCategory + "] = 'Beverages'";
vb
Imports DevExpress.Data.Filtering

'...

PivotGridControl1.ActiveCriteriaString = "[" + FieldCountry + 
                "]== 'UK' And [" + fieldCategory + "] = 'Beverages'"

The example below shows how to apply complex filter criteria in code using the PivotGridControl.ActiveFilterCriteria property.

csharp
using DevExpress.Data.Filtering;
// ...
            pivotGridControl.ActiveFilterCriteria = new GroupOperator(GroupOperatorType.And,
                new InOperator(fieldTrademark.Name, new string[] { "Chevrolet", "Chrysler", "Dodge", "Ford" }),
                new InOperator(fieldBodyStyle.Name, new string[] { "Coupe" }));
vb
Imports DevExpress.Data.Filtering
' ...
            pivotGridControl.ActiveFilterCriteria = New GroupOperator(GroupOperatorType.And,
                New InOperator(fieldTrademark.Name, New String() {"Chevrolet", "Chrysler", "Dodge", "Ford"}),
                New InOperator(fieldBodyStyle.Name, New String() {"Coupe"}))

The PivotGridControl.ActiveFilterCriteriaChanged event rises when you change a filter condition in the Filter Editor or in code.

See the Pivot Grid Expression Syntax for more information about filter criteria syntax.

Limitations

  • Excel-style filters are not available in OLAP mode.
  • The Filter Editor cannot filter data fields.
  • When you change the field’s name in code, the field’s name in the criterion is not changed. Such names are considered invalid. An error message is displayed in the Filter Panel if you use the name of a column which does not exist.

See Also

Pivot Grid Expression Syntax