Table of Contents

Struct TextInputLayer

Namespace
Xui.Core.UI.Layer
Assembly
Xui.Core.dll

A leaf layer that implements single-line text input: typing, selection, caret blinking, password masking, and mouse-driven selection. Carries all text state as struct fields.

The layer stores the arranged Xui.Core.UI.Layer.TextInputLayer.contentRect during Arrange(View, Rect, IMeasureContext) so that Render(View, IContext) and pointer hit-testing both know the exact text area, independent of any border or padding applied by a wrapping layer.

public struct TextInputLayer : ILayer<View>
Implements
Inherited Members

Properties

Color

Normal text color.

public Color Color { readonly get; set; }

Property Value

Color

FontFamily

public string[]? FontFamily { readonly get; set; }

Property Value

string[]

FontSize

public NFloat FontSize { readonly get; set; }

Property Value

NFloat

FontStretch

public FontStretch FontStretch { readonly get; set; }

Property Value

FontStretch

FontStyle

public FontStyle FontStyle { readonly get; set; }

Property Value

FontStyle

FontWeight

public FontWeight FontWeight { readonly get; set; }

Property Value

FontWeight

InputFilter

Optional character filter. Return true to accept, false to reject.

public Func<char, bool>? InputFilter { readonly get; set; }

Property Value

Func<char, bool>

IsPassword

When true, displays bullet characters instead of the actual text.

public bool IsPassword { readonly get; set; }

Property Value

bool

Padding

Inset applied to the arranged rect before text layout and hit-testing.

public Frame Padding { readonly get; set; }

Property Value

Frame

SelectAllOnFocus

When true (default), selects all text when the view gains focus.

public bool SelectAllOnFocus { readonly get; set; }

Property Value

bool

SelectedColor

Color of text inside the selection highlight.

public Color SelectedColor { readonly get; set; }

Property Value

Color

Selection

Gets or sets the selection as a half-open interval [Start, End). Start == End represents the caret position.

public Interval<uint>.ClosedOpen Selection { get; set; }

Property Value

Interval<uint>.ClosedOpen

SelectionBackgroundColor

Background color drawn behind selected text.

public Color SelectionBackgroundColor { readonly get; set; }

Property Value

Color

SelectionCornerRadius

Corner radius of the selection highlight rectangle. Zero by default.

public CornerRadius SelectionCornerRadius { readonly get; set; }

Property Value

CornerRadius

Text

Gets or sets the text content.

public string Text { get; set; }

Property Value

string

Methods

Animate(View, TimeSpan, TimeSpan)

Advances time-based state (animations, blinking cursors, etc.).

public void Animate(View view, TimeSpan previousTime, TimeSpan currentTime)

Parameters

view View
previousTime TimeSpan
currentTime TimeSpan

Arrange(View, Rect, IMeasureContext)

Finalises position and size within rect.

public void Arrange(View view, Rect rect, IMeasureContext context)

Parameters

view View
rect Rect
context IMeasureContext

Measure(View, Size, IMeasureContext)

Returns the desired border-edge size given the available space.

public Size Measure(View view, Size availableSize, IMeasureContext context)

Parameters

view View
availableSize Size
context IMeasureContext

Returns

Size

OnBlur(View)

Called when the host view loses keyboard focus.

public void OnBlur(View view)

Parameters

view View

OnChar(View, ref KeyEventRef)

Handles a character input event while the host view has focus.

public void OnChar(View view, ref KeyEventRef e)

Parameters

view View
e KeyEventRef

OnFocus(View)

Called when the host view gains keyboard focus.

public void OnFocus(View view)

Parameters

view View

OnKeyDown(View, ref KeyEventRef)

Handles a key-down event while the host view has focus.

public void OnKeyDown(View view, ref KeyEventRef e)

Parameters

view View
e KeyEventRef

OnPointerEvent(View, ref PointerEventRef, EventPhase)

Handles a pointer event in the given dispatch phase.

public void OnPointerEvent(View view, ref PointerEventRef e, EventPhase phase)

Parameters

view View
e PointerEventRef
phase EventPhase

Render(View, IContext)

Draws content. Called after Arrange.

public void Render(View view, IContext context)

Parameters

view View
context IContext

Update(View, ref LayoutGuide)

Drives one or more layout passes. Mirrors Update(LayoutGuide). The default per-pass methods are preferred for clarity; override this only when a single-DFS LuminarFlow traversal is needed (leaf layers or single-child-stretch containers).

public void Update(View view, ref LayoutGuide guide)

Parameters

view View
guide LayoutGuide