- 4 minutes to read
The grid can display a find panel that enables users to search for keywords in data.
Run the XtraGrid demo to see the find panel in action.
Filter and Search modes
- press Ctrl+F to open the find panel
- press Esc once to clear the panel, press it again to close it
- press the Down Arrow key to move focus from the panel to the grid
Search mode only
- press F3/Enter to go to the next result
- press Shift/Alt/Ctrl+F3/Enter to go to the previous result
The ColumnView.OptionsFind property provides access to options related to the find panel.
Behavior: Filter or Search
The ColumnView.OptionsFind.Behavior property specifies how to show search results:
Filter — hides records that do not match the query, and (optionally) highlights results in the view.
Search — highlights results in the view and on the scrollbar.
If this property is set to Default, the behavior depends on the static (Shared in VB) WindowsFormsSettings.FindPanelBehavior property. If the latter property is also set to Default, the Filter mode is applied.
To specify whether search queries are highlighted, use the ColumnView.OptionsFind.HighlightFindResults property.
- ColumnView.ShowFindPanel — opens the panel
- ColumnView.HideFindPanel — closes the panel
- ColumnView.OptionsFind.AllowFindPanel — set to false to prohibit opening the panel
- ColumnView.OptionsFind.AlwaysVisible — set to true to prevent the panel from being closed
The GridView.OptionsFind.FindPanelLocation property specifies where the panel is displayed:
Panel — the find panel is displayed in a separate panel.
The default location depends on the Version Compatibility setting. Since version 19.2, the find panel is embedded into the group panel.
Specify Search Queries in Code
- ColumnView.ApplyFindFilter — fills in the find panel with the specified query and applies it.
- ColumnView.ClearFindFilter — discards the query and clears the find panel.
- ColumnView.CustomRowFilter — allows you to specify row visibility regardless of the currently applied filter.
- ColumnView.OptionsFind.FindFilterColumns — names of columns in which to search the keywords.
- ColumnView.ColumnFilterChanged — occurs when the Find Panel finishes its search.
Use the following properties to show/hide the operation buttons:
ColumnView.OptionsFind.ShowCloseButton - the X button that closes the panel.
ColumnView.OptionsFind.ShowClearButton - the Clear button.
To display the Clear button as a separate button, set the DefaultSettingsCompatibilityMode to v19_1 or earlier.
The separate Clear button is only displayed in Filter mode and if the find panel is not embedded into the group panel.
Apply Search Queries
After a user types in the search box, the search starts automatically or manually depending on the underlying data source. You can use use the ColumnView.OptionsFind.FindMode property to specify this behavior explicitly. The ColumnView.OptionsFind.FindDelay property allows you to specify the delay between entering a query and starting the search.
Server Mode Limitations
The find panel has the following limitations in the server mode:
- only numeric and text columns are supported;
- only focused row and selected row scrollbar annotations are supported;
columns that show the custom text instead of the actual values are not supported;
- only case-insensitive queries are supported. See the How to make the Grid's filter case- and accent-insensitive in Server Mode Kb article for more information.