public sealed class VirtualizingPanelA scrolling list of which only what is on screen exists as elements.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
The items are the caller's and the rows are a pool. This control knows how many items there are and how tall a row is; it does not know what an item is. A hundred thousand of them is a hundred thousand of the caller's own objects and about thirty elements, rebound as the view scrolls — which is doc 09's claim about a data grid, made once here instead of again in each control that wants it.
⚠ Rows are positioned absolutely, at a fixed height. Virtualisation needs to know where row 40 000 is without having measured the 39 999 above it, and a fixed height makes that arithmetic instead of a walk. Variable heights need a running-sum index maintained as things change size; that is a different control and is owed rather than approximated.
⚠ Nothing has to call Realise. It runs on LayoutFinished, which is the only place that knows how tall the viewport ended up — so a panel resized without being scrolled realises against the size it actually has. That is the gap every explicit Refresh() in this library existed for, and the reason the callback was built.
Fields and properties (11)
public const int OverscanHow many rows are realised above and below the viewport.
protected override string TagNameThe element name this type answers to when a caller does not choose one.
protected override bool AcceptsFocusWhether the focus can rest on this kind of control at all.
public ScrollView ScrollerThe scroller the rows live in.
public IReadOnlyList<UiElement> RowsThe rows that exist as elements, in pool order rather than in item order.
public int FirstItemWhich item the first row of the pool is showing.
public float RowHeightHow tall a row is, from --row-height.
public int Countpublic Func<VirtualizingPanel, UiElement>? CreateRowMakes a row element. Called only when the pool has to grow.
public Action<UiElement, int>? BindRowPuts an item's data on a row. Called whenever a row starts showing a different item.
public static readonly UiPropertyKey CountPropertyIdentity for Count.
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 UiElement? RowOf(int item)The element showing an item, or null if it is not realised.
public void ScrollIntoView(int item)Scrolls until an item is inside the viewport.
public void Realise()Makes sure there is a row for every visible line of the viewport, and binds them.
public void ClearCount()Unsets Count, so it takes its default or its ancestor's value again.
Used by (7)
- TreeViewVixen.Ui.Controls.Advanced
- VirtualizingGridVixen.Ui.Controls
- VirtualizingPanelTestsVixen.Ui.Controls.Tests
- ConsolePanelTestsVixen.Editor.App.Tests
- ConsoleViewVixen.Editor.Ui
- ConsoleViewTestsVixen.Editor.Ui.Tests
- MessageLogViewVixen.Editor.Ui