Table of Contents

Class ScrollViewer

Namespace
PluginUI
Assembly
PluginUI.dll

Scrolls a content larger than its viewport. The content is measured with an unbounded size along the scrollable axes and arranged at an offset; slim overlay scrollbars (drag, track click) fade in while hovering. Wheel scrolls vertically (Shift+wheel or tilt: horizontally); unused wheel events bubble to outer scrollers.

public class ScrollViewer : Panel
Inheritance
ScrollViewer
Inherited Members

Remarks

Set the scrolled element through Content (do not add children directly). Embedded native windows (NativeWindowHost) are not clipped by the viewport.

Constructors

ScrollViewer()

Creates a scroll viewer.

public ScrollViewer()

ScrollViewer(UIElement)

Creates a scroll viewer around content.

public ScrollViewer(UIElement content)

Parameters

content UIElement

Properties

Content

Scrolled element.

[Browsable(false)]
public UIElement? Content { get; set; }

Property Value

UIElement

ExtentSize

Size of the content (as last measured).

public Size ExtentSize { get; }

Property Value

Size

HorizontalScrollBar

Horizontal scrolling policy.

public ScrollBarVisibility HorizontalScrollBar { get; set; }

Property Value

ScrollBarVisibility

MaxOffsetX

Maximum horizontal offset.

public float MaxOffsetX { get; }

Property Value

float

MaxOffsetY

Maximum vertical offset.

public float MaxOffsetY { get; }

Property Value

float

OffsetX

Horizontal offset in DIPs.

public float OffsetX { get; }

Property Value

float

OffsetY

Vertical offset in DIPs.

public float OffsetY { get; }

Property Value

float

VerticalScrollBar

Vertical scrolling policy.

public ScrollBarVisibility VerticalScrollBar { get; set; }

Property Value

ScrollBarVisibility

ViewportSize

Size of the visible area.

public Size ViewportSize { get; }

Property Value

Size

WheelStep

DIPs scrolled per wheel notch.

public float WheelStep { get; set; }

Property Value

float

Methods

ArrangeOverride(Rect)

Arranges children inside the final bounds.

protected override void ArrangeOverride(Rect bounds)

Parameters

bounds Rect

MeasureOverride(Size)

Natural size of the content for the available size (margins excluded).

protected override Size MeasureOverride(Size available)

Parameters

available Size

Returns

Size

OnKeyDown(KeyEventArgs)

Key pressed while focused (bubbles to parents).

protected override void OnKeyDown(KeyEventArgs e)

Parameters

e KeyEventArgs

OnMouseEnter()

The mouse entered the element.

protected override void OnMouseEnter()

OnMouseLeave()

The mouse left the element.

protected override void OnMouseLeave()

OnMouseWheel(MouseEventArgs)

Mouse wheel over the element.

protected override void OnMouseWheel(MouseEventArgs e)

Parameters

e MouseEventArgs

ScrollBy(float, float)

Scrolls by a delta.

public void ScrollBy(float dx, float dy)

Parameters

dx float
dy float

ScrollIntoView(UIElement)

Scrolls the minimum amount that makes element (a descendant) fully visible.

public void ScrollIntoView(UIElement element)

Parameters

element UIElement

ScrollTo(float, float)

Scrolls to an offset (clamped).

public void ScrollTo(float offsetX, float offsetY)

Parameters

offsetX float
offsetY float

Events

ScrollChanged

Raised when the offset changes.

public event Action<ScrollViewer>? ScrollChanged

Event Type

Action<ScrollViewer>