Share via

VirtualizingLayout.MeasureOverride(VirtualizingLayoutContext, Size) Method


Provides the behavior for the "Measure" pass of the layout cycle. Classes can override this method to define their own "Measure" pass behavior.

This documentation applies to WinUI 2 for UWP (for WinUI in the Windows App SDK, see the Windows App SDK namespaces).

Size MeasureOverride(VirtualizingLayoutContext const& context, Size const& availableSize);
protected virtual Size MeasureOverride(VirtualizingLayoutContext context, Size availableSize);
Protected Overridable Function MeasureOverride (context As VirtualizingLayoutContext, availableSize As Size) As Size



The context object that facilitates communication between the layout and its host container.


The available size that this object can give to child objects. Infinity can be specified as a value to indicate that the object will size to whatever content is available.


The size that this object determines it needs during layout, based on its calculations of the allocated sizes for child objects or based on other considerations such as a fixed container size.


Override this method to provide the behavior for the measure pass of the layout cycle on a container element.

The attached layout is expected to call Measure for each of the container's children, which can be accessed through the provided VirtualizingLayoutContext.

Applies to