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.
Assembly: System.Windows (in System.Windows.dll)
The ItemContainerGenerator type exposes the following members.
| Name | Description | |
|---|---|---|
![]() | ContainerFromIndex | Returns the container for the item at the specified index within the ItemCollection. |
![]() | ContainerFromItem | Returns the container corresponding to the specified item. |
![]() | Equals(Object) | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) |
![]() | Finalize | Allows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.) |
![]() | GeneratorPositionFromIndex | Gets the generated position of the item at the specified index. |
![]() | GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | IndexFromContainer | Returns the index to the item that has the specified, generated container. |
![]() | IndexFromGeneratorPosition | Returns the index that maps to the specified GeneratorPosition. |
![]() | ItemFromContainer | Returns the item that corresponds to the specified, generated container. |
![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() | ToString | Returns a string that represents the current object. (Inherited from Object.) |
| Name | Description | |
|---|---|---|
![]() ![]() | IItemContainerGenerator::GenerateNext | Returns the container element used to display the next item, and whether the container element has been newly generated (realized). |
![]() ![]() | IItemContainerGenerator::GetItemContainerGeneratorForPanel | Returns the ItemContainerGenerator appropriate for use by the specified panel. |
![]() ![]() | IItemContainerGenerator::PrepareItemContainer | Prepares the specified element as the container for the corresponding item. |
![]() ![]() | IItemContainerGenerator::Remove | Removes one or more generated (realized) items. |
![]() ![]() | IItemContainerGenerator::RemoveAll | Removes all generated (realized) items. |
![]() ![]() | IItemContainerGenerator::StartAt | Prepares 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. |
![]() ![]() | IRecyclingItemContainerGenerator::Recycle | Disassociates 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.




