Skip to main content

TreeListNodes.Remove(TreeListNode) Method

Removes a specific node from the node collection.

Namespace: DevExpress.XtraTreeList.Nodes

Assembly: DevExpress.XtraTreeList.v24.1.dll

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

Declaration

public void Remove(
    TreeListNode node
)

Parameters

Name Type Description
node TreeListNode

The node to remove from the node collection.

Remarks

To remove a node at a specific position you can use the TreeListNodes.RemoveAt method. It takes an integer index from the range between 0 and child node count -1.

Example

The next example removes the focused node from the Tree List. The TreeListNodes.Remove method is used for this purpose. Note that the same operation can be performed using the TreeList.DeleteNode method.

TreeListNode node = treeList1.FocusedNode;
if(node.ParentNode != null)
   node.ParentNode.Nodes.Remove(node);
else
   treeList1.Nodes.Remove(node);
See Also