SearchControl.QuerySearchParameters Event
Fires when the SearchControl‘s text is submitted. Handle the event to get or set the search text and condition.
Namespace: DevExpress.XtraEditors
Assembly: DevExpress.XtraEditors.v24.2.dll
Declaration
[DXCategory("Events")]
public event EventHandler<SearchControlQueryParamsEventArgs> QuerySearchParameters
Event Data
The QuerySearchParameters event's data class is DevExpress.Utils.SearchControlQueryParamsEventArgs.
Remarks
The QuerySearchParameters event provides access to the following properties:
- SearchText - to access the text in the SearchControl,
- FilterCondition - to modify the standard search condition.
Note that the FilterCondition property does not work in Data Grid controls, because they have their own filtering features.
The example below prevents search for queries under 3 symbols and matches the search text only to the target text’s beginning.
private void searchControl1_QuerySearchParameters(object sender,
DevExpress.Utils.SearchControlQueryParamsEventArgs e) {
e.FilterCondition = DevExpress.Data.Filtering.FilterCondition.StartsWith;
if(e.SearchText.Length < 3) {
e.SearchText = String.Empty;
}
}
The image below demonstrates the result:
To limit search by column, you can subscribe to the SearchControl.QueryIsSearchColumn or RepositoryItemSearchControl.QueryIsSearchColumn event.