ItemContainerGenerator Class
Collapse the table of content
Expand the table of content

ItemContainerGenerator Class

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

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


Namespace:  System.Windows.Controls
Assembly:  System.Windows (in System.Windows.dll)

public sealed class ItemContainerGenerator : IRecyclingItemContainerGenerator, 

The ItemContainerGenerator type exposes the following members.

Public methodContainerFromIndexReturns the container for the item at the specified index within the ItemCollection.
Public methodContainerFromItemReturns the container corresponding to the specified item.
Public methodEquals(Object)Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.)
Public methodGeneratorPositionFromIndexGets the generated position of the item at the specified index.
Public methodGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodIndexFromContainerReturns the index to the item that has the specified, generated container.
Public methodIndexFromGeneratorPositionReturns the index that maps to the specified GeneratorPosition.
Public methodItemFromContainerReturns the item that corresponds to the specified, generated container.
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)

Public eventItemsChangedOccurs when the contents of the items collection changes.

Explicit interface implemetationPrivate methodIItemContainerGenerator.GenerateNextReturns the container element used to display the next item, and whether the container element has been newly generated (realized).
Explicit interface implemetationPrivate methodIItemContainerGenerator.GetItemContainerGeneratorForPanelReturns the ItemContainerGenerator appropriate for use by the specified panel.
Explicit interface implemetationPrivate methodIItemContainerGenerator.PrepareItemContainerPrepares the specified element as the container for the corresponding item.
Explicit interface implemetationPrivate methodIItemContainerGenerator.RemoveRemoves one or more generated (realized) items.
Explicit interface implemetationPrivate methodIItemContainerGenerator.RemoveAllRemoves all generated (realized) items.
Explicit interface implemetationPrivate methodIItemContainerGenerator.StartAtPrepares the generator to generate items, starting at the specified GeneratorPosition, and in the specified GeneratorDirection, and controlling whether or not to start at a generated (realized) item.
Explicit interface implemetationPrivate methodIRecyclingItemContainerGenerator.RecycleDisassociates item containers from their data items and saves the containers so they can be reused later for other data items.

The ItemContainerGenerator class maintains associations between items controls and their item containers, such as ListBox and ListBoxItem. If a control has an associated ItemContainerGenerator, you will be able to retrieve it through a property on the control

You can use the ItemContainerGenerator to retrieve items based on their index or containers by specifying the data item.

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

© 2018 Microsoft