Table of Contents

Class TreeNode

Namespace
SharpConsoleUI.Controls
Assembly
SharpConsoleUI.dll

Represents a tree node in the TreeControl.

public class TreeNode
Inheritance
TreeNode
Inherited Members

Constructors

TreeNode(string)

Creates a new tree node with specified text.

public TreeNode(string text)

Parameters

text string

The text label for the node.

Properties

Children

Gets the children of this node.

public ReadOnlyCollection<TreeNode> Children { get; }

Property Value

ReadOnlyCollection<TreeNode>

IsExpanded

Gets or sets whether this node is expanded.

public bool IsExpanded { get; set; }

Property Value

bool

Tag

Gets or sets a custom object associated with this node.

public object? Tag { get; set; }

Property Value

object

Text

Gets or sets the text label of this node.

public string Text { get; set; }

Property Value

string

TextColor

Gets or sets the optional color for this node's text.

public Color? TextColor { get; set; }

Property Value

Color?

Methods

AddChild(TreeNode)

Adds a child node to this node.

public TreeNode AddChild(TreeNode node)

Parameters

node TreeNode

The child node to add.

Returns

TreeNode

The added child node.

AddChild(string)

Adds a child node with specified text.

public TreeNode AddChild(string text)

Parameters

text string

The text label for the child node.

Returns

TreeNode

The newly created and added child node.

ClearChildren()

Clears all child nodes.

public void ClearChildren()

RemoveChild(TreeNode)

Removes a child node.

public bool RemoveChild(TreeNode node)

Parameters

node TreeNode

The node to remove.

Returns

bool

True if the node was found and removed, false otherwise.