windowsforms-devexpress-dot-xtratreelist-dot-nodes-dot-treelistnode-d3afa56d.md
Returns the nesting level of a node.
Namespace : DevExpress.XtraTreeList.Nodes
Assembly : DevExpress.XtraTreeList.v25.2.dll
NuGet Packages : DevExpress.Win.Navigation, DevExpress.Win.TreeList
[Browsable(false)]
[DXCategory("Layout")]
public int Level { get; }
<Browsable(False)>
<DXCategory("Layout")>
Public ReadOnly Property Level As Integer
| Type | Description |
|---|---|
| Int32 |
The nesting level of a node.
|
The nesting level determines how many nodes you must expand to reach the current node from the root. Topmost nodes in the Tree List are referred to as root tree nodes. The Level of root nodes is zero. The Level of root node children is 1 etc.
The following image displays levels with different colors.
The following code snippets (auto-collected from DevExpress Examples) contain references to the Level property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.
winforms-treelist-implement-group-level-style-feature/CS/Q220534/Form1.cs#L40
if (currentNode.HasChildren)
rects.Add(currentNode.Level, new Rectangle(bounds.Right - viewInfo.RC.LevelWidth, bounds.Y, viewInfo.RC.LevelWidth, bounds.Height));
bounds = new Rectangle(bounds.Location, new Size(bounds.Width - viewInfo.RC.LevelWidth, bounds.Height));
winforms-treelist-show-checkboxes-for-specific-level/CS/WindowsApplication1/Form1.cs#L77
return true;
return node.Level == Level;
}
winforms-treelist-implement-group-level-style-feature/VB/Q220534/Form1.vb#L39
If currentNode.HasChildren Then
rects.Add(currentNode.Level, New Rectangle(bounds.Right - viewInfo.RC.LevelWidth, bounds.Y, viewInfo.RC.LevelWidth, bounds.Height))
End If
winforms-treelist-show-checkboxes-for-specific-level/VB/WindowsApplication1/Form1.vb#L84
If Level = -1 Then Return True
Return node.Level = Level
End Function
See Also