Skip to content

TreeItem

Eduard Gushchin edited this page Jun 22, 2026 · 3 revisions

Home | API by Category | Complete API Index | API Compatibility

Field Value
Full name Electron2D.TreeItem
Namespace Electron2D
Kind class
Category UI and Text

Overview

Stores one row of data inside a Electron2D.Tree control.

Syntax

public class Electron2D.TreeItem : Electron2D.Object

Remarks

TreeItem owns per-column text, icon, selection and selectable state. Items are normally created through Electron2D.Tree.CreateItem(Electron2D.TreeItem,System.Int32) so they can participate in tree selection and visible traversal.

A standalone item created with the public constructor can store data, but it has no owning tree until a tree creates or attaches it internally.

Thread Safety

This type is not synchronized. Create and mutate tree items on the main scene thread.

Since

This type is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Tree

Members

Member Kind Summary
Electron2D.TreeItem() Constructor Initializes a new standalone instance of the Electron2D.TreeItem class.
Deselect(System.Int32) Method Clears selection for one column.
GetChild(System.Int32) Method Gets a direct child item.
GetChildCount() Method Gets the number of direct child items.
GetIcon(System.Int32) Method Gets an icon from a column.
GetNext() Method Gets the next sibling item.
GetNextVisible() Method Gets the next visible item in owning tree traversal order.
GetParent() Method Gets the parent item.
GetPrevious() Method Gets the previous sibling item.
GetText(System.Int32) Method Gets text from a column.
GetTree() Method Gets the tree that owns this item.
IsCollapsed() Method Reports whether this item is collapsed.
IsSelectable(System.Int32) Method Reports whether a column can be selected.
IsSelected(System.Int32) Method Reports whether one column is selected.
Select(System.Int32, System.Boolean) Method Selects this item in its owning tree.
SetCollapsed(System.Boolean) Method Sets whether this item hides its descendants in visible traversal.
SetIcon(System.Int32, Electron2D.Texture2D) Method Sets an icon for a column.
SetSelectable(System.Int32, System.Boolean) Method Sets whether a column can be selected.
SetText(System.Int32, System.String) Method Sets text for a column.

Member Details

Electron2D.TreeItem()

Kind: Constructor

public Electron2D.TreeItem()

Summary

Initializes a new standalone instance of the Electron2D.TreeItem class.

Remarks

Standalone items can store per-column data but are not visible in a Electron2D.Tree until created by that tree.

Thread Safety

This constructor is not synchronized. Call it from the main scene thread.

Since

This constructor is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Tree.CreateItem(Electron2D.TreeItem,System.Int32)

Deselect(System.Int32)

Kind: Method

public System.Void Deselect(System.Int32)(System.Int32 column)

Summary

Clears selection for one column.

Remarks

Calling this method for an unselected column is a no-op.

Parameters

  • column: The zero-based column index.

Exceptions

  • System.ArgumentOutOfRangeException: Thrown when column is negative.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.TreeItem.Select(System.Int32,System.Boolean)

GetChild(System.Int32)

Kind: Method

public Electron2D.TreeItem GetChild(System.Int32)(System.Int32 index)

Summary

Gets a direct child item.

Remarks

Negative indices are not normalized in the preview implementation.

Parameters

  • index: The child index.

Returns

The child item, or null when index is outside the child list.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.TreeItem.GetChildCount

GetChildCount()

Kind: Method

public System.Int32 GetChildCount()()

Summary

Gets the number of direct child items.

Remarks

Collapsed state does not affect this count.

Returns

The direct child count.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.TreeItem.GetChild(System.Int32)

GetIcon(System.Int32)

Kind: Method

public Electron2D.Texture2D GetIcon(System.Int32)(System.Int32 column)

Summary

Gets an icon from a column.

Remarks

Missing cells are treated as cells without an icon.

Parameters

  • column: The zero-based column index.

Returns

The stored icon, or null when no icon is stored.

Exceptions

  • System.ArgumentOutOfRangeException: Thrown when column is negative.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.TreeItem.SetIcon(System.Int32,Electron2D.Texture2D)

GetNext()

Kind: Method

public Electron2D.TreeItem GetNext()()

Summary

Gets the next sibling item.

Remarks

This method does not descend into child items.

Returns

The next sibling, or null when this item is the last sibling.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.TreeItem.GetPrevious

GetNextVisible()

Kind: Method

public Electron2D.TreeItem GetNextVisible()()

Summary

Gets the next visible item in owning tree traversal order.

Remarks

Collapsed descendants and a hidden root are skipped by the owning tree.

Returns

The next visible item, or null when there is no owning tree or no later visible item.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Tree.GetItemAtPosition(Electron2D.Vector2)

GetParent()

Kind: Method

public Electron2D.TreeItem GetParent()()

Summary

Gets the parent item.

Remarks

Parentage is managed by Electron2D.Tree.CreateItem(Electron2D.TreeItem,System.Int32).

Returns

The parent item, or null when this item is the root or standalone.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.TreeItem.GetChild(System.Int32)

GetPrevious()

Kind: Method

public Electron2D.TreeItem GetPrevious()()

Summary

Gets the previous sibling item.

Remarks

This method does not inspect parent or child items.

Returns

The previous sibling, or null when this item is the first sibling.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.TreeItem.GetNext

GetText(System.Int32)

Kind: Method

public System.String GetText(System.Int32)(System.Int32 column)

Summary

Gets text from a column.

Remarks

Missing cells are treated as empty cells.

Parameters

  • column: The zero-based column index.

Returns

The stored text, or an empty string when no text is stored.

Exceptions

  • System.ArgumentOutOfRangeException: Thrown when column is negative.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.TreeItem.SetText(System.Int32,System.String)

GetTree()

Kind: Method

public Electron2D.Tree GetTree()()

Summary

Gets the tree that owns this item.

Remarks

The value is assigned when an item is created by a tree.

Returns

The owning Electron2D.Tree, or null for standalone items.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Tree

IsCollapsed()

Kind: Method

public System.Boolean IsCollapsed()()

Summary

Reports whether this item is collapsed.

Remarks

Collapsing an item does not remove descendants from the data tree.

Returns

true when descendants are hidden; otherwise, false.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.TreeItem.SetCollapsed(System.Boolean)

IsSelectable(System.Int32)

Kind: Method

public System.Boolean IsSelectable(System.Int32)(System.Int32 column)

Summary

Reports whether a column can be selected.

Remarks

Missing cells are selectable by default.

Parameters

  • column: The zero-based column index.

Returns

true when the column is selectable; otherwise, false.

Exceptions

  • System.ArgumentOutOfRangeException: Thrown when column is negative.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.TreeItem.SetSelectable(System.Int32,System.Boolean)

IsSelected(System.Int32)

Kind: Method

public System.Boolean IsSelected(System.Int32)(System.Int32 column)

Summary

Reports whether one column is selected.

Remarks

Missing cells are not selected.

Parameters

  • column: The zero-based column index.

Returns

true when the column is selected; otherwise, false.

Exceptions

  • System.ArgumentOutOfRangeException: Thrown when column is negative.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.TreeItem.Select(System.Int32,System.Boolean)

Select(System.Int32, System.Boolean)

Kind: Method

public System.Void Select(System.Int32, System.Boolean)(System.Int32 column, System.Boolean setAsCursor)

Summary

Selects this item in its owning tree.

Remarks

Standalone items update local selected state but cannot change a tree cursor or emit tree signals.

Parameters

  • column: The zero-based selected column.
  • setAsCursor: Whether this item should become the tree cursor.

Exceptions

  • System.ArgumentOutOfRangeException: Thrown when column is negative.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.TreeItem.Deselect(System.Int32)

SetCollapsed(System.Boolean)

Kind: Method

public System.Void SetCollapsed(System.Boolean)(System.Boolean enable)

Summary

Sets whether this item hides its descendants in visible traversal.

Remarks

Changing collapsed state queues the owning tree for redraw and emits item_collapsed from that tree.

Parameters

  • enable: true to collapse descendants; otherwise, false.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.TreeItem.IsCollapsed

SetIcon(System.Int32, Electron2D.Texture2D)

Kind: Method

public System.Void SetIcon(System.Int32, Electron2D.Texture2D)(System.Int32 column, Electron2D.Texture2D icon)

Summary

Sets an icon for a column.

Remarks

Icons are optional and do not affect selection.

Parameters

  • column: The zero-based column index.
  • icon: The icon texture, or null to remove it.

Exceptions

  • System.ArgumentOutOfRangeException: Thrown when column is negative.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.TreeItem.GetIcon(System.Int32)

SetSelectable(System.Int32, System.Boolean)

Kind: Method

public System.Void SetSelectable(System.Int32, System.Boolean)(System.Int32 column, System.Boolean selectable)

Summary

Sets whether a column can be selected.

Remarks

Making a selected column non-selectable clears its selected state.

Parameters

  • column: The zero-based column index.
  • selectable: true to allow selection; otherwise, false.

Exceptions

  • System.ArgumentOutOfRangeException: Thrown when column is negative.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.TreeItem.IsSelectable(System.Int32)

SetText(System.Int32, System.String)

Kind: Method

public System.Void SetText(System.Int32, System.String)(System.Int32 column, System.String text)

Summary

Sets text for a column.

Remarks

Assigning text queues the owning tree for redraw when one exists.

Parameters

  • column: The zero-based column index.
  • text: The text to store.

Exceptions

  • System.ArgumentOutOfRangeException: Thrown when column is negative.
  • System.ArgumentNullException: Thrown when text is null.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.TreeItem.GetText(System.Int32)

Clone this wiki locally