Skip to main content
A newer version of this page is available. .

ColumnView.ParseFindPanelText Event

Fires after the query in the find panel changes. Allows you to create a filter condition based on the query and specify how to highlight results in the control.

Namespace: DevExpress.XtraGrid.Views.Base

Assembly: DevExpress.XtraGrid.v19.1.dll


public event EventHandler<ParseFindPanelTextEventArgs> ParseFindPanelText

Event Data

The ParseFindPanelText event's data class is DevExpress.Data.ParseFindPanelTextEventArgs.


The FindPanelText event argument returns the query in the find panel. Based on the query, you can create a CriteriaOperator object that specifies a filter condition. To apply the condition to the control, use the following methods:

  • SetFindCriteria - applies the specified filter condition.
  • SetFindCriteriaAndHighlightedRangesGetterFromDisplayText - allows you to provide a function that highlights results in the control. The function accepts the text displayed in the processed cell and returns positions that should be highlighted.
  • SetFindCriteriaAndHighlightedRangesGetterFromDisplayTextAndFieldName - the function accepts the text displayed in the processed cell and the field name.

The Handled event argument should be set to true to prevent the default filter algorithm from being invoked.


The code below shows how to use a comma to split the search query into several queries.

using DevExpress.Data;
using DevExpress.Data.Filtering;

private void PropertyGridControl1_ParseFindPanelText(object sender, DevExpress.Data.ParseFindPanelTextEventArgs e) {
    if (string.IsNullOrWhiteSpace(e.FindPanelText)) return;
    List<string> criteria = new List<string>();
    foreach (string criteriaString in e.FindPanelText.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)) {
        string str = criteriaString;
        if (criteriaString[0] == ' ')
            str = criteriaString.Remove(0, 1);

    if (criteria.Count < 2)

    string filterString = String.Empty;
    for (int i = 0; i < criteria.Count; i++) {
        filterString += "Contains([Caption], '" + criteria[i] + "')";
        if (i != criteria.Count - 1)
            filterString += " OR ";

    CriteriaOperator _findCriteria = CriteriaOperator.Parse(filterString);
        (x, y) => {
        var arr = new DisplayTextHighlightRange[criteria.Count()];
        for (int i = 0; i < criteria.Count(); i++) {
            arr[i] = new DisplayTextHighlightRange(x.IndexOf(criteria[i]), criteria[i].Length);
        return arr;
    e.Handled = true;

The code below shows how to search for an exact match with the query in a particular column.

using DevExpress.Data;
using DevExpress.Data.Filtering;

private void gridView1_ParseFindPanelText(object sender, DevExpress.Data.ParseFindPanelTextEventArgs e) {
    string searchField = "Country";
    CriteriaOperator criterion = new BinaryOperator(searchField, e.FindPanelText, BinaryOperatorType.Equal);
    e.Handled = true;
    e.SetFindCriteriaAndHighlightedRangesGetterFromDisplayTextAndFieldName(criterion, (displayText, fieldName) => {
        if (fieldName != searchField)
            return null;
        if (string.IsNullOrEmpty(displayText))
            return null;
        var indexOf = displayText.IndexOf(e.FindPanelText, StringComparison.CurrentCultureIgnoreCase);
        if (indexOf < 0)
            return null;
        return new DisplayTextHighlightRange(indexOf, e.FindPanelText.Length);
See Also