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

Number of child views.

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]

Gets the child view at the given index.

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

Parameters

index int

Property Value

View

ScrollbarEndInset

Inset from the end of the scroll axis reserved for the scrollbar.

public NFloat ScrollbarEndInset { get; set; }

Property Value

NFloat

ScrollbarWidth

Width of the scrollbar track in points.

public NFloat ScrollbarWidth { get; set; }

Property Value

NFloat

Methods

AnimateCore(TimeSpan, TimeSpan)

Override to animate this view and its children.

protected override void AnimateCore(TimeSpan previous, TimeSpan current)

Parameters

previous TimeSpan
current 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

HitTest(Point)

Determines whether the given point (in this view's 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.

InverseTransformPoint(Point)

Maps a point from this view's local coordinate space into its parent coordinate space.

public override Point InverseTransformPoint(Point point)

Parameters

point Point

Returns

Point

Remarks

This must be the inverse of TransformPoint(Point) for points that can be hit tested. It is separate so a view can support coordinate mappings that are not yet represented by the canvas transform API.

InverseTransformRect(Rect)

Conservatively maps an axis-aligned rectangle from this view's coordinate space into its parent coordinate space.

public override Rect InverseTransformRect(Rect rect)

Parameters

rect Rect

Returns

Rect

Remarks

For non-translation transforms, an override must return the smallest parent-axis-aligned rectangle that encloses every transformed corner.

MeasureCore(Size, IMeasureContext)

Override to compute the desired border-edge size.

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)

Override to render this view and its children.

protected override void RenderCore(IContext context)

Parameters

context IContext

TransformPoint(Point)

Maps a point from this view's parent coordinate space into this view's local coordinate space.

public override Point TransformPoint(Point point)

Parameters

point Point

Returns

Point

Remarks

Layout still supplies frames using the existing coordinate model. The default identity mapping deliberately preserves that behaviour until a container opts into a local coordinate transform. Containers such as ScrollView can override this to map input into their content space.

TransformRect(Rect)

Conservatively maps an axis-aligned rectangle from this view's parent coordinate space into this view's coordinate space.

public override Rect TransformRect(Rect rect)

Parameters

rect Rect

Returns

Rect

Remarks

For non-translation transforms, an override must return the smallest parent-axis-aligned rectangle that encloses every transformed corner.