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.Item[Int32] Property

Obtains the TreeListNode object by a specific index in the current node collection.

Namespace: DevExpress.XtraTreeList.Nodes

Assembly: DevExpress.XtraTreeList.v24.2.dll

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

#Declaration

public TreeListNode this[int index] { get; }

#Parameters

Name Type Description
index Int32

The zero-based index of the node to locate. The index is a value between 0 and TreeListNodes.Count - 1.

#Property Value

Type Description
TreeListNode

A TreeListNode child at the specified index within the node collection.

#Remarks

A Tree List nodes form a hierarchy. Each node may have a collection of child nodes, represented by the TreeListNodes class. The Item indexer allows you to access a node’s immediate children. The number of immediate children is specified by the TreeListNodes.Count property.

#Example

The following example demonstrates a way to traverse through root nodes. A Boolean value is assigned to the TreeListNode.Tag property of each visited node. Odd nodes get a true property value, while even nodes get a false value.

bool oddRow = false;
for(int i = 0; i < treeList1.Nodes.Count; i++) {
   treeList1.Nodes[i].Tag = oddRow;
   oddRow = ! oddRow;
}
See Also