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.Remove(TreeListNode) Method

Removes a specific node from the node collection.

Namespace: DevExpress.XtraTreeList.Nodes

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