BaseListBoxControl.ParseSearchControlText Event

Fires when a related SearchControl fires a query to the current List Box. Allows you to create a filter condition based on the query and specify how to highlight results in the control.

Namespace: DevExpress.XtraEditors

Assembly: DevExpress.XtraEditors.v21.2.dll


public event EventHandler<ParseSearchControlTextEventArgs> ParseSearchControlText

Event Data

The ParseSearchControlText event's data class is DevExpress.XtraEditors.ParseSearchControlTextEventArgs.


The SearchControlText event argument returns the query in the search control. Based on the query, you can create a CriteriaOperator object that specifies a filter condition. To apply the condition to the control, use the SetFindCriteriaAndHighlight method.


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 listBoxControl1_ParseSearchControlText(
    object sender, DevExpress.XtraEditors.ParseSearchControlTextEventArgs e) {
    List<string> criteria = new List<string>();
    foreach(string criteriaString in e.SearchControlText.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([LastName], '" + criteria[i] + "')";
        if(i != criteria.Count - 1)
            filterString += " OR ";

    CriteriaOperator _findCriteria = CriteriaOperator.Parse(filterString);

    (x) => {
        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;
See Also