[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Collapse]WPF Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Common Concepts
 [Expand]MVVM Framework
 [Collapse]Controls and Libraries
   Reporting
  [Collapse]Data Grid
   [Expand]Getting Started
   [Expand]Implementation Details
   [Expand]Views
   [Expand]Grid View Data Layout
   [Expand]Binding to Data
   [Expand]Master-Detail Data Representation
   [Expand]Data Editing and Validation
   [Expand]Grouping
   [Collapse]Filtering and Searching
    [Expand]Drop-down Filter
     Automatic Filter Row
     Filter Editor
     Filter Elements
     Predefined Filters
    [Expand]Filtering in Code
    [Collapse]Search
      Incremental Search
   [Expand]Sorting
   [Expand]Data Summaries
   [Expand]Paging and Scrolling
   [Expand]Focus, Navigation, Selection
   [Expand]Drag-and-Drop
   [Expand]Conditional Formatting
   [Expand]Appearance Customization
   [Expand]MVVM Enhancements
   [Expand]Printing and Exporting
   [Expand]End-User Interaction
   [Expand]Miscellaneous
   [Expand]Performance Improvement
   [Expand]Design-Time Features
   [Expand]Visual Elements
   [Expand]End-User Capabilities
   [Expand]Examples
  [Expand]Ribbon, Bars and Menu
  [Expand]Charts Suite
  [Expand]Pivot Grid
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Tree List
  [Expand]Gauge Controls
  [Expand]Map Control
  [Expand]Layout Management
  [Expand]Windows Modern UI
  [Expand]Printing-Exporting
  [Expand]Data Editors
  [Expand]Navigation Controls
  [Expand]Spell Checker
  [Expand]Property Grid
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Gantt Control
  [Expand]Diagram Control
  [Expand]Windows and Utility Controls
   Dialogs, Notifications and Panels
  [Expand]Scheduler (legacy)
 [Expand]Scaffolding Wizard
 [Expand]Localization
  Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Search

The built-in Search Panel allows users to find information within the GridControl:

Tip

Demos:

Requires installation of WPF Subscription. Download

Expanded Keyboard Operations

To display the Search Panel, a user should do one of the following:

  • Press Ctrl + F.
  • Click the Show Seacrh Panel button ( ).
  • Select the Show Search Panel item in a column's context menu.

To hide the Search Panel, a user should do one of the following:

  • Press Esc (the first press clears the search box; the second press closes the Search Panel).
  • Click the Close button ( ).
  • Select the Hide Search Panel item in a column's context menu.

To move focus from the Search Panel to the grid's data area, a user should press Down Arrow.

To show the MRU search drop-down list, a user should press Alt + Down Arrow.

Tip

Set the DataViewBase.ShowSearchPanelMode property to ShowSearchPanelMode.Always to always display the Search Panel.

Set the DataViewBase.ShowSearchPanelMode property to ShowSearchPanelMode.Never to prohibit users from displaying the Search Panel.

Expanded Filter and Highlight Modes

You can specify how to show search results:

  • Filter Mode - hides records that do not match the query and highlights results in the view.
  • Highlight Mode - highlights results in the view. Set the DataViewBase.SearchPanelAllowFilter property to false to enable the Highlight mode.

Expanded Search Panel UI

Search String

A user specifies a search string in the Search Panel's edit box. Use the DataViewBase.SearchString property to specify a search string in code.

Note

Searches performed with the Search Panel are case-insensitive.

Null Text

The text displayed in the Search Panel's edit box when the search text is null. Use the DataViewBase.SearchPanelNullText property to specify the null text.

Result Info Panel

Shows information about search results in the Search Panel. Set the DataViewBase.ShowSearchPanelResultInfo property to true to show the result info panel.

Note

The result info panel is not displayed when the Search Panel is in Filter mode (the DataViewBase.SearchPanelAllowFilter property value is true).

Navigation Buttons

Allow users to navigate through search results. Set the DataViewBase.ShowSearchPanelNavigationButtons property to true to show navigation buttons in the Search Panel.

MRU Button

Allows users to invoke the MRU search drop-down list. Set the DataViewBase.ShowSearchPanelMRUButton property to true show the MRU button in the Search Panel.

The MRU search drop-down list displays the most recently used search strings. If the DataViewBase.SearchPanelImmediateMRUPopup property value is true, the MRU search drop-down is invoked when a user types in the Search Panel.

Find Button

The GridControl starts to search data after the delay the DataViewBase.SearchDelay property specifies.

Set the DataViewBase.SearchPanelFindMode property to FindMode.FindClick to make the GridControl start to search data when a user presses Enter or clicks the Find button. To show the Find button in the Search Panel, set the DataViewBase.ShowSearchPanelFindButton property to true.

Close Button

Closes the Search Panel. Set the DataViewBase.ShowSearchPanelCloseButton property to false to hide the Close button.

Expanded Search Panel Positions

The Search Panel is merged with the Group Panel:

Set the GridViewBase.SearchPanelPosition property to SearchPanelPosition.OverGroupPanel to show the Search Panel over the Group Panel:

You can specify the DataViewBase.SearchPanelHorizontalAlignment property to set the Search Panel's alignment. In the following image, the Search Panel is stretched.

Expanded Search Syntax

  • Single keyword.

    Sales - Selects records that contain the "Sales" string in any search column.

  • To search for a string that contains a space character, specify this string in quotation marks.

    "Sales Manager" - Selects records that contain "Sales Manager" in any search column.

  • Without quotation marks, words separated by the space character are treated as individual conditions.

    Sales Manager - Selects records that contain either "Sales" or "Manager" strings in any search column.

  • To search against a specific column, precede a search string with the column's display name plus a colon character.

    Tip

    Instead of the complete name, you can partially specify the display name using the initial characters of a column's display name. A search is performed against the first column whose display name starts with the specified substring.

    To search against a column whose display caption contains space characters, specify the column's display caption in quotation marks.

    Group:Sales - Selects records that contain "Sales" in the column that starts with "Group".

    Note

    If the search string contains multiple conditions separated by space characters, and at least one condition defines a search against a specific column, only records that match all of these conditions are shown (i.e., the conditions are combined by the And logical operator).

    If there is no column specification, records that match at least one of these conditions are shown (i.e., the conditions are combined by the Or logical operator).

    Group:Sales Manager - Selects records that contain "Sales" in the column that starts with "Group", and also contain "Manager" in any search column.

  • Precede a condition with "+" to display only records that match this condition. The "+" specifier allows you to implement the logical And operator. There should be no space character between the "+" sign and the condition.

    Sales +Specialist - Selects records that contain both "Sales" and "Specialist" in search columns.

  • Precede a condition with "-" to exclude records that match this condition from the result set. There should be no space between the "-" sign and the condition.

    Sales -Specialist - Selects records that contain "Sales" excluding records that contain "Specialist".

    Note

    If the expression contains the "-" character, quotation marks are ignored.

  • You can combine different operators.

    Sales +Representative -"United States" - Selects records that contain both "Sales" and "Representative" in search columns, excluding records that contain "United States".

Tip

Expanded Related API

SearchColumns Property

The DataViewBase.SearchColumns property specifies the field names against which searches are performed.

Default property value is "*". In this case, a search is performed against all visible columns. To search against specific columns, specify the corresponding field names, delimiting them with the ";" character. You can use the ColumnBase.AllowSearchPanel property to specify whether the column data is taken into account when using the Search Panel.

SearchPanelHighlightResults Property

The DataViewBase.SearchPanelHighlightResults property specifies whether to highlight search strings within the located records.

Tip

Set the TableView.ScrollBarAnnotationMode / TreeListView.ScrollBarAnnotationMode property to SearchResult to highlight results on the scrollbar.

SearchStringToFilterCriteria Event

The DataViewBase.SearchStringToFilterCriteria occurs after the search string is changed.

The following code sample shows how to make the Search Panel search for a string that contains a space character without the need to specify this string in quotation marks:

Expanded Limitations

Expanded See Also

Is this topic helpful?​​​​​​​