Class ScrollView
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
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
Direction
Gets or sets which axis (or axes) this scroll view responds to.
public ScrollDirection Direction { get; set; }
Property Value
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
indexint
Property Value
ScrollbarEndInset
public NFloat ScrollbarEndInset { get; set; }
Property Value
ScrollbarWidth
public NFloat ScrollbarWidth { get; set; }
Property Value
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
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
rectRectcontextIMeasureContext
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
pointPointThe point to test, relative to this view's coordinate space.
Returns
- bool
trueif the point is inside the view's frame; otherwisefalse.
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
availableSizecontextIMeasureContext
Returns
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
ePointerEventRefphaseEventPhase
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
RenderCore(IContext)
Draws this view's content and recurses into children.
protected override void RenderCore(IContext context)
Parameters
contextIContext