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 Tree |
#Property Value
Type | Description |
---|---|
Tree |
A Tree |
#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;
}