Class MarkupBuilder
- Namespace
- SharpConsoleUI.Builders
- Assembly
- SharpConsoleUI.dll
Fluent builder for markup controls
public sealed class MarkupBuilder
- Inheritance
-
MarkupBuilder
- Inherited Members
Methods
AddEmptyLine()
Adds an empty line
public MarkupBuilder AddEmptyLine()
Returns
- MarkupBuilder
The builder for chaining
AddLine(string)
Adds a line of markup text
public MarkupBuilder AddLine(string markup)
Parameters
markupstringThe markup text
Returns
- MarkupBuilder
The builder for chaining
AddLines(params string[])
Adds multiple lines of markup text
public MarkupBuilder AddLines(params string[] markupLines)
Parameters
markupLinesstring[]The markup lines
Returns
- MarkupBuilder
The builder for chaining
AlignBottom()
Aligns content to the bottom
public MarkupBuilder AlignBottom()
Returns
- MarkupBuilder
The builder for chaining
AlignTop()
Aligns content to the top
public MarkupBuilder AlignTop()
Returns
- MarkupBuilder
The builder for chaining
Build()
Builds the markup control
public MarkupControl Build()
Returns
- MarkupControl
The configured markup control
Centered()
Centers the content horizontally
public MarkupBuilder Centered()
Returns
- MarkupBuilder
The builder for chaining
Clear()
Clears all lines
public MarkupBuilder Clear()
Returns
- MarkupBuilder
The builder for chaining
FillVertical()
Makes the content fill vertically
public MarkupBuilder FillVertical()
Returns
- MarkupBuilder
The builder for chaining
StickyBottom()
Makes the control stick to the bottom of the window
public MarkupBuilder StickyBottom()
Returns
- MarkupBuilder
The builder for chaining
StickyTop()
Makes the control stick to the top of the window
public MarkupBuilder StickyTop()
Returns
- MarkupBuilder
The builder for chaining
VerticallyCentered()
Centers the content vertically
public MarkupBuilder VerticallyCentered()
Returns
- MarkupBuilder
The builder for chaining
Visible(bool)
Sets the visibility
public MarkupBuilder Visible(bool visible = true)
Parameters
visibleboolWhether the control is visible
Returns
- MarkupBuilder
The builder for chaining
WithAlignment(HorizontalAlignment)
Sets the alignment
public MarkupBuilder WithAlignment(HorizontalAlignment alignment)
Parameters
alignmentHorizontalAlignmentThe alignment
Returns
- MarkupBuilder
The builder for chaining
WithBackgroundColor(Color)
Sets the background color for the control
public MarkupBuilder WithBackgroundColor(Color color)
Parameters
colorColorThe background color
Returns
- MarkupBuilder
The builder for chaining
WithColors(Color, Color)
Sets both foreground and background colors for the control
public MarkupBuilder WithColors(Color foreground, Color background)
Parameters
foregroundColorThe foreground (text) color
backgroundColorThe background color
Returns
- MarkupBuilder
The builder for chaining
WithForegroundColor(Color)
Sets the foreground (text) color for the control
public MarkupBuilder WithForegroundColor(Color color)
Parameters
colorColorThe foreground color
Returns
- MarkupBuilder
The builder for chaining
WithMargin(int)
Sets uniform margin
public MarkupBuilder WithMargin(int margin)
Parameters
marginintThe margin value for all sides
Returns
- MarkupBuilder
The builder for chaining
WithMargin(int, int, int, int)
Sets the margin
public MarkupBuilder WithMargin(int left, int top, int right, int bottom)
Parameters
Returns
- MarkupBuilder
The builder for chaining
WithName(string)
Sets the control name for lookup
public MarkupBuilder WithName(string name)
Parameters
namestringThe control name
Returns
- MarkupBuilder
The builder for chaining
WithStickyPosition(StickyPosition)
Sets the sticky position
public MarkupBuilder WithStickyPosition(StickyPosition position)
Parameters
positionStickyPositionThe sticky position
Returns
- MarkupBuilder
The builder for chaining
WithTag(object)
Sets a tag object
public MarkupBuilder WithTag(object tag)
Parameters
tagobjectThe tag object
Returns
- MarkupBuilder
The builder for chaining
WithVerticalAlignment(VerticalAlignment)
Sets the vertical alignment
public MarkupBuilder WithVerticalAlignment(VerticalAlignment alignment)
Parameters
alignmentVerticalAlignmentThe vertical alignment
Returns
- MarkupBuilder
The builder for chaining
WithWidth(int)
Sets the width
public MarkupBuilder WithWidth(int width)
Parameters
widthintThe control width
Returns
- MarkupBuilder
The builder for chaining
Operators
implicit operator MarkupControl(MarkupBuilder)
Implicit conversion to MarkupControl
public static implicit operator MarkupControl(MarkupBuilder builder)
Parameters
builderMarkupBuilderThe builder
Returns
- MarkupControl
The built markup control