Struct VirtualScrollSizingStrategy
- Namespace
- Nalu
- Assembly
- Nalu.Maui.VirtualScroll.dll
The sizing strategy of a VirtualScroll along its scrolling axis (the cross axis always follows the parent's constraint — a virtualized list cannot know the size of items it has not realized).
[TypeConverter(typeof(VirtualScrollSizingStrategyTypeConverter))]
public readonly record struct VirtualScrollSizingStrategy : IEquatable<VirtualScrollSizingStrategy>
- Implements
- Inherited Members
Remarks
The three modes exist because measuring virtualized content is not free, so the cost is opt-in:
- Fill measures nothing at all — the content size is never consulted, which is why it stays the default.
- Max(double) is bounded by construction: only the items that fit within the cap participate, no matter how many the collection holds. Once the content reaches the cap the measured size is pinned there, so further content changes cannot move the parent and no re-measure is requested at all.
- Unbounded has no such damper: the whole content is laid out, and every content change re-measures. Use it for small, bounded collections.
Not supported on Windows, where the value is accepted but always behaves as Fill.
Properties
Fill
Takes the size offered by the parent without measuring the content (the default).
public static VirtualScrollSizingStrategy Fill { get; }
Property Value
MaxExtent
Gets the maximum extent the content may grow to, in device-independent units. Only meaningful for Max; PositiveInfinity for the other modes.
public double MaxExtent { get; }
Property Value
Mode
Gets the sizing mode.
public VirtualScrollSizingMode Mode { get; }
Property Value
Unbounded
Hugs the content with no limit — measures every item, and re-measures on every content change. Intended for small, bounded collections.
public static VirtualScrollSizingStrategy Unbounded { get; }
Property Value
Methods
Max(double)
Hugs the content up to maxExtent device-independent units along the
scrolling axis, then stops growing.
public static VirtualScrollSizingStrategy Max(double maxExtent)
Parameters
maxExtentdoubleThe maximum extent; must be a positive, finite number.
Returns
Exceptions
- ArgumentOutOfRangeException
The extent is not a positive, finite number.
ToString()
Returns the fully qualified type name of this instance.
public override string ToString()
Returns
- string
The fully qualified type name.
Operators
implicit operator VirtualScrollSizingStrategy(double)
Converts a positive number to a Max(double) strategy (and PositiveInfinity to Unbounded).
public static implicit operator VirtualScrollSizingStrategy(double maxExtent)
Parameters
maxExtentdoubleThe maximum extent.
Returns
implicit operator VirtualScrollSizingStrategy(string?)
Converts a string representation — "Fill", "Unbounded" or a number (which
becomes Max(double)) — to a VirtualScrollSizingStrategy.
public static implicit operator VirtualScrollSizingStrategy(string? inputString)
Parameters
inputStringstringThe string representation.
Returns
Exceptions
- FormatException
The string is not a known mode nor a valid number.