Table of Contents

Class RuleControl

Namespace
SharpConsoleUI.Controls
Assembly
SharpConsoleUI.dll

A control that renders a horizontal rule (divider line) with optional title text. Renders directly to CharacterBuffer using BoxChars.

public class RuleControl : BaseControl, IWindowControl, IDisposable, IDOMPaintable, INotifyPropertyChanged
Inheritance
RuleControl
Implements
Inherited Members
Extension Methods

Constructors

RuleControl()

Initializes a new instance of the RuleControl class.

public RuleControl()

Properties

BorderStyle

Gets or sets the border style for the rule line characters.

public BorderStyle BorderStyle { get; set; }

Property Value

BorderStyle

Color

Gets or sets the color of the rule line.

public Color? Color { get; set; }

Property Value

Color?

ContentWidth

Gets the minimum width needed to display the control's content, including margins. Returns null if width cannot be determined. This is calculated based on content (text length, child controls, etc.) and represents the natural/intrinsic size.

public override int? ContentWidth { get; }

Property Value

int?

Title

Gets or sets the title text displayed within the rule.

public string? Title { get; set; }

Property Value

string

TitleAlignment

Gets or sets the horizontal alignment of the title within the rule.

public TextJustification TitleAlignment { get; set; }

Property Value

TextJustification

Methods

Create()

Creates a new builder for configuring a RuleControl

public static RuleBuilder Create()

Returns

RuleBuilder

A new builder instance

MeasureDOM(LayoutConstraints)

Measures the control's desired size given the available constraints.

public override LayoutSize MeasureDOM(LayoutConstraints constraints)

Parameters

constraints LayoutConstraints

The layout constraints (min/max width/height).

Returns

LayoutSize

The desired size of the control.

PaintDOM(CharacterBuffer, LayoutRect, LayoutRect, Color, Color)

Paints the control's content directly to a CharacterBuffer.

public override void PaintDOM(CharacterBuffer buffer, LayoutRect bounds, LayoutRect clipRect, Color defaultFg, Color defaultBg)

Parameters

buffer CharacterBuffer

The buffer to paint to.

bounds LayoutRect

The absolute bounds where the control should paint.

clipRect LayoutRect

The clipping rectangle (visible area).

defaultFg Color
defaultBg Color