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(CriteriaOperator) Method

Adds a CriteriaOperator-based filter 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(
    CriteriaOperator filterCriteria
)

#Parameters

Name Type Description
filterCriteria CriteriaOperator

A CriteriaOperator object that contains a filtering condition.

#Remarks

You can add filters to your TreeList to display required nodes. It is up to you to decide whether to pass a string value to the TreeList.AddFilter or a CriteriaOperator object. See the Creating Criteria topic to learn more about creating criteria objects.

Below is an example of adding a criteria-based filter to a TreeList, which displays only those nodes whose ‘Node value’ TreeListColumn.FieldName equals ‘A’:

private void cmdCriteriaFilter_Click(object sender, EventArgs e) {
            DevExpress.Data.Filtering.CriteriaOperator filterOperator = new BinaryOperator(new OperandProperty("Node Value"), new OperandValue("A"), BinaryOperatorType.Equal);
            treeList1.AddFilter(filterOperator );
        }
See Also