Skip to main content

TreeListNodes.Clear() Method

Removes all elements from the current node collection.

Namespace: DevExpress.XtraTreeList.Nodes

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