Table of Contents

Interface IWindowControl

Namespace
SharpConsoleUI.Controls
Assembly
SharpConsoleUI.dll

Represents a UI control that can be displayed within a window or container.

public interface IWindowControl : IDisposable
Inherited Members
Extension Methods

Properties

ActualHeight

Gets the actual height at which the control was last rendered. Returns 0 if the control has not been rendered yet.

int ActualHeight { get; }

Property Value

int

ActualWidth

Gets the actual width at which the control was last rendered. Returns 0 if the control has not been rendered yet.

int ActualWidth { get; }

Property Value

int

ActualX

Gets the actual X coordinate where the control was last rendered. Returns 0 if the control has not been rendered yet.

int ActualX { get; }

Property Value

int

ActualY

Gets the actual Y coordinate where the control was last rendered. Returns 0 if the control has not been rendered yet.

int ActualY { get; }

Property Value

int

Container

Gets or sets the parent container that hosts this control.

IContainer? Container { get; set; }

Property Value

IContainer

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.

int? ContentWidth { get; }

Property Value

int?

Height

Gets or sets the explicit height of the control, or null for automatic sizing.

int? Height { get; set; }

Property Value

int?

HorizontalAlignment

Gets or sets the horizontal alignment of the control within its container.

HorizontalAlignment HorizontalAlignment { get; set; }

Property Value

HorizontalAlignment

Margin

Gets or sets the margin (spacing) around the control.

Margin Margin { get; set; }

Property Value

Margin

Name

Gets or sets the unique name identifier for this control, used for lookup.

string? Name { get; set; }

Property Value

string

StickyPosition

Gets or sets whether this control should stick to the top or bottom during scrolling.

StickyPosition StickyPosition { get; set; }

Property Value

StickyPosition

Tag

Gets or sets an arbitrary object value that can be used to store custom data.

object? Tag { get; set; }

Property Value

object

VerticalAlignment

Gets or sets the vertical alignment of the control within its container.

VerticalAlignment VerticalAlignment { get; set; }

Property Value

VerticalAlignment

Visible

Gets or sets whether this control is visible.

bool Visible { get; set; }

Property Value

bool

Width

Gets or sets the explicit width of the control, or null for automatic sizing.

int? Width { get; set; }

Property Value

int?

Methods

GetLogicalContentSize()

Gets the logical size of the control's content without rendering.

Size GetLogicalContentSize()

Returns

Size

The size representing the content's natural dimensions.

Invalidate()

Marks this control as needing to be re-rendered.

void Invalidate()