Find Panel
- 2 minutes to read
Overview
The grid can display a find panel that enables users to search for keywords in visible rows. The panel searches against records in the vertical grid, and property names in the property grid.
Note
Run the following demo to see the find panel in action: XtraVerticalGrid.
Keyboard Operations
- Press Ctrl+F to open the find panel;
- Press Esc once to clear the panel, and press it again to close it;
- Press the Down Arrow key to move focus from the panel to the grid.
Options
The VGridControl.OptionsFind property provides access to find panel options.
Panel Visibility
- VGridControl.ShowFindPanel() — opens and focuses the panel. To open and focus the panel when the control is displayed for the first time, use the BeginInvoke method to call this method asynchronously (see an example).
- VGridControl.HideFindPanel() — closes the panel.
- VGridControl.OptionsFind.Visibility — gets or sets whether the panel is shown/hidden with Ctrl+F, or always/never visible.
Highlight Results
To specify whether search queries are highlighted, use the VGridControl.OptionsFind.HighlightFindResults property.
Specify Search Queries in Code
- VGridControl.ApplyFindFilter(System.String) — enters the specified query in the find panel and applies it.
- VGridControl.ClearFindFilter — discards the query and clears the find panel.
- VGridControl.CustomRecordFilter — hides a specific record regardless of the applied filter.
- VGridControl.OptionsFind.FindFilterColumns — names of rows in which to search for keywords (for the vertical grid only). Note that the find panel searches for keywords in visible rows only (see Visible).
Search Syntax
Search syntax can vary depending on the VGridControl.OptionsFind.ParserKind and VGridControl.OptionsFind.Condition properties. See the following help topic for more information: Find Panel Syntax.
Parse Search Query
If the standard search syntax does not fit your needs or you need to highlight search results in a custom manner, you can handle the VGridControlBase.ParseFindPanelText event. The event allows you to create a filter condition based on the query and specify how to highlight results in the control.
Operation Buttons
VGridControl.OptionsFind.ShowCloseButton — the X button that closes the panel.
VGridControl.OptionsFind.ShowFindButton — the Find button that applies the query.
- VGridControl.OptionsFind.ShowClearButton — the Clear button.
Automatically Apply Search Queries
After a user types in the search box, the search starts automatically depending on the underlying data source. You can use use the VGridControl.OptionsFind.FindMode property to specify this behavior. If the search begins automatically after a query is entered, the VGridControl.OptionsFind.FindDelay property specifies the delay before the search is initiated.