TreeViewNode Class

A node of a tree view: a file or a directory, with its children.

public sealed class TreeViewNode

Constructors

NameDescription
TreeViewNode(string)Initializes a new instance of the TreeViewNode class.

TreeViewNode(string)

TreeViewNode.cs

Initializes a new instance of the TreeViewNode class.

public TreeViewNode(string name)

Parameters

name string
The name. It can contain spaces, and be empty.

Properties

NameDescription
ChildrenGets the children.
CssClassGets or sets the CSS class of the row, or null for none. The class highlight draws the row on an amber background (Mermaid :::class).
DescriptionGets or sets the description, shown in italic in a column after the names, or null for none (Mermaid ## text).
IconGets or sets the icon: file or folder for the built-in icons, an icon of an icon pack of Mermaid such as logos:react (drawn as a question mark), none to hide the icon, or null for the icon TreeViewDiagram.ShowIcons gives (Mermaid icon(name)).
IsDirectoryGets or sets a value that indicates whether the node is a directory, drawn in bold (Mermaid: a name that ends with /).
NameGets or sets the name, shown as is.

Gets the children.

public IList<TreeViewNode> Children { get; }

Property value

IList<TreeViewNode>

Gets or sets the CSS class of the row, or null for none. The class highlight draws the row on an amber background (Mermaid :::class).

public string? CssClass { get; set; }

Property value

string?

Description

TreeViewNode.cs

Gets or sets the description, shown in italic in a column after the names, or null for none (Mermaid ## text).

public string? Description { get; set; }

Property value

string?

Gets or sets the icon: file or folder for the built-in icons, an icon of an icon pack of Mermaid such as logos:react (drawn as a question mark), none to hide the icon, or null for the icon TreeViewDiagram.ShowIcons gives (Mermaid icon(name)).

public string? Icon { get; set; }

Property value

string?

IsDirectory

TreeViewNode.cs

Gets or sets a value that indicates whether the node is a directory, drawn in bold (Mermaid: a name that ends with /).

public bool IsDirectory { get; set; }

Property value

bool

Gets or sets the name, shown as is.

public string Name { get; set; }

Property value

string

Methods

NameDescription
AddChild(string, bool)Adds a child.
ToString()Returns the name.

AddChild(string, bool)

TreeViewNode.cs

Adds a child.

public TreeViewNode AddChild(string name, bool isDirectory = false)

Parameters

name string
The name.
isDirectory bool
Whether the child is a directory.

Returns

TreeViewNode The child.

ToString()

TreeViewNode.cs

Returns the name.

public override string ToString()

Returns

string The name.