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

TreeList.AddFilter(String) Method

Adds a predefined filter with a string filtering condition to the current TreeList.

Namespace: DevExpress.XtraTreeList

Assembly: DevExpress.XtraTreeList.v24.2.dll

NuGet Packages: DevExpress.Win.Navigation, DevExpress.Win.TreeList

#Declaration

public void AddFilter(
    string filterString
)

#Parameters

Name Type Description
filterString String

A String value that is the filtering condition.

#Remarks

You can manually define a filter and add it to your TreeList control. The filterString parameter should be an exact filtering query. If a column’s TreeListColumn.FieldName or a filter condition is written incorrectly, the filtering will not occur. Below is an example of adding a filter via the AddFilter method:

private void cmdFindRoot_Click(object sender, EventArgs e) {
            treeList1.AddFilter("[Node Name] = 'Root Node' And [Value] = 'A' And [Node Description] <> 'Secondary node'");
        }

You can also define a CriteriaOperator object and pass it to the TreeList.AddFilter method. See the method overload list to learn more.

See Also