Vixen
02b45cc4
csharp
public sealed class ScrollView

A window onto content that is bigger than it is.

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

Remarks

Scrolling is an offset, not a layout. ScrollTop writes OffsetY on the content, which is applied when absolute positions are accumulated — so a scroll costs one walk of the tree and no cascade, no flexbox and no measurement. A scroll view that moved its content by changing a layout property would relayout its entire subtree sixty times a second.

⚠ Everything stays in the tree, including what has scrolled out of sight. This is the plain scroll view; a list of a million rows wants VirtualizingPanel, which doc 09 makes a first-class primitive and which is owed. Said here rather than discovered: putting a hundred thousand elements in one of these will work and will not be fast.

The clipping is overflow: hidden in the theme rather than anything here, so it is the draw list's clip stack that does it — the same mechanism any other clipped element uses.

Fields and properties (12)

  • 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 UiElement Content

    Where the content goes.

  • protected override UiElement ContentHost
  • public ScrollBar VerticalBar

    The bar down the right.

  • public ScrollBar HorizontalBar

    The bar along the bottom.

  • public float ScrollTop
  • public float ScrollLeft
  • public float MaximumTop

    How far down it can go.

  • public float MaximumLeft

    How far across it can go.

  • public static readonly UiPropertyKey ScrollTopProperty

    Identity for ScrollTop.

  • public static readonly UiPropertyKey ScrollLeftProperty

    Identity for ScrollLeft.

Events (1)

  • public Action<ScrollView>? Scrolled

    Raised when either offset changes.

Methods (6)

  • protected override void OnCreated()

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

  • protected override void OnRemoved()

    Called once, as the element leaves the document.

  • public void ScrollIntoView(UiElement element)

    Scrolls until an element inside is visible.

  • public void Refresh()

    Brings the bars up to date with the content's size.

  • public void ClearScrollTop()

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

  • public void ClearScrollLeft()

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

Used by (28)

  • ShellHelloUi
  • CodeEditorVixen.Ui.Controls.Advanced
  • CodeEditorTestsVixen.Ui.Controls.Advanced.Tests
  • ControlVisualTestsVixen.Ui.Controls.Tests
  • DataGridVixen.Ui.Controls.Advanced
  • DataGridTestsVixen.Ui.Controls.Advanced.Tests
  • NavigationInteractionTestsVixen.Ui.Controls.Tests
  • SurfaceTestsVixen.Ui.Controls.Tests
  • TextFieldTestsVixen.Ui.Controls.Tests
  • TreeViewVixen.Ui.Controls.Advanced
  • TreeViewTestsVixen.Ui.Controls.Advanced.Tests
  • VirtualizingGridVixen.Ui.Controls
  • VirtualizingGridTestsVixen.Ui.Controls.Tests
  • VirtualizingPanelVixen.Ui.Controls
  • VirtualizingPanelTestsVixen.Ui.Controls.Tests
  • AddComponentMenuVixen.Editor.App
  • AddComponentMenuTestsVixen.Editor.App.Tests
  • AssetGridVixen.Editor.App
  • ConsoleViewVixen.Editor.Ui
  • ConsoleViewTestsVixen.Editor.Ui.Tests
  • EditorApplicationVixen.Editor.App
  • ImportSettingsViewVixen.Editor.AssetEditors
  • InspectorPanelTestsVixen.Editor.App.Tests
  • InspectorViewVixen.Editor.Inspector
  • MemoryViewVixen.Editor.Profiler
  • MessageLogViewVixen.Editor.Ui
  • ProfilerViewVixen.Editor.Profiler
  • UndoHistoryVixen.Editor.App