Share via


NonVirtualizingLayout.MeasureOverride Method

Definition

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(NonVirtualizingLayoutContext const& context, Size const& availableSize);
protected virtual Size MeasureOverride(NonVirtualizingLayoutContext context, Size availableSize);
Protected Overridable Function MeasureOverride (context As NonVirtualizingLayoutContext, availableSize As Size) As Size

Parameters

context
NonVirtualizingLayoutContext

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

availableSize
Size

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.

Returns

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.

Remarks

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 NonVirtualizingLayoutContext.

Applies to