ItemContainerGenerator ItemContainerGenerator ItemContainerGenerator ItemContainerGenerator Class

Definition

Generates the user interface (UI) on behalf of its host, such as an ItemsControl.

public ref class ItemContainerGenerator sealed : System::Windows::Controls::Primitives::IRecyclingItemContainerGenerator, System::Windows::IWeakEventListener
public sealed class ItemContainerGenerator : System.Windows.Controls.Primitives.IRecyclingItemContainerGenerator, System.Windows.IWeakEventListener
type ItemContainerGenerator = class
    interface IRecyclingItemContainerGenerator
    interface IItemContainerGenerator
    interface IWeakEventListener
Public NotInheritable Class ItemContainerGenerator
Implements IRecyclingItemContainerGenerator, IWeakEventListener
Inheritance
ItemContainerGeneratorItemContainerGeneratorItemContainerGeneratorItemContainerGenerator
Implements

Remarks

ItemContainerGenerator implements IItemContainerGenerator, which is the interface that defines a type which:

  • Maintains an association between the data view of a multiple-item control, such as ContainerFromElement and the corresponding UIElement items.

  • 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 ItemContainerGenerator, which implements the IItemContainerGenerator interface. Therefore, you can access the ItemContainerGenerator 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.

Properties

Items Items Items Items

Gets the collection of items that belong to this ItemContainerGenerator.

Status Status Status Status

The generation status of the ItemContainerGenerator.

Methods

ContainerFromIndex(Int32) ContainerFromIndex(Int32) ContainerFromIndex(Int32) ContainerFromIndex(Int32)

Returns the element corresponding to the item at the given index within the ItemCollection.

ContainerFromItem(Object) ContainerFromItem(Object) ContainerFromItem(Object) ContainerFromItem(Object)

Returns the UIElement corresponding to the given item.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GenerateBatches() GenerateBatches() GenerateBatches() GenerateBatches()

Returns an object that manages the Status property.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

Gets the Type of the current instance.

(Inherited from Object)
IndexFromContainer(DependencyObject) IndexFromContainer(DependencyObject) IndexFromContainer(DependencyObject) IndexFromContainer(DependencyObject)

Returns the index to an item that corresponds to the specified, generated UIElement.

IndexFromContainer(DependencyObject, Boolean) IndexFromContainer(DependencyObject, Boolean) IndexFromContainer(DependencyObject, Boolean) IndexFromContainer(DependencyObject, Boolean)

Returns the index to an item that corresponds to the specified, generated UIElement, optionally recursively searching hierarchical items.

ItemFromContainer(DependencyObject) ItemFromContainer(DependencyObject) ItemFromContainer(DependencyObject) ItemFromContainer(DependencyObject)

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

MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

Returns a string that represents the current object.

(Inherited from Object)

Events

ItemsChanged ItemsChanged ItemsChanged ItemsChanged

The ItemsChanged event is raised by a ItemContainerGenerator to inform layouts that the items collection has changed.

StatusChanged StatusChanged StatusChanged StatusChanged

The StatusChanged event is raised by a ItemContainerGenerator to inform controls that its status has changed.

Explicit Interface Implementations

IItemContainerGenerator.GenerateNext() IItemContainerGenerator.GenerateNext() IItemContainerGenerator.GenerateNext() IItemContainerGenerator.GenerateNext()

Returns the container element used to display the next item.

IItemContainerGenerator.GenerateNext(Boolean) IItemContainerGenerator.GenerateNext(Boolean) IItemContainerGenerator.GenerateNext(Boolean) 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(Int32) IItemContainerGenerator.GeneratorPositionFromIndex(Int32) IItemContainerGenerator.GeneratorPositionFromIndex(Int32) IItemContainerGenerator.GeneratorPositionFromIndex(Int32)

Returns the GeneratorPosition object that maps to the item at the specified index.

IItemContainerGenerator.GetItemContainerGeneratorForPanel(Panel) IItemContainerGenerator.GetItemContainerGeneratorForPanel(Panel) IItemContainerGenerator.GetItemContainerGeneratorForPanel(Panel) IItemContainerGenerator.GetItemContainerGeneratorForPanel(Panel)

Returns the ItemContainerGenerator appropriate for use by the specified panel.

IItemContainerGenerator.IndexFromGeneratorPosition(GeneratorPosition) IItemContainerGenerator.IndexFromGeneratorPosition(GeneratorPosition) IItemContainerGenerator.IndexFromGeneratorPosition(GeneratorPosition) IItemContainerGenerator.IndexFromGeneratorPosition(GeneratorPosition)

Returns the index that maps to the specified GeneratorPosition.

IItemContainerGenerator.PrepareItemContainer(DependencyObject) IItemContainerGenerator.PrepareItemContainer(DependencyObject) IItemContainerGenerator.PrepareItemContainer(DependencyObject) IItemContainerGenerator.PrepareItemContainer(DependencyObject)

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

IItemContainerGenerator.Remove(GeneratorPosition, Int32) IItemContainerGenerator.Remove(GeneratorPosition, Int32) IItemContainerGenerator.Remove(GeneratorPosition, Int32) IItemContainerGenerator.Remove(GeneratorPosition, Int32)

This member supports the Windows Presentation Foundation (WPF) infrastructure and is not intended to be used directly from your code.

IItemContainerGenerator.RemoveAll() IItemContainerGenerator.RemoveAll() IItemContainerGenerator.RemoveAll() IItemContainerGenerator.RemoveAll()

Removes all generated (realized) items.

IItemContainerGenerator.StartAt(GeneratorPosition, GeneratorDirection) IItemContainerGenerator.StartAt(GeneratorPosition, GeneratorDirection) IItemContainerGenerator.StartAt(GeneratorPosition, GeneratorDirection) 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) IItemContainerGenerator.StartAt(GeneratorPosition, GeneratorDirection, Boolean) IItemContainerGenerator.StartAt(GeneratorPosition, GeneratorDirection, Boolean) 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(GeneratorPosition, Int32) IRecyclingItemContainerGenerator.Recycle(GeneratorPosition, Int32) IRecyclingItemContainerGenerator.Recycle(GeneratorPosition, Int32) IRecyclingItemContainerGenerator.Recycle(GeneratorPosition, Int32)

This member supports the Windows Presentation Foundation (WPF) infrastructure and is not intended to be used directly from your code.

IWeakEventListener.ReceiveWeakEvent(Type, Object, EventArgs) IWeakEventListener.ReceiveWeakEvent(Type, Object, EventArgs) IWeakEventListener.ReceiveWeakEvent(Type, Object, EventArgs) IWeakEventListener.ReceiveWeakEvent(Type, Object, EventArgs)

This member supports the Windows Presentation Foundation (WPF) infrastructure and is not intended to be used directly from your code.

Applies to

See Also