SearchControl Class
A control that allows a user to search and filter data in the attached control.
Namespace: DevExpress.XtraEditors
Assembly: DevExpress.XtraEditors.v24.1.dll
NuGet Package: DevExpress.Win.Navigation
#Declaration
#Related API Members
The following members return SearchControl objects:
#Remarks
The SearchControl allows a user to enter a query in the search box to filter data in the attached control. To specify the attached control, use the SearchControl.Client property.
#Apply Queries
The control automatically applies a query after a delay. Use the FindDelay property to specify the delay. You can also disable the AllowAutoApply property to apply search queries only when a user presses the Enter key.
#MRU Items
Use the SearchControl.Properties.Items property to access the collection of most recently used (MRU) items.
Related event handlers:
#Buttons
The control can display the Search and Clear buttons. Use the ShowDefaultButtonsMode property to specify when these buttons are displayed:
AutoChangeSearchToClear and Default - the Search button changes to the Clear button if a query is entered in the search box.
AutoShowClear - the Clear button is displayed if a query is entered in the search box.
Always - the Search and Clear buttons are always displayed.
The ShowMRUButton property specifies whether to show the drop-down button that invokes a list of recently used search requests. You can also use the Buttons collection to add custom buttons to the control.
#Prompt
The control displays a prompt when no query is entered in the search box. Use the NullValuePrompt property to specify the prompt.
#Multi-Column Clients
If the client control displays data in multiple columns, the SearchControl searches in all of them. You can handle the QueryIsSearchColumn event to prevent a search in a specific column.
#Example
The code below shows how to search in the Ship Country column only.
using DevExpress.XtraEditors;
private void searchControl1_QueryIsSearchColumn(object sender, QueryIsSearchColumnEventArgs args) {
if (args.FieldName != "ShipCountry")
args.IsSearchColumn = false;
}
#Embed the Control in a Bar or Ribbon
You can place a SearchControl on a bar or ribbon. See the following topic for more information: RepositoryItemSearchControl.
#Search Syntax
See the following topic for more information about search syntax: Find Panel Syntax.