Hide

SftTree/NET 2.0 - Tree Control for Windows Forms

Display
Print

TagString Property, ItemClass Class

Defines an application-specific string.

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

Syntax

public string TagString { get; set; }
Public Property TagString As String

Value

An application-specific string.

The default value is null/Nothing.

Comments

Defines an application-specific string.

The TagString property can be used by an application to attach an application-specific string to an item. The string stored in the TagString property is serialized when items are saved/loaded.

The string is not used by controls in any way.

The ItemClass.TagObjects property can be used to store additional application-specific objects.

The CellBaseClass.TagString and CellBaseClass.TagObjects properties can be used to store application-specific with cells.

Examples

C#

        }

        private ItemClass AddCategory(string Category) {
            ItemClass item = sftTree1.ItemCollection.Add();
            CellClass cell = item.Cells[0];
            cell.Appearance = BackgroundAppearanceEnum.ThemedSystemHeaderNeverPressed;
            cell.Parts.Add(new ImagePartClass(m_PlusImage));
            cell.Parts.Add(new TextPartClass(Category));
            item.TagString = "This is a tooltip explaining " + Category;
            return item;
        }
        private void AddItem(ItemClass cat, Image img, string ItemText) {
            ItemClass item = cat.Add();
            CellClass cell = item.Cells[0];
            cell.Parts.Add(new ImagePartClass(img));
            cell.Parts.Add(new TextPartClass(ItemText));

VB.NET

End Sub

Private Function AddCategory(ByVal Category As String) As ItemClass
    Dim item As ItemClass = sftTree1.ItemCollection.Add()
    Dim cell As CellClass = item.Cells(0)
    cell.Appearance = BackgroundAppearanceEnum.ThemedSystemHeaderNeverPressed
    cell.Parts.Add(New ImagePartClass(m_PlusImage))
    cell.Parts.Add(New TextPartClass(Category))
    item.TagString = "This is a tooltip explaining " & Category
    Return item
End Function

Private Sub AddItem(ByVal cat As ItemClass, ByVal img As Image, ByVal ItemText As String)
    Dim item As ItemClass = cat.Add()
    Dim cell As CellClass = item.Cells(0)
    cell.Parts.Add(New ImagePartClass(img))

See Also ItemClass Class | Classes | SftTree/NET 2.0