Hide

SftTree/NET 2.0 - Tree Control for Windows Forms

Display
Print

Selected Property, ItemClass Class

Defines whether this item is selected.

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

Syntax

public bool Selected { get; set; }
Public Property Selected As Boolean

Value

True if selected, otherwise False.

Comments

Defines whether this item is selected.

The Selected property is only available if the SftTree.SelectionStyle property allows item selection (SelectionStyleEnum.SingleItem, SelectionStyleEnum.MultipleItems). It cannot be used if cell selection (SelectionStyleEnum.SingleCell, SelectionStyleEnum.MultipleCells, SelectionStyleEnum.BlockOfCells) is in effect.

When an item is selected, the SelectionChanged event occurs.

Examples

C#

                    } else
                        newItem = sftTree1.ItemCollection.Add(s);
                }
            }
            sftTree1.Columns.MakeOptimal(0, false);
            sftTree1.RecalcHorizontalExtent();
            newItem.ScrollIntoView();
            sftTree1.FocusObject = newItem;
            newItem.Selected = true;
            sftTree1.Initializing = false;
        }

        // This is a small helper routine to show all properties and fields of an object
        private void DumpValues(object o) {
            PropertyInfo[] api = o.GetType().GetProperties();
            foreach (PropertyInfo pi in api)

VB.NET

                newItem = sftTree1.ItemCollection.Add(s)
            End If
        Next
    End If
    sftTree1.Columns.MakeOptimal(0, False)
    sftTree1.RecalcHorizontalExtent()
    newItem.ScrollIntoView()
    sftTree1.FocusObject = newItem
    newItem.Selected = True
    sftTree1.Initializing = False
End Sub

' This is a small helper routine to show all properties and fields of an object
Private Sub DumpValues(ByVal o As Object)
    Dim api() As PropertyInfo = o.GetType().GetProperties()
    For Each pi As PropertyInfo In api

See Also ItemClass Class | Classes | SftTree/NET 2.0