Table of Contents

Class TreeViewNode

Namespace
Myra.Graphics2D.UI
Assembly
Myra.dll

A node in a tree view that can contain content and have child nodes.

public class TreeViewNode : ContentControl, IItemWithId, INotifyAttachedPropertyChanged, IContent, ITreeViewNode
Inheritance
TreeViewNode
Implements
Inherited Members

Properties

ChildNodesCount

Gets the number of child nodes under this node.

public int ChildNodesCount { get; }

Property Value

int

Content

Gets or sets the widget displayed as the node's content.

public override Widget Content { get; set; }

Property Value

Widget

ContentHeight

Gets the height of the node's content area in pixels.

public int ContentHeight { get; }

Property Value

int

IsExpanded

Gets or sets a value indicating whether the node is expanded to show its child nodes.

public bool IsExpanded { get; set; }

Property Value

bool

Mark

Gets the toggle button used to expand or collapse the node.

public ToggleButton Mark { get; }

Property Value

ToggleButton

ParentNode

Gets or sets the parent node of this node in the hierarchy.

public TreeViewNode ParentNode { get; }

Property Value

TreeViewNode

Methods

AddSubNode(Widget)

Adds a new child node to this node with the specified content.

public TreeViewNode AddSubNode(Widget content)

Parameters

content Widget

The widget to display as the child node's content.

Returns

TreeViewNode

The newly created child node.

ApplyStyle(WidgetStyle)

Applies the specified widget style to this tree view node.

protected override void ApplyStyle(WidgetStyle style)

Parameters

style WidgetStyle

The widget style to apply.

ApplyTreeStyle(TreeStyle)

Applies the specified tree style to this tree view node.

public void ApplyTreeStyle(TreeStyle style)

Parameters

style TreeStyle

The tree style to apply.

GetSubNode(int)

Gets a child node by its index within this node.

public TreeViewNode GetSubNode(int index)

Parameters

index int

The zero-based index of the child node.

Returns

TreeViewNode

The child node at the specified index.

RemoveAllSubNodes()

Removes all child nodes from this node and updates the mark visibility.

public virtual void RemoveAllSubNodes()

RemoveSubNode(TreeViewNode)

Removes a specific child node from this node and clears related state in the tree view.

public void RemoveSubNode(TreeViewNode subNode)

Parameters

subNode TreeViewNode

The child node to remove.

RemoveSubNodeAt(int)

Removes the child node at the specified index and clears related state in the tree view.

public void RemoveSubNodeAt(int index)

Parameters

index int

The zero-based index of the child node to remove.

UpdateMark()

Updates the visibility of the mark (expand/collapse button) based on the number of child nodes.

protected virtual void UpdateMark()