Skip to main content

TreeList.AddFilter(CriteriaOperator) Method

Adds a CriteriaOperator-based filter to the current TreeList.

Namespace: DevExpress.XtraTreeList

Assembly: DevExpress.XtraTreeList.v24.1.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