Hide

SftTree/NET 2.0 - Tree Control for Windows Forms

Display
Print

Level Property, ItemClass Class

Returns the item's level number.

Class: ItemClass
Namespace: Softelvdm.SftTreeNET
Assembly: Softelvdm.SftTreeNET

Syntax

public int Level { get; }
Public ReadOnly Property Level As Integer

Value

The level.

Comments

Returns the item's level number.

The root (or highest) level is level 0, dependents are on levels 1, 2, 3 and lower. The first item in the tree control is always at level 0.

An item's level number is determined by its position in the hierarchy represented by all items. The Level property determines the "indentation" of an item.

Examples

C#

            CellClass cell = item.Cells[0];
            cell.Parts.Add(new ImagePartClass(img));
            cell.Parts.Add(new TextPartClass(ItemText));
            item.TagString = "This is a tooltip for an item labeled " + ItemText;
        }

        private void ClickCategory(ItemClass item)
        {
            if (item.Level == 0) {
                bool fWasExpanded = item.Expanded;
                if (fWasExpanded) {
                    item.Collapse(CollapseStyleEnum.All);
                    item.Cells[0].Image = m_PlusImage;
                } else {
                    item.Expand(ExpandStyleEnum.All);
                    item.Cells[0].Image = m_MinusImage;

VB.NET

    Dim item As ItemClass = cat.Add()
    Dim cell As CellClass = item.Cells(0)
    cell.Parts.Add(New ImagePartClass(img))
    cell.Parts.Add(New TextPartClass(ItemText))
    item.TagString = "This is a tooltip for an item labeled " & ItemText
End Sub

Private Sub ClickCategory(ByVal item As ItemClass)
    If item.Level = 0 Then
        Dim fWasExpanded As Boolean = item.Expanded
        If fWasExpanded Then
            item.Collapse(CollapseStyleEnum.All)
            item.Cells(0).Image = m_PlusImage
        Else
            item.Expand(ExpandStyleEnum.All)
            item.Cells(0).Image = m_MinusImage

See Also ItemClass Class | Classes | SftTree/NET 2.0