Struct TextInputLayer
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
FontFamily
public string[]? FontFamily { readonly get; set; }
Property Value
- string[]
FontSize
public NFloat FontSize { readonly get; set; }
Property Value
FontStretch
public FontStretch FontStretch { readonly get; set; }
Property Value
FontStyle
public FontStyle FontStyle { readonly get; set; }
Property Value
FontWeight
public FontWeight FontWeight { readonly get; set; }
Property Value
InputFilter
Optional character filter. Return true to accept, false to reject.
public Func<char, bool>? InputFilter { readonly get; set; }
Property Value
IsPassword
When true, displays bullet characters instead of the actual text.
public bool IsPassword { readonly get; set; }
Property Value
Padding
Inset applied to the arranged rect before text layout and hit-testing.
public Frame Padding { readonly get; set; }
Property Value
SelectAllOnFocus
When true (default), selects all text when the view gains focus.
public bool SelectAllOnFocus { readonly get; set; }
Property Value
SelectedColor
Color of text inside the selection highlight.
public Color SelectedColor { readonly get; set; }
Property Value
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
SelectionBackgroundColor
Background color drawn behind selected text.
public Color SelectionBackgroundColor { readonly get; set; }
Property Value
SelectionCornerRadius
Corner radius of the selection highlight rectangle. Zero by default.
public CornerRadius SelectionCornerRadius { readonly get; set; }
Property Value
Text
Gets or sets the text content.
public string Text { get; set; }
Property Value
Methods
Animate(View, TimeSpan, TimeSpan)
Advances time-based state (animations, blinking cursors, etc.).
public void Animate(View view, TimeSpan previousTime, TimeSpan currentTime)
Parameters
Arrange(View, Rect, IMeasureContext)
Finalises position and size within rect.
public void Arrange(View view, Rect rect, IMeasureContext context)
Parameters
viewViewrectRectcontextIMeasureContext
Measure(View, Size, IMeasureContext)
Returns the desired border-edge size given the available space.
public Size Measure(View view, Size availableSize, IMeasureContext context)
Parameters
viewViewavailableSizeSizecontextIMeasureContext
Returns
OnBlur(View)
Called when the host view loses keyboard focus.
public void OnBlur(View view)
Parameters
viewView
OnChar(View, ref KeyEventRef)
Handles a character input event while the host view has focus.
public void OnChar(View view, ref KeyEventRef e)
Parameters
viewVieweKeyEventRef
OnFocus(View)
Called when the host view gains keyboard focus.
public void OnFocus(View view)
Parameters
viewView
OnKeyDown(View, ref KeyEventRef)
Handles a key-down event while the host view has focus.
public void OnKeyDown(View view, ref KeyEventRef e)
Parameters
viewVieweKeyEventRef
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
viewViewePointerEventRefphaseEventPhase
Render(View, IContext)
Draws content. Called after Arrange.
public void Render(View view, IContext context)
Parameters
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
viewViewguideLayoutGuide