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
textstringThe text label for the node.
Properties
Children
Gets the children of this node.
public ReadOnlyCollection<TreeNode> Children { get; }
Property Value
IsExpanded
Gets or sets whether this node is expanded.
public bool IsExpanded { get; set; }
Property Value
Tag
Gets or sets a custom object associated with this node.
public object? Tag { get; set; }
Property Value
Text
Gets or sets the text label of this node.
public string Text { get; set; }
Property Value
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
nodeTreeNodeThe 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
textstringThe 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
nodeTreeNodeThe node to remove.
Returns
- bool
True if the node was found and removed, false otherwise.