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

TreeListNodes.Clear() Method

In This Article

Removes all elements from the current node collection.

Namespace: DevExpress.XtraTreeList.Nodes

Assembly: DevExpress.XtraTreeList.v24.2.dll

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

#Declaration

public void Clear()

#Remarks

A node’s child nodes are stored in the TreeList.Nodes collection. Use the Clear method to remove all child nodes of a specific node.

using DevExpress.XtraTreeList.Nodes.Operations;

treeList1.NodesIterator.DoOperation(new MyOperation(colDEPARTMENT));

public class MyOperation : TreeListOperation {
    public TreeListColumn column;
    public MyOperation(TreeListColumn column) {
        this.column = column;
    }
    public override void Execute(TreeListNode node) {
        if (node.GetValue(column).ToString().Contains("Marketing"))
            node.Nodes.Clear();
    }
}
See Also