Share via


VirtualizingLayout.InitializeForContextCore(VirtualizingLayoutContext) Method

Definition

When overridden in a derived class, initializes any per-container state the layout requires when it is attached to a UIElement container.

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

void InitializeForContextCore(VirtualizingLayoutContext const& context);
protected virtual void InitializeForContextCore(VirtualizingLayoutContext context);
Protected Overridable Sub InitializeForContextCore (context As VirtualizingLayoutContext)

Parameters

context
VirtualizingLayoutContext

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

Remarks

Override this method in a derived class to provide the behavior for calls to InitializeForContext.

Container elements that support attached layouts should call InitializeForContext when a layout instance is first assigned. The container is expected to give the attached layout instance a way to store and retrieve any per-container state by way of the provided context. It is also the responsibility of the container to not reuse the context, or otherwise expose the state from one layout to another.

When an attached layout is removed the container should release any reference to the layout state it stored.

Applies to

See also