ItemContainerGenerator Class

Definition

Provides mappings between the items of an ItemsControl and their container elements.

Equivalent WinUI class: Microsoft.UI.Xaml.Controls.ItemContainerGenerator.

public ref class ItemContainerGenerator sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.Foundation.Metadata.WebHostHidden]
class ItemContainerGenerator sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.WebHostHidden]
class ItemContainerGenerator sealed
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[Windows.Foundation.Metadata.WebHostHidden]
public sealed class ItemContainerGenerator
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.WebHostHidden]
public sealed class ItemContainerGenerator
Public NotInheritable Class ItemContainerGenerator
Inheritance
ItemContainerGenerator
Attributes

Windows 10 requirements

Device family
Windows 10 (introduced in 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v1.0)

Remarks

You set an ItemContainerGenerator as the value of the ItemsControl.ItemContainerGenerator property.

Methods

ContainerFromIndex(Int32)

Note

ContainerFromIndex may be altered or unavailable for releases after Windows 8.1. Instead, use ItemsControl.ContainerFromIndex.

Returns the container for the item at the specified index within the ItemCollection.

Equivalent WinUI method: Microsoft.UI.Xaml.Controls.ItemContainerGenerator.ContainerFromIndex.

ContainerFromItem(Object)

Note

ContainerFromItem may be altered or unavailable for releases after Windows 8.1. Instead, use ItemsControl.ContainerFromItem.

Returns the container corresponding to the specified item.

Equivalent WinUI method: Microsoft.UI.Xaml.Controls.ItemContainerGenerator.ContainerFromItem.

GenerateNext(Boolean)

Returns the container element used to display the next item, and indicates whether the container element has been newly generated (realized).

Equivalent WinUI method: Microsoft.UI.Xaml.Controls.ItemContainerGenerator.GenerateNext.

GeneratorPositionFromIndex(Int32)

Gets the generated position of the item at the specified index.

Equivalent WinUI method: Microsoft.UI.Xaml.Controls.ItemContainerGenerator.GeneratorPositionFromIndex.

GetItemContainerGeneratorForPanel(Panel)

Returns the ItemContainerGenerator that is appropriate for use by the specified panel.

Equivalent WinUI method: Microsoft.UI.Xaml.Controls.ItemContainerGenerator.GetItemContainerGeneratorForPanel.

IndexFromContainer(DependencyObject)

Note

IndexFromContainer may be altered or unavailable for releases after Windows 8.1. Instead, use ItemsControl.IndexFromContainer.

Returns the index to the item that has the specified, generated container.

Equivalent WinUI method: Microsoft.UI.Xaml.Controls.ItemContainerGenerator.IndexFromContainer.

IndexFromGeneratorPosition(GeneratorPosition)

Returns the index that maps to the specified GeneratorPosition.

Equivalent WinUI method: Microsoft.UI.Xaml.Controls.ItemContainerGenerator.IndexFromGeneratorPosition.

ItemFromContainer(DependencyObject)

Note

ItemFromContainer may be altered or unavailable for releases after Windows 8.1. Instead, use ItemsControl.ItemFromContainer.

Returns the item that corresponds to the specified, generated container.

Equivalent WinUI method: Microsoft.UI.Xaml.Controls.ItemContainerGenerator.ItemFromContainer.

PrepareItemContainer(DependencyObject)

Prepares the specified element as the container for the corresponding item.

Equivalent WinUI method: Microsoft.UI.Xaml.Controls.ItemContainerGenerator.PrepareItemContainer.

Recycle(GeneratorPosition, Int32)

Disassociates item containers from their data items and saves the containers so they can be reused later for other data items.

Equivalent WinUI method: Microsoft.UI.Xaml.Controls.ItemContainerGenerator.Recycle.

Remove(GeneratorPosition, Int32)

Removes one or more generated (realized) items.

Equivalent WinUI method: Microsoft.UI.Xaml.Controls.ItemContainerGenerator.Remove.

RemoveAll()

Removes all generated (realized) items.

Equivalent WinUI method: Microsoft.UI.Xaml.Controls.ItemContainerGenerator.RemoveAll.

StartAt(GeneratorPosition, GeneratorDirection, Boolean)

Prepares the generator to generate items, starting at the specified GeneratorPosition and moving in the specified GeneratorDirection. This method also controls whether or not to start at a generated (realized) item.

Equivalent WinUI method: Microsoft.UI.Xaml.Controls.ItemContainerGenerator.StartAt.

Stop()

Disposes the ItemContainerGenerator.

Equivalent WinUI method: Microsoft.UI.Xaml.Controls.ItemContainerGenerator.Stop.

Events

ItemsChanged

Occurs when the contents of the items collection changes.

Equivalent WinUI event: Microsoft.UI.Xaml.Controls.ItemContainerGenerator.ItemsChanged.

Applies to

See also