Table of Contents

Class LayerView<TView, TLayer>

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

A View that owns a single TLayer struct and delegates every layout, rendering, and input override to it, passing itself as the fully-typed TView host to every layer method.

Because the compiler resolves TLayer statically, all delegation is devirtualised and inlined by the JIT — zero overhead compared to writing the overrides by hand.

Child views: This class is a leaf by default (Count = 0). Subclasses that host child View instances should override Count and this[int], and manage attachment via SetProtectedChild<T>(ref T?, T?). Use ContentLayer to bridge those views back into the layer tree.

public class LayerView<TView, TLayer> : View, ILayerHost, IServiceProvider where TView : View where TLayer : struct, ILayer<TView>

Type Parameters

TView

The concrete view subclass. Must be the class that inherits this. Pass View when no specific host type is needed.

TLayer

The layer struct type.

Inheritance
LayerView<TView, TLayer>
Implements
Derived
Inherited Members
Extension Methods

Fields

Layer

The layer struct that owns all layout and rendering logic for this view.

protected TLayer Layer

Field Value

TLayer

Methods

AnimateCore(TimeSpan, TimeSpan)

Override to animate this view and its children.

protected override void AnimateCore(TimeSpan previousTime, TimeSpan currentTime)

Parameters

previousTime TimeSpan
currentTime TimeSpan

ArrangeCore(Rect, IMeasureContext)

Override to arrange children within this view's final frame.

protected override void ArrangeCore(Rect rect, IMeasureContext context)

Parameters

rect Rect
context IMeasureContext

MeasureCore(Size, IMeasureContext)

Override to compute the desired border-edge size.

protected override Size MeasureCore(Size availableSize, IMeasureContext context)

Parameters

availableSize Size
context IMeasureContext

Returns

Size

OnBlur()

Called when this view loses keyboard focus.

protected override void OnBlur()

OnChar(ref KeyEventRef)

Called when a character is input while this view has focus.

public override void OnChar(ref KeyEventRef e)

Parameters

e KeyEventRef

OnFocus()

Called when this view receives keyboard focus.

protected override void OnFocus()

OnKeyDown(ref KeyEventRef)

Called when a key is pressed while this view has focus.

public override void OnKeyDown(ref KeyEventRef e)

Parameters

e KeyEventRef

OnPointerEvent(ref PointerEventRef, EventPhase)

Called during event dispatch to handle a pointer event in a specific event phase.

public override void OnPointerEvent(ref PointerEventRef e, EventPhase phase)

Parameters

e PointerEventRef
phase EventPhase

RenderCore(IContext)

Override to render this view and its children.

protected override void RenderCore(IContext context)

Parameters

context IContext