Table of Contents

Class ScrollView

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

A container that clips its content and allows scrolling via pointer drag/fling and scroll wheel input. Supports vertical, horizontal, or both axes. Displays thin overlay scrollbar indicators on the relevant edges.

public class ScrollView : View, ILayerHost, IServiceProvider
Inheritance
ScrollView
Implements
Inherited Members
Extension Methods

Properties

Content

Gets or sets the single child view to scroll.

public View? Content { get; set; }

Property Value

View

Count

Returns the number of child views. Used by layout containers and traversal logic. Leaf views should return 0.

public override int Count { get; }

Property Value

int

Direction

Gets or sets which axis (or axes) this scroll view responds to.

public ScrollDirection Direction { get; set; }

Property Value

ScrollDirection

this[int]

Indexer to access child views by index. Layout containers should implement this to expose their children.

public override View this[int index] { get; }

Parameters

index int

Property Value

View

ScrollbarEndInset

public NFloat ScrollbarEndInset { get; set; }

Property Value

NFloat

ScrollbarWidth

public NFloat ScrollbarWidth { get; set; }

Property Value

NFloat

Methods

AnimateCore(TimeSpan, TimeSpan)

Per-frame animation hook. Mutate time-based state and call RequestAnimationFrame() if the animation should continue. The default implementation recurses into children; override to customise child traversal.

protected override void AnimateCore(TimeSpan previous, TimeSpan current)

Parameters

previous TimeSpan
current TimeSpan

ArrangeCore(Rect, IMeasureContext)

Positions children within the border-edge rectangle. Frame assignment and alignment offset are handled by ArrangeShell(ref LayoutGuide).

protected override void ArrangeCore(Rect rect, IMeasureContext context)

Parameters

rect Rect
context IMeasureContext

HitTest(Point)

Determines whether the given point (in local coordinates) hits this view's visual bounds. Used for input dispatch and hit testing.

public override bool HitTest(Point point)

Parameters

point Point

The point to test, relative to this view's coordinate space.

Returns

bool

true if the point is inside the view's frame; otherwise false.

MeasureCore(Size, IMeasureContext)

Returns the desired border-edge size given the available border-edge space. Margin, min/max clamping, and fixed-size short-circuit are handled by MeasureShell(ref LayoutGuide).

protected override Size MeasureCore(Size available, IMeasureContext context)

Parameters

available Size
context IMeasureContext

Returns

Size

OnActivate()

Called when this view becomes active — it will receive events, render, and animate. Override this to start animations, subscribe to data sources, or acquire resources.

protected override void OnActivate()

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

OnScrollWheel(ref ScrollWheelEventRef)

Called when a scroll wheel or trackpad scroll event is dispatched to this view. Override to handle scroll input. Set Handled to stop propagation.

public override void OnScrollWheel(ref ScrollWheelEventRef e)

Parameters

e ScrollWheelEventRef

RenderCore(IContext)

Draws this view's content and recurses into children.

protected override void RenderCore(IContext context)

Parameters

context IContext