Class PanelBuilder
- Namespace
- SharpConsoleUI.Builders
- Assembly
- SharpConsoleUI.dll
Fluent builder for creating PanelControl instances.
public sealed class PanelBuilder
- Inheritance
-
PanelBuilder
- Inherited Members
Methods
Build()
Builds the PanelControl.
public PanelControl Build()
Returns
- PanelControl
The configured control.
DoubleLine()
Uses double-line border style.
public PanelBuilder DoubleLine()
Returns
- PanelBuilder
The builder for chaining.
FillVertical()
Sets vertical alignment to Fill, causing the panel to stretch vertically.
public PanelBuilder FillVertical()
Returns
- PanelBuilder
The builder for chaining.
HeaderCenter()
Centers the header.
public PanelBuilder HeaderCenter()
Returns
- PanelBuilder
The builder for chaining.
HeaderLeft()
Aligns the header to the left.
public PanelBuilder HeaderLeft()
Returns
- PanelBuilder
The builder for chaining.
HeaderRight()
Aligns the header to the right.
public PanelBuilder HeaderRight()
Returns
- PanelBuilder
The builder for chaining.
NoBorder()
Uses no border.
public PanelBuilder NoBorder()
Returns
- PanelBuilder
The builder for chaining.
Rounded()
Uses rounded border style.
public PanelBuilder Rounded()
Returns
- PanelBuilder
The builder for chaining.
SingleLine()
Uses single-line border style.
public PanelBuilder SingleLine()
Returns
- PanelBuilder
The builder for chaining.
StickyBottom()
Makes the control stick to the bottom of the window.
public PanelBuilder StickyBottom()
Returns
- PanelBuilder
The builder for chaining.
StickyTop()
Makes the control stick to the top of the window.
public PanelBuilder StickyTop()
Returns
- PanelBuilder
The builder for chaining.
StretchHorizontal()
Sets horizontal alignment to Stretch, causing the panel to stretch horizontally.
public PanelBuilder StretchHorizontal()
Returns
- PanelBuilder
The builder for chaining.
UseSafeBorder(bool)
Enables safe border characters for better terminal compatibility.
public PanelBuilder UseSafeBorder(bool useSafe = true)
Parameters
useSafeboolTrue to use safe borders.
Returns
- PanelBuilder
The builder for chaining.
Visible(bool)
Sets the visibility.
public PanelBuilder Visible(bool visible = true)
Parameters
visibleboolTrue if visible.
Returns
- PanelBuilder
The builder for chaining.
WithAlignment(HorizontalAlignment)
Sets the horizontal alignment.
public PanelBuilder WithAlignment(HorizontalAlignment alignment)
Parameters
alignmentHorizontalAlignmentThe alignment.
Returns
- PanelBuilder
The builder for chaining.
WithBackgroundColor(Color)
Sets the background color.
public PanelBuilder WithBackgroundColor(Color color)
Parameters
colorColorThe background color.
Returns
- PanelBuilder
The builder for chaining.
WithBorderColor(Color)
Sets the border color.
public PanelBuilder WithBorderColor(Color color)
Parameters
colorColorThe border color.
Returns
- PanelBuilder
The builder for chaining.
WithBorderStyle(BorderStyle)
Sets the border style for the panel.
public PanelBuilder WithBorderStyle(BorderStyle style)
Parameters
styleBorderStyleThe border style.
Returns
- PanelBuilder
The builder for chaining.
WithContent(IRenderable)
Sets the content to display inside the panel.
public PanelBuilder WithContent(IRenderable content)
Parameters
contentIRenderableThe Spectre renderable content.
Returns
- PanelBuilder
The builder for chaining.
WithContent(string)
Sets the content to display inside the panel using markup text.
public PanelBuilder WithContent(string text)
Parameters
textstringThe text to display (supports Spectre markup).
Returns
- PanelBuilder
The builder for chaining.
WithForegroundColor(Color)
Sets the foreground color.
public PanelBuilder WithForegroundColor(Color color)
Parameters
colorColorThe foreground color.
Returns
- PanelBuilder
The builder for chaining.
WithHeader(string)
Sets the header text displayed at the top of the panel border.
public PanelBuilder WithHeader(string header)
Parameters
headerstringThe header text.
Returns
- PanelBuilder
The builder for chaining.
WithHeaderAlignment(Justify)
Sets the header alignment.
public PanelBuilder WithHeaderAlignment(Justify alignment)
Parameters
alignmentJustifyThe header alignment.
Returns
- PanelBuilder
The builder for chaining.
WithHeight(int)
Sets the height.
public PanelBuilder WithHeight(int height)
Parameters
heightintThe height.
Returns
- PanelBuilder
The builder for chaining.
WithMargin(Margin)
Sets the margin.
public PanelBuilder WithMargin(Margin margin)
Parameters
marginMarginThe margin.
Returns
- PanelBuilder
The builder for chaining.
WithMargin(int)
Sets uniform margin on all sides.
public PanelBuilder WithMargin(int margin)
Parameters
marginintThe margin value.
Returns
- PanelBuilder
The builder for chaining.
WithMargin(int, int, int, int)
Sets the margin.
public PanelBuilder WithMargin(int left, int top, int right, int bottom)
Parameters
Returns
- PanelBuilder
The builder for chaining.
WithName(string)
Sets the control name for FindControl queries.
public PanelBuilder WithName(string name)
Parameters
namestringThe control name.
Returns
- PanelBuilder
The builder for chaining.
WithPadding(int)
Sets uniform padding on all sides.
public PanelBuilder WithPadding(int padding)
Parameters
paddingintThe padding value.
Returns
- PanelBuilder
The builder for chaining.
WithPadding(int, int)
Sets horizontal and vertical padding.
public PanelBuilder WithPadding(int horizontal, int vertical)
Parameters
Returns
- PanelBuilder
The builder for chaining.
WithPadding(int, int, int, int)
Sets the padding inside the panel border.
public PanelBuilder WithPadding(int left, int top, int right, int bottom)
Parameters
Returns
- PanelBuilder
The builder for chaining.
WithStickyPosition(StickyPosition)
Sets the sticky position.
public PanelBuilder WithStickyPosition(StickyPosition position)
Parameters
positionStickyPositionThe sticky position.
Returns
- PanelBuilder
The builder for chaining.
WithTag(object)
Sets the control tag for custom data storage.
public PanelBuilder WithTag(object tag)
Parameters
tagobjectThe tag object.
Returns
- PanelBuilder
The builder for chaining.
WithVerticalAlignment(VerticalAlignment)
Sets the vertical alignment.
public PanelBuilder WithVerticalAlignment(VerticalAlignment alignment)
Parameters
alignmentVerticalAlignmentThe vertical alignment.
Returns
- PanelBuilder
The builder for chaining.
WithWidth(int)
Sets the width.
public PanelBuilder WithWidth(int width)
Parameters
widthintThe width.
Returns
- PanelBuilder
The builder for chaining.
Operators
implicit operator PanelControl(PanelBuilder)
Implicit conversion to PanelControl.
public static implicit operator PanelControl(PanelBuilder builder)
Parameters
builderPanelBuilder