[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]
Generates the user interface (UI) on behalf of its host, such as an ItemsControl.
Assembly: PresentationFramework (in PresentationFramework.dll)
Thetype exposes the following members.
|ContainerFromIndex||Returns the element corresponding to the item at the given index within the ItemCollection.|
|ContainerFromItem||Returns the UIElement corresponding to the given 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 it is reclaimed by garbage collection. (Inherited from Object.)|
|GenerateBatches||Returns an object that manages the Status property.|
|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(DependencyObject)||Returns the index to an item that corresponds to the specified, generated UIElement.|
|IndexFromContainer(DependencyObject, Boolean)||Returns the index to an item that corresponds to the specified, generated UIElement, optionally recursively searching hierarchical items.|
|ItemFromContainer||Returns the item that corresponds to the specified, generated UIElement.|
|MemberwiseClone||Creates a shallow copy of the current Object. (Inherited from Object.)|
|ToString||Returns a string that represents the current object. (Inherited from Object.)|
|IItemContainerGenerator.GenerateNext()||Returns the container element used to display the next item.|
|IItemContainerGenerator.GenerateNext(Boolean)||Returns the container element used to display the next item, and whether the container element has been newly generated (realized).|
|IItemContainerGenerator.GeneratorPositionFromIndex||Returns the GeneratorPosition object that maps to the item at the specified index.|
|IItemContainerGenerator.GetItemContainerGeneratorForPanel||Returns the ItemContainerGenerator appropriate for use by the specified panel.|
|IItemContainerGenerator.IndexFromGeneratorPosition||Returns the index that maps to the specified GeneratorPosition.|
|IItemContainerGenerator.PrepareItemContainer||Prepares the specified element as the container for the corresponding item.|
|IItemContainerGenerator.Remove||This member supports the Windows Presentation Foundation (WPF) infrastructure and is not intended to be used directly from your code.|
|IItemContainerGenerator.RemoveAll||Removes all generated (realized) items.|
|IItemContainerGenerator.StartAt(GeneratorPosition, GeneratorDirection)||Prepares the generator to generate items, starting at the specified GeneratorPosition, and in the specified GeneratorDirection.|
|IItemContainerGenerator.StartAt(GeneratorPosition, GeneratorDirection, Boolean)||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||This member supports the Windows Presentation Foundation (WPF) infrastructure and is not intended to be used directly from your code.|
|IWeakEventListener.ReceiveWeakEvent||This member supports the Windows Presentation Foundation (WPF) infrastructure and is not intended to be used directly from your code.|
implements IItemContainerGenerator, which is the interface that defines a type which:
Generates UIElement items on behalf of a multiple-item control.
Each ItemsControl type has a corresponding container type. Container elements are the objects that contain the data items in the item collection. For example, for ListBox, the generated containers are ListBoxItem controls; for ComboBox, they are ComboBoxItem controls.
The ItemsControl generates its items through the IItemContainerGenerator interface. The ItemContainerGenerator property of the ItemsControl is of type , which implements the IItemContainerGenerator interface. Therefore, you can access the object associated with your ItemsControl using the ItemContainerGenerator property. For example, if you have a data-bound TreeView, and you want to get a TreeViewItem based on its index or its associated data item, you can use the ItemContainerGenerator.ContainerFromIndex or the ItemContainerGenerator.ContainerFromItem method. Alternatively, you can use the ItemContainerGenerator.IndexFromContainer or the ItemContainerGenerator.ItemFromContainer method to get the index or data item associated with a given generated container element.
Apart from those usages, the IItemContainerGenerator interface is used in advanced scenarios. Typically, advanced applications that have their own implementation of a virtualizing panel call members of the interface.
The following example shows a ListBox and its items.
The following example shows how to retrieve the item by specifying the index of the item in the ContainerFromIndex property of the .
After you have retrieved the list box item, you can display the contents of the item, as shown in the following example.
Windows 8 Consumer Preview, Windows Server 8 Beta, Windows 7, Windows Server 2008 SP2, Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.