Skip to main content

CreateContainer Method

Creates a new container control.

Definition​

Namespace: Avalonia.Controls.Generators
Assembly: Avalonia.Controls (in Avalonia.Controls.dll)

public Control CreateContainer(
Object? item,
int index,
Object? recycleKey
)

Parameters​

  Object
The item to display.
  Int32
The index of the item.
  Object
The recycle key returned from NeedsContainer(Object, Int32, Object)

Return Value​

Control
The newly created container control.

Remarks​

Before calling this method, NeedsContainer(Object, Int32, Object) should be called to determine whether the item itself should be used as a container. After calling this method, PrepareItemContainer(Control, Object, Int32) must be called to prepare the container to display the specified item. If the panel supports recycling then the returned recycle key should be stored alongside the container and when container becomes eligible for recycling the container should be placed in a recycle pool using this key. If the returned recycle key is null then the container cannot be recycled.

See Also​

Reference​

ItemContainerGenerator Class
Avalonia.Controls.Generators Namespace