Find Panel
- 3 minutes to read
Overview
The grid can display a find panel that enables users to search for keywords in data.
Note
Run the XtraGrid demo to see the find panel in action.
Keyboard operations
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
Note
A detail view should be maximized to allow searching its records.
Tip
The GridLookUpEdit does not support the find panel, use the SearchLookUpEdit.
Behavior: Search and Filter
You can specify how to show search results.
- Filter — hides records that do not match the query, and highlights results in the view (optionally).
- Search — highlights results in the view and on the scrollbar.
Use the following properties to specify how to show search results:
- for the entire application — the WindowsFormsSettings.FindPanelBehavior property. The Filter mode is applied if this setting is set to Default.
- for the current control — the ColumnView.OptionsFind.Behavior property (see ColumnViewOptionsFind.Behavior). The WindowsFormsSettings.FindPanelBehavior property is applied if this setting is set to Default.
Options
Panel visibility
- 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
Highlight results
To specify whether search queries are highlighted, use the ColumnView.OptionsFind.HighlightFindResults property.
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.
Search Syntax
The search syntax may vary depending on the GridView.OptionsFind.ParserKind and GridView.OptionsFind.Condition properties. See Find Panel Syntax for more information.
Operation buttons
Use the following properties to show/hide the operation buttons.
Filter and Search modes
- ColumnView.OptionsFind.ShowCloseButton - the X button that closes the panel.
Filter mode only
- ColumnView.OptionsFind.ShowFindButton - the Find button that applies the query.
- ColumnView.OptionsFind.ShowClearButton - the Clear button.
Search mode only
- ColumnView.OptionsFind.ShowSearchNavButtons - the Previous and Next buttons allow users to navigate between search results.
Auto-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;
Tip
To use these columns, store the custom text in a data source field and assign the field’s name to the GridColumn.FieldNameSortGroup property. You can also specify the ColumnViewOptionsFind.FindFilterColumns property to exclude these columns from the search.
- 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.