One. Method:
Containerfromindex: Returns the container for the item at the specified index in the itemcollection.
Containerfromitem: Returns the container (Comboxitem, etc.) that corresponds to the item being developed.
Equals (object): Determines whether the developed object is equal to the current object.
Finalize: Allows an object to attempt to free resources and attempt other cleanup operations before garbage collection is reclaimed against object.
Generatorpositionfromindex: Gets the location at which the item was generated at the specified index.
GetHashCode: Serves as a hash function for a particular type.
GetType: Gets the type of the current instance.
Indexfromcontainer: Gets the index of the item that has the specified generated container.
Indexfromgeneratorposition: Returns the index mapped to the specified gereratorposition.
Itemfromcontainer: Returns the corresponding item generated by the specified container.
Two. Events
Itemschanged: Occurs when an item within the collection has changed.
Three. Note
Notesthe ItemContainerGenerator class maintains an association between an item control and its item container. If a control has an associated itemcontainergenerator, it can be retrieved through the properties of the control.
You can useItemContainerGenerator Retrieves the item or retrieves the container by specifying a data item, based on the index of the item. For example, if you have a combox that has data boundand you want to get a comboxitem based on its index, you can use the Containerfromindex method. If you want to retrieve data items, you can use the Itemfromcontainer method.
Four. Example:
C#:
Public MyTest () { InitializeComponent (); String[] mycollection= New string[]{"Item 1", "Item 2", "Item 3", "Item 4", "Item 5"};
Conmboxitem item = (Comboxitem)
}
Xaml:
<stackpanel x:name= "LayoutRoot" background= "white" > <combox x:name= "Mycombox" width= "$" itemssource= "{Binding}" margin= "5"/> <button content= "Add Child to Item 4" width= "" click= "Button_Click"/></ Stackpanel>
WPF methods for obtaining entry controls based on data items-itemcontainergenerator