Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

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

NuGet Package: DevExpress.Win.Navigation

#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:

image

To limit search by column, you can subscribe to the SearchControl.QueryIsSearchColumn or RepositoryItemSearchControl.QueryIsSearchColumn event.

See Also