Back to Devexpress

Filter and Search

windowsforms-114635-controls-and-libraries-data-grid-filter-and-search.md

latest29.0 KB
Original Source

Filter and Search

  • Nov 13, 2025
  • 12 minutes to read

When a filter is applied, the View displays only records that match the filter criteria. You can filter data by one or multiple columns. When filtering by multiple columns, the grid combines the filters using the AND logical operator.

Watch Video: Filter and Search

Most DevExpress WinForms data-aware controls (for example, Data Grid, Tree List, Vertical Grid, etc.) have a filter UI and API similar to those described in this help topic.

Tip

GridControl, GridLookUpEdit, and SearchLookUpEdit support AI-powered Semantic Search. Unlike standard keyword-based search, semantic search leverages Natural Language Processing (NLP) to analyze search queries beyond exact keyword matching. See the following help topic for additional information: Semantic Search.

Run Demo: Semantic Search

Apply a Filter

Use the following properties to apply a filter:

Clear a Filter

Use the following API to clear the filter:

Filter and Search Options

Excel-style Filter Popup Menus

Users can click the filter icon within a column header to invoke a filter drop-down menu for a column. The drop-down menu contains the following tabs:

ValuesUsers can select from cell values displayed in the Data Grid or enter specific values.Filters

Contains a wide range of filtering options.

Note

Available filters depend on the data type of the grid column.

Note

The grid interprets user-entered values based on Find Panel syntax rules.

Refer to the following help topic for more information: Classic Menus.

Automatic Filter Row

The Auto Filter Row is the topmost row in the grid. It allows users to create advanced filters by entering filter values (including ‘*’ and ‘%’ wildcards) and select filter operators (for example, NotLike, Equals, Between, etc.).

Enable the OptionsView.ShowAutoFilterRow property to display the Auto Filter Row.

Run Demo Watch Video

Note

If an Auto Filter Row cell uses a RepositoryItemRichTextEdit editor, users can select only the “Like” filter condition for this cell. Other conditions (“Starts with”, “Equals”, etc.) are not available for Rich Text Formatted (RTF) values.

Filter Panel

When a user applies a filter, the View displays a Filter Panel. The panel’s UI includes:

“Clear Filter” ButtonClears the filter and closes the Filter Panel.“Toggle Filter” CheckboxTemporarily disables (removes) the current filter.Current FilterDisplays the current filter.“Recent Filters” ButtonOpens a drop-down menu with recent filters.“Edit Filter” ButtonOpens the advanced Filter Editor, which allows users to modify the filter.

Advanced Filter Editor

The Filter Editor allows users to create complex filter criteria combined from multiple expressions. The Filter Editor supports syntax highlighting and autocomplete to facilitate user input.

Do one of the following to open the Filter Editor:

  • Click Edit Filter in the Filter Panel.
  • Right-click a column header and select Filter Editor.

Run Demo: Filter Editor

Conditional Formatting Filters

You can filter data based on applied Conditional Formatting rules.

Users can apply these filters from:

  • Excel-style Filter Menu
  • Column Header Menu
  • Filter Editor

Refer to the following help topic for more information: Conditional Formatting Filters.

Users can focus a grid column and start typing. The Data Grid highlights matching records. To move to other matching records, users can press Ctrl+Up and Ctrl+Down hotkeys.

Enable the OptionsBehavior.AllowIncrementalSearch option to enable incremental search.

Find Panel

The Find Panel allows users to apply a temporary filter across all Data Grid columns. The grid highlights matching values. The Find Panel also gives access to previous search values.

To invoke the Find Panel, press Ctrl+F. You can configure the Find Panel so that it is always visible. Refer to the following help topic for additional information: Find Panel Options.

Run Demo

Note

The Find Panel does not highlight cells with HTML text.

Search in Column Headers

Use the GridOptionsFilter.InHeaderSearchMode property to enable built-in search boxes within column headers and use them to filter column data or to search in columns, depending on the mode you choose.

TextFilter Mode

Users can type text in search boxes to filter against columns.

TextSearch Mode

Users can type text in search boxes to search for column data. The grid highlights cell text that matches the search string.

Focus the required column and use the following shortcuts to navigate between search results:

Ctrl+Down or F3Navigates to the next search result.Ctrl+Up or Shift+F3Navigates to the previous search result.

Note

The Find Panel and In-Header Search are mutually exclusive options. These features are not intended to be used together.

Search Syntax

The following list demonstrates sample search expressions supported in column header search boxes:

  • Spa — Finds records whose column values contain this string (in non-numeric columns).

  • 10 — Finds records whose column values are equal to “10” (in numeric columns).

  • =Spain or =22 — Finds records whose column values are equal to the specified value.

  • <>40 — Finds records whose column values are not equal to the specified value.

  • =USA,Spain,Germany or =USA;Spain;Germany — Finds records whose column values are equal to any of these listed values.

  • [10:20] or [10..20] — Finds records whose column values belong to the specified inclusive range.

Text search is case-insensitive.

Note

This section lists the main built-in settings. The following help topic describes advanced filter/search scenarios: Advanced Filtering, Custom Filtering, Search.

Grid/Column Settings

The following API allows you to enable, disable, or otherwise configure filtering at the level of a Grid/column.

|

API

|

Description

| | --- | --- | |

GridOptionsCustomization.AllowFilter

|

Enables or disables the filter feature for the entire Data Grid.

| |

OptionsColumnFilter.AllowFilter

|

Gets or sets whether the filter button in Grid Views (field filter button in Layout Views) is displayed within the column header.

| |

OptionsColumnFilter.AllowAutoFilter

|

Gets or sets whether the column’s values can be filtered using the Auto Filter Row.

| |

ColumnView.OptionsFilter

|

Provides access to settings that affect filter menus for all columns. See ColumnViewOptionsFilter class members for the list of available settings.

| |

GridColumn.OptionsFilter

|

Provides access to filter settings of a specific column. See OptionsColumnFilter class members for a list of available settings.

| |

ColumnView.ActiveFilterEnabled

|

Allows you to toggle the current filter on or off.

|

When a column’s filter changes, the ColumnView.ColumnFilterChanged event occurs. This event also fires when the Find Panel finishes the search.

Configure Drop-Down Menus

The following help topics describe different aspects of drop-down menu customization:

Configure the Auto Filter Row

Use the following API to specify Auto Filter Row settings:

|

API

|

Description

| | --- | --- | |

GridOptionsView.ShowAutoFilterRow

|

Manages the visibility of the Auto Filter Row.

| |

GridOptionsFilter.AllowAutoFilterConditionChange

|

Specifies whether the auto filter row’s condition selector is visible. If this selector is disabled, entered values will be compared using the following operators: Equals for CheckEdit, LookUpEdit, and ImageComboBoxEdit columns, and Like for other columns.

| |

OptionsColumnFilter.AutoFilterCondition

|

Specifies the filter criteria operator for this column (“Equals”, “Like”, “Greater”, etc.).

| |

OptionsColumnFilter.ImmediateUpdateAutoFilter

|

If this setting is enabled, the Data Grid filters its records immediately after a user modifies the filter condition. Otherwise, the filter is not applied until a user presses the Enter key or moves focus to another cell.

| |

GridView.ShowAutoFilterConditionsMenu

|

Call this method from code to invoke the Automatic Filter Row popup menu for a specific column.

| |

GridView.PopupMenuShowing

|

Fires when any popup menu is about to be shown. Allows you to customize the set of operators in an Auto Filter Row cell’s drop-down menu.

|

Note

Cell editors displayed in the Automatic Filter Row ignore their masks and allow users to enter any characters.

The following code snippet keeps the numeric mask active for the Auto Filter Row:

csharp
private void GridView1_ShownEditor(object sender, System.EventArgs e) {
    GridView view = sender as GridView;
    TextEdit edit = view.ActiveEditor as TextEdit;
    if (edit != null && view.IsFilterRow(view.FocusedRowHandle))
        edit.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric;
}
vb
Private Sub GridView1_ShownEditor(ByVal sender As Object, ByVal e As System.EventArgs)
    Dim view As GridView = TryCast(sender, GridView)
    Dim edit As TextEdit = TryCast(view.ActiveEditor, TextEdit)
    If edit IsNot Nothing AndAlso view.IsFilterRow(view.FocusedRowHandle) Then
        edit.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric
    End If
End Sub

Configure the Filter Panel

Use the following API to specify Filter Panel settings:

|

API

|

Description

| | --- | --- | |

ColumnViewOptionsView.ShowFilterPanelMode

|

Manages filter panel visibility.

| |

ColumnViewOptionsFilter.AllowMRUFilterList

|

Allows you to hide the button that invokes the list with recently applied filters.

| |

ColumnViewOptionsFilter.AllowFilterEditor

|

Controls the Edit Filter button’s visibility.

|

Use the following API to handle search operations:

|

API

|

Description

| | --- | --- | |

GridOptionsBehavior.AllowIncrementalSearch

|

Enables or disables incremental search.

| |

ColumnView.GetIncrementalText

|

Returns the searched text during incremental search.

| |

GridView.StartIncrementalSearch

|

Triggers incremental search.

| |

GridView.StopIncrementalSearch

|

Cancels incremental search.

|

Configure the Filter Editor

The following help topics describe different aspects of Filter Editor customization:

Configure the Filter Criteria Display Style

The following properties get or set the display style of filter criteria in the Find Panel and built-in Filter Editor at different levels:

|

Property

|

Level

| | --- | --- | |

WindowsFormsSettings.FilterCriteriaDisplayStyle

|

The entire application.

| |

ColumnViewOptionsView.FilterCriteriaDisplayStyle

|

A single View.

|

Available display styles include:

Visual

Renders filter criteria in an easy-to-read format and uses skin-based colored highlights to differentiate between column names, functions, and values. In the Filter Panel, the ‘x’ button is displayed when you hover over a condition. This button allows users to remove individual conditions from the filter.

Text

Renders filter criteria in a text-based format.

Configure the Find Panel

Use the following API to specify Find Panel settings:

|

API

|

Description

| | --- | --- | |

ColumnViewOptionsFind.AllowFindPanel

|

Manages the availability of the Find Panel.

| |

ColumnViewOptionsFind.Behavior

|

Gets or sets whether records that do not match the query are hidden.

| |

ColumnViewOptionsFind.ParserKind

|

If text entered into the Find Panel contains whitespace, the Panel splits this string into separate logical blocks. The ParserKind setting specifies how these blocks are combined into a search query.

| |

ColumnViewOptionsFind.Condition

|

Gets or sets the condition according to which the Data Grid searches for the string entered into the Find Panel.

| |

ColumnViewOptionsFind.FindMode

|

Gets or sets whether a user must press Enter or click the “Find” button to start a search, or it starts automatically after a certain delay (the ColumnViewOptionsFind.FindDelay property).

| |

ColumnViewOptionsFind.AllowFindInExpandedDetails

|

Gets or sets whether to search data in expanded detail views.

| |

ColumnView.FindPanelItems

|

Gets settings that allow you to display custom items within the Find Panel.

|

Refer to the following topic for more information: Find Panel.

Configure Search in Column Headers

Use the following API to handle search operations:

|

API

|

Description

| | --- | --- | |

GridColumn.OptionsFilter.AllowInHeaderSearch

|

Allows you to disable search boxes in individual column headers.

| |

GridView.ClearInHeaderSearchText

|

Clears search text (contents of column header search boxes) for all columns.

| |

GridView.HideInHeaderSearchTextBox

|

Hides the currently active column header search box.

| |

GridView.ShowInHeaderSearchTextBox

|

Activates a built-in header search box for a specific column.

| |

GridColumn.SearchText

|

Gets or sets the text of the column’s built-in header search box. This property is supported in Grid Views and Banded Grid Views.

| |

GridColumn.OptionsFilter.InHeaderSearchPrompt

|

Gets or sets a grayed out hint displayed in an empty header search box when the search box is activated.

| |

GridView.OptionsFilter.ShowInHeaderSearchTextMode

|

Gets or sets whether to display search text (GridColumn.SearchText) in column header tooltips.

|

Refer to the following topic for more information: GridView.OptionsFilter.InHeaderSearchMode.

Semantic search enables users to locate relevant data quickly and accurately within large datasets. Unlike standard keyword-based search, semantic search leverages Natural Language Processing (NLP) to analyze search queries beyond exact keyword matching.

Run Demo: Semantic Search - Grid Control

Read the following help topic to learn more: AI-powered Semantic Search.

Examples

Cheat Sheets and Best Practices

DevExpress data-aware UI controls support a similar filter UI and API. See the following quick-reference guides for detailed information:

Filter DevExpress Data-Aware Controls

See Also

Advanced Filtering, Custom Filtering, Search