Hide

SftTree/NET 2.0 - Tree Control for Windows Forms

Display
Print

TagObject Property, CellBaseClass Class

Defines application-specific data.

Class: CellBaseClass
Namespace: Softelvdm.Controls
Assembly: Softelvdm.SftTreeNET

Syntax

public object TagObject { get; set; }
Public Property TagObject As Object

Value

The first object in the CellBaseClass.TagObjects property.

The default value is null/Nothing.

Comments

Defines application-specific data.

The TagObject property accesses the first object in the CellBaseClass.TagObjects property. It is available to simplify access when applications use only one object per cell.

The GenericPartClass.TagString and GenericPartClass.TagObject properties can be used to store application-specific data with each part (within a cell).

Examples

C#

                    cell.Image = img; // add an image to a random column header
                cell.SortIndicatorPosition = SortIndicatorPositionEnum.Default;
            }
            sftTree1.ItemClick += new SftTree.ItemClickEventHandler(sftTree1_ItemClick);
            sftTree1.ItemDoubleClick += new SftTree.ItemDoubleClickEventHandler(sftTree1_ItemDoubleClick);

            // Add a few items
            ItemClass item = sftTree1.ItemCollection.Add(new string [] { "Text 1", "Data 4", "44", "31" } );
            item.Cells[2].TagObject = (long) 44; // we use the actual number for sorting, not the string
            item.Cells[3].TagObject = (long) 31;
            item = sftTree1.ItemCollection.Add(new string[] { "Text 2", "Data 2", "22", "28" });
            item.Cells[2].TagObject = (long) 22; // we use the actual number for sorting, not the string
            item.Cells[3].TagObject = (long) 28;
            item.Cells[3].Image = img; // add an image to a random cell
            item = sftTree1.ItemCollection.Add(new string[] { "Text 3", "Data 43", "11", "233" });
            item.Cells[2].TagObject = (long) 11; // we use the actual number for sorting, not the string

VB.NET

        Dim cell As CellClass = sftTree1.Headers(0, c) ' access each header cell
        cell.Text = "Column " & c.ToString() ' set the title
        If c = 1 Then cell.Image = img ' add an image to a random column header
        cell.SortIndicatorPosition = SortIndicatorPositionEnum.Default
    Next

    ' Add a few items
    Dim item As ItemClass = sftTree1.ItemCollection.Add(New String() {"Text 1", "Data 4", "44", "31"})
    item.Cells(2).TagObject = 44 ' we use the actual number for sorting, not the string
    item.Cells(3).TagObject = 31
    item = sftTree1.ItemCollection.Add(New String() {"Text 2", "Data 2", "22", "28"})
    item.Cells(2).TagObject = 22 ' we use the actual number for sorting, not the string
    item.Cells(3).TagObject = 28
    item.Cells(3).Image = img ' add an image to a random cell
    item = sftTree1.ItemCollection.Add(New String() {"Text 3", "Data 43", "11", "233"})
    item.Cells(2).TagObject = 11 ' we use the actual number for sorting, not the string

See Also CellBaseClass Class | Classes | SftTree/NET 2.0



Spring Break!

Our offices will be closed this week (March 18 through March 22).

We'll be back March 24 to address any pending sales and support issues.