Vixen
02b45cc4
csharp
public sealed class ScrollBar

The bar down the side of a ScrollView.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

A real element rather than something the scroll view draws, for one reason: it has to be drawn over the content, and OnDraw runs before an element's children. A later sibling is painted last, which is exactly where a scrollbar belongs.

It draws its own thumb rather than holding one, for the reason every other control in this set that draws itself does: the thumb's length and position are fractions of a viewport that only exists after layout, and writing them back as offsets would settle a frame late on every scroll — which is the one frame anybody is looking at.

Fields and properties (11)

  • protected override string TagName

    The element name this type answers to when a caller does not choose one.

  • protected override bool AcceptsFocus

    Whether the focus can rest on this kind of control at all.

  • public Orientation Orientation
  • public float Value
  • public float ViewportSize
  • public float ContentSize
  • public float Range

    How far it can travel.

  • public static readonly UiPropertyKey OrientationProperty

    Identity for Orientation.

  • public static readonly UiPropertyKey ValueProperty

    Identity for Value.

  • public static readonly UiPropertyKey ViewportSizeProperty

    Identity for ViewportSize.

  • public static readonly UiPropertyKey ContentSizeProperty

    Identity for ContentSize.

Events (1)

  • public Action<ScrollBar, float>? Scrolled

    Raised when a drag on the thumb moves it.

Methods (6)

  • protected override void OnCreated()

    Builds whatever this element is made of, once, as it joins a document.

  • protected override void OnDraw(DrawContext context)

    Draws whatever this element is, beyond what a stylesheet can describe.

  • public void ClearOrientation()

    Unsets Orientation, so it takes its default or its ancestor's value again.

  • public void ClearValue()

    Unsets Value, so it takes its default or its ancestor's value again.

  • public void ClearViewportSize()

    Unsets ViewportSize, so it takes its default or its ancestor's value again.

  • public void ClearContentSize()

    Unsets ContentSize, so it takes its default or its ancestor's value again.

Used by (2)

  • NavigationInteractionTestsVixen.Ui.Controls.Tests
  • ScrollViewVixen.Ui.Controls