Table of Contents

Class TreeControlBuilder

Namespace
SharpConsoleUI.Builders
Assembly
SharpConsoleUI.dll

Fluent builder for tree controls

public sealed class TreeControlBuilder
Inheritance
TreeControlBuilder
Inherited Members

Methods

AddRootNode(TreeNode)

Adds a root node to the tree

public TreeControlBuilder AddRootNode(TreeNode node)

Parameters

node TreeNode

The node to add

Returns

TreeControlBuilder

The builder for chaining

AddRootNode(string)

Adds a root node with the specified text

public TreeNode AddRootNode(string text)

Parameters

text string

The text for the node

Returns

TreeNode

The newly created node (for chaining node operations)

AddRootNodes(params TreeNode[])

Adds multiple root nodes to the tree

public TreeControlBuilder AddRootNodes(params TreeNode[] nodes)

Parameters

nodes TreeNode[]

The nodes to add

Returns

TreeControlBuilder

The builder for chaining

AddRootNodes(IEnumerable<TreeNode>)

Adds multiple root nodes to the tree

public TreeControlBuilder AddRootNodes(IEnumerable<TreeNode> nodes)

Parameters

nodes IEnumerable<TreeNode>

The nodes to add

Returns

TreeControlBuilder

The builder for chaining

Build()

Builds the tree control

public TreeControl Build()

Returns

TreeControl

The configured tree control

Centered()

Centers the tree horizontally

public TreeControlBuilder Centered()

Returns

TreeControlBuilder

The builder for chaining

Disabled()

Disables the tree control

public TreeControlBuilder Disabled()

Returns

TreeControlBuilder

The builder for chaining

Enabled(bool)

Sets the enabled state

public TreeControlBuilder Enabled(bool enabled = true)

Parameters

enabled bool

Whether the control is enabled

Returns

TreeControlBuilder

The builder for chaining

OnGotFocus(WindowEventHandler<EventArgs>)

Sets the got focus event handler with window access

public TreeControlBuilder OnGotFocus(WindowEventHandler<EventArgs> handler)

Parameters

handler WindowEventHandler<EventArgs>

Handler that receives sender, event data, and window

Returns

TreeControlBuilder

The builder for chaining

OnGotFocus(EventHandler)

Sets the got focus event handler

public TreeControlBuilder OnGotFocus(EventHandler handler)

Parameters

handler EventHandler

The event handler

Returns

TreeControlBuilder

The builder for chaining

OnLostFocus(WindowEventHandler<EventArgs>)

Sets the lost focus event handler with window access

public TreeControlBuilder OnLostFocus(WindowEventHandler<EventArgs> handler)

Parameters

handler WindowEventHandler<EventArgs>

Handler that receives sender, event data, and window

Returns

TreeControlBuilder

The builder for chaining

OnLostFocus(EventHandler)

Sets the lost focus event handler

public TreeControlBuilder OnLostFocus(EventHandler handler)

Parameters

handler EventHandler

The event handler

Returns

TreeControlBuilder

The builder for chaining

OnNodeExpandCollapse(WindowEventHandler<TreeNodeEventArgs>)

Sets the node expand/collapse event handler with window access

public TreeControlBuilder OnNodeExpandCollapse(WindowEventHandler<TreeNodeEventArgs> handler)

Parameters

handler WindowEventHandler<TreeNodeEventArgs>

Handler that receives sender, event data, and window

Returns

TreeControlBuilder

The builder for chaining

OnNodeExpandCollapse(EventHandler<TreeNodeEventArgs>)

Sets the node expand/collapse event handler

public TreeControlBuilder OnNodeExpandCollapse(EventHandler<TreeNodeEventArgs> handler)

Parameters

handler EventHandler<TreeNodeEventArgs>

The event handler

Returns

TreeControlBuilder

The builder for chaining

OnSelectedNodeChanged(WindowEventHandler<TreeNodeEventArgs>)

Sets the selected node changed event handler with window access

public TreeControlBuilder OnSelectedNodeChanged(WindowEventHandler<TreeNodeEventArgs> handler)

Parameters

handler WindowEventHandler<TreeNodeEventArgs>

Handler that receives sender, event data, and window

Returns

TreeControlBuilder

The builder for chaining

OnSelectedNodeChanged(EventHandler<TreeNodeEventArgs>)

Sets the selected node changed event handler

public TreeControlBuilder OnSelectedNodeChanged(EventHandler<TreeNodeEventArgs> handler)

Parameters

handler EventHandler<TreeNodeEventArgs>

The event handler

Returns

TreeControlBuilder

The builder for chaining

Visible(bool)

Sets the visibility

public TreeControlBuilder Visible(bool visible = true)

Parameters

visible bool

Whether the control is visible

Returns

TreeControlBuilder

The builder for chaining

WithAlignment(HorizontalAlignment)

Sets the horizontal alignment

public TreeControlBuilder WithAlignment(HorizontalAlignment alignment)

Parameters

alignment HorizontalAlignment

The horizontal alignment

Returns

TreeControlBuilder

The builder for chaining

WithBackgroundColor(Color)

Sets the background color

public TreeControlBuilder WithBackgroundColor(Color color)

Parameters

color Color

The background color

Returns

TreeControlBuilder

The builder for chaining

WithColors(Color, Color)

Sets the background and foreground colors

public TreeControlBuilder WithColors(Color foreground, Color background)

Parameters

foreground Color

The foreground color

background Color

The background color

Returns

TreeControlBuilder

The builder for chaining

WithForegroundColor(Color)

Sets the foreground color

public TreeControlBuilder WithForegroundColor(Color color)

Parameters

color Color

The foreground color

Returns

TreeControlBuilder

The builder for chaining

WithGuide(TreeGuide)

Sets the tree guide style

public TreeControlBuilder WithGuide(TreeGuide guide)

Parameters

guide TreeGuide

The guide style

Returns

TreeControlBuilder

The builder for chaining

WithHeight(int)

Sets the height

public TreeControlBuilder WithHeight(int height)

Parameters

height int

The control height

Returns

TreeControlBuilder

The builder for chaining

WithHighlightColors(Color, Color)

Sets the highlight colors for selected items

public TreeControlBuilder WithHighlightColors(Color foreground, Color background)

Parameters

foreground Color

The highlight foreground color

background Color

The highlight background color

Returns

TreeControlBuilder

The builder for chaining

WithIndent(string)

Sets the indent string for each level

public TreeControlBuilder WithIndent(string indent)

Parameters

indent string

The indent string

Returns

TreeControlBuilder

The builder for chaining

WithMargin(int)

Sets uniform margin

public TreeControlBuilder WithMargin(int margin)

Parameters

margin int

The margin value for all sides

Returns

TreeControlBuilder

The builder for chaining

WithMargin(int, int, int, int)

Sets the margin

public TreeControlBuilder WithMargin(int left, int top, int right, int bottom)

Parameters

left int

Left margin

top int

Top margin

right int

Right margin

bottom int

Bottom margin

Returns

TreeControlBuilder

The builder for chaining

WithMaxVisibleItems(int)

Sets the maximum number of visible items

public TreeControlBuilder WithMaxVisibleItems(int count)

Parameters

count int

The maximum visible items

Returns

TreeControlBuilder

The builder for chaining

WithName(string)

Sets the control name for lookup

public TreeControlBuilder WithName(string name)

Parameters

name string

The control name

Returns

TreeControlBuilder

The builder for chaining

WithStickyPosition(StickyPosition)

Sets the sticky position

public TreeControlBuilder WithStickyPosition(StickyPosition position)

Parameters

position StickyPosition

The sticky position

Returns

TreeControlBuilder

The builder for chaining

WithTag(object)

Sets a tag object

public TreeControlBuilder WithTag(object tag)

Parameters

tag object

The tag object

Returns

TreeControlBuilder

The builder for chaining

WithVerticalAlignment(VerticalAlignment)

Sets the vertical alignment

public TreeControlBuilder WithVerticalAlignment(VerticalAlignment alignment)

Parameters

alignment VerticalAlignment

The vertical alignment

Returns

TreeControlBuilder

The builder for chaining

WithWidth(int)

Sets the width

public TreeControlBuilder WithWidth(int width)

Parameters

width int

The control width

Returns

TreeControlBuilder

The builder for chaining

Operators

implicit operator TreeControl(TreeControlBuilder)

Implicit conversion to TreeControl

public static implicit operator TreeControl(TreeControlBuilder builder)

Parameters

builder TreeControlBuilder

The builder

Returns

TreeControl

The built tree control