Hide

SftTree/NET 2.0 - Tree Control for Windows Forms

Display
Print

Collapse Method, ItemCollectionClass Class

Expands all items in the item collection so their dependents become visible.

Class: ItemCollectionClass
Namespace: Softelvdm.SftTreeNET
Assembly: Softelvdm.SftTreeNET

Syntax

public void Collapse( CollapseStyleEnum Style );
Public Sub Collapse( ByVal Style As CollapseStyleEnum )

Parameters

Style

Defines how the items and their dependents are expanded.

Comments

Expands all items in the item collection so their dependents become visible.

This method can only be used for items in the item area.

Examples

C#

            sftTree1.Initializing = true;
            sftTree1.Columns.Count = 1;
            for (int i = 0 ; i < 10 ; ++i) {
                ItemClass item = sftTree1.ItemCollection.Add("Item " + i.ToString());
                for (int ic = 0 ; ic < 10 ; ++ic) {
                    ItemClass child = item.Add("Child item " + ic.ToString());
                }
            }
            sftTree1.ItemCollection.Collapse(CollapseStyleEnum.All);
            sftTree1.Columns.MakeOptimal(0, false);
            sftTree1.RecalcHorizontalExtent();

            // We need to set up the tree control as a drop target
            sftTree1.AllowDrop = true;
            sftTree1.AutoExpandDragDrop = true;
            sftTree1.AutoExpandArea = AutoExpandAreaEnum.AllColumns;

VB.NET

    sftTree1.Columns.Count = 1
    For i As Integer = 0 To 9
        Dim item As ItemClass = sftTree1.ItemCollection.Add("Item " & i.ToString())
        For ic As Integer = 0 To 9
            Dim child As ItemClass
            child = item.Add("Child item " & ic.ToString())
        Next
    Next
    sftTree1.ItemCollection.Collapse(CollapseStyleEnum.All)
    sftTree1.Columns.MakeOptimal(0, False)
    sftTree1.RecalcHorizontalExtent()

    ' We need to set up the tree control as a drop target
    sftTree1.AllowDrop = True
    sftTree1.AutoExpandDragDrop = True
    sftTree1.AutoExpandArea = AutoExpandAreaEnum.AllColumns

See Also ItemCollectionClass Class | Classes | SftTree/NET 2.0