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
nodeTreeNodeThe 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
textstringThe 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
nodesTreeNode[]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
nodesIEnumerable<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
enabledboolWhether 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
handlerWindowEventHandler<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
handlerEventHandlerThe 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
handlerWindowEventHandler<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
handlerEventHandlerThe 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
handlerWindowEventHandler<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
handlerEventHandler<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
handlerWindowEventHandler<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
handlerEventHandler<TreeNodeEventArgs>The event handler
Returns
- TreeControlBuilder
The builder for chaining
Visible(bool)
Sets the visibility
public TreeControlBuilder Visible(bool visible = true)
Parameters
visibleboolWhether the control is visible
Returns
- TreeControlBuilder
The builder for chaining
WithAlignment(HorizontalAlignment)
Sets the horizontal alignment
public TreeControlBuilder WithAlignment(HorizontalAlignment alignment)
Parameters
alignmentHorizontalAlignmentThe horizontal alignment
Returns
- TreeControlBuilder
The builder for chaining
WithBackgroundColor(Color)
Sets the background color
public TreeControlBuilder WithBackgroundColor(Color color)
Parameters
colorColorThe 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
foregroundColorThe foreground color
backgroundColorThe background color
Returns
- TreeControlBuilder
The builder for chaining
WithForegroundColor(Color)
Sets the foreground color
public TreeControlBuilder WithForegroundColor(Color color)
Parameters
colorColorThe foreground color
Returns
- TreeControlBuilder
The builder for chaining
WithGuide(TreeGuide)
Sets the tree guide style
public TreeControlBuilder WithGuide(TreeGuide guide)
Parameters
guideTreeGuideThe guide style
Returns
- TreeControlBuilder
The builder for chaining
WithHeight(int)
Sets the height
public TreeControlBuilder WithHeight(int height)
Parameters
heightintThe 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
foregroundColorThe highlight foreground color
backgroundColorThe highlight background color
Returns
- TreeControlBuilder
The builder for chaining
WithIndent(string)
Sets the indent string for each level
public TreeControlBuilder WithIndent(string indent)
Parameters
indentstringThe indent string
Returns
- TreeControlBuilder
The builder for chaining
WithMargin(int)
Sets uniform margin
public TreeControlBuilder WithMargin(int margin)
Parameters
marginintThe 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
Returns
- TreeControlBuilder
The builder for chaining
WithMaxVisibleItems(int)
Sets the maximum number of visible items
public TreeControlBuilder WithMaxVisibleItems(int count)
Parameters
countintThe maximum visible items
Returns
- TreeControlBuilder
The builder for chaining
WithName(string)
Sets the control name for lookup
public TreeControlBuilder WithName(string name)
Parameters
namestringThe control name
Returns
- TreeControlBuilder
The builder for chaining
WithStickyPosition(StickyPosition)
Sets the sticky position
public TreeControlBuilder WithStickyPosition(StickyPosition position)
Parameters
positionStickyPositionThe sticky position
Returns
- TreeControlBuilder
The builder for chaining
WithTag(object)
Sets a tag object
public TreeControlBuilder WithTag(object tag)
Parameters
tagobjectThe tag object
Returns
- TreeControlBuilder
The builder for chaining
WithVerticalAlignment(VerticalAlignment)
Sets the vertical alignment
public TreeControlBuilder WithVerticalAlignment(VerticalAlignment alignment)
Parameters
alignmentVerticalAlignmentThe vertical alignment
Returns
- TreeControlBuilder
The builder for chaining
WithWidth(int)
Sets the width
public TreeControlBuilder WithWidth(int width)
Parameters
widthintThe 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
builderTreeControlBuilderThe builder
Returns
- TreeControl
The built tree control