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
contentUIElement
Properties
Content
Scrolled element.
[Browsable(false)]
public UIElement? Content { get; set; }
Property Value
ExtentSize
Size of the content (as last measured).
public Size ExtentSize { get; }
Property Value
HorizontalScrollBar
Horizontal scrolling policy.
public ScrollBarVisibility HorizontalScrollBar { get; set; }
Property Value
MaxOffsetX
Maximum horizontal offset.
public float MaxOffsetX { get; }
Property Value
MaxOffsetY
Maximum vertical offset.
public float MaxOffsetY { get; }
Property Value
OffsetX
Horizontal offset in DIPs.
public float OffsetX { get; }
Property Value
OffsetY
Vertical offset in DIPs.
public float OffsetY { get; }
Property Value
VerticalScrollBar
Vertical scrolling policy.
public ScrollBarVisibility VerticalScrollBar { get; set; }
Property Value
ViewportSize
Size of the visible area.
public Size ViewportSize { get; }
Property Value
WheelStep
DIPs scrolled per wheel notch.
public float WheelStep { get; set; }
Property Value
Methods
ArrangeOverride(Rect)
Arranges children inside the final bounds.
protected override void ArrangeOverride(Rect bounds)
Parameters
boundsRect
MeasureOverride(Size)
Natural size of the content for the available size (margins excluded).
protected override Size MeasureOverride(Size available)
Parameters
availableSize
Returns
OnKeyDown(KeyEventArgs)
Key pressed while focused (bubbles to parents).
protected override void OnKeyDown(KeyEventArgs e)
Parameters
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
ScrollBy(float, float)
Scrolls by a delta.
public void ScrollBy(float dx, float dy)
Parameters
ScrollIntoView(UIElement)
Scrolls the minimum amount that makes element (a descendant) fully visible.
public void ScrollIntoView(UIElement element)
Parameters
elementUIElement
ScrollTo(float, float)
Scrolls to an offset (clamped).
public void ScrollTo(float offsetX, float offsetY)
Parameters
Events
ScrollChanged
Raised when the offset changes.
public event Action<ScrollViewer>? ScrollChanged