NonVirtualizingLayout.InitializeForContextCore Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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(NonVirtualizingLayoutContext const& context);
protected virtual void InitializeForContextCore(NonVirtualizingLayoutContext context);
Protected Overridable Sub InitializeForContextCore (context As NonVirtualizingLayoutContext)
Parameters
- context
- NonVirtualizingLayoutContext
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.