AttachedLayout.

InitializeForContext(LayoutContext) Method

Summary

Initializes any per-container state the layout requires when it is attached to an ILayoutable container.
Namespace
Avalonia.Layout
Containing Type
AttachedLayout

Syntax

public void InitializeForContext(LayoutContext context)

Remarks

Container elements that support attached layouts should call this method 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. Override InitializeForContextCore(LayoutContext) or Avalonia.Layout.VirtualizingLayout.InitializeForContextCore(Avalonia.Layout.VirtualizingLayoutContext) to provide the behavior for this method in a derived class.

Parameters

Name Type Description
context LayoutContext The context object that facilitates communication between the layout and its host container.

Return Value

Type Description
void