[This documentation is preliminary and is subject to change.]
Applies to: Metro style apps only
Represents an ordered collection of UIElement objects.
Inheritance
- Object
- UIElementCollection
Syntax
<panelobject> oneOrMoreChildren </panelobject>
XAML Values
- oneOrMoreChildren
-
One or more objects elements for classes that derive from UIElement.
- panelobject
-
Object element (opening and closing tags) for a class that derives from Panel. Typically this is one of the panels, such as Canvas, Grid, or StackPanel.
Attributes
- MarshalingBehaviorAttribute(Agile)
- ThreadingAttribute(Both)
- VersionAttribute(NTDDI_WIN8)
- WebHostHiddenAttribute()
Members
The UIElementCollection class has these types of members:
Methods
The UIElementCollection class has these methods. It also inherits methods from the Object class.
| Method | Description |
|---|---|
| Append | Adds a new item to the collection. |
| Clear | Removes all items from the collection. |
| First | Returns the iterator for iteration over the items in the collection. |
| GetAt | Returns the item located at the specified index. |
| GetMany | Retrieves multiple elements in a single pass through the iterator. |
| GetView | Gets an immutable view into the collection. |
| IndexOf | Retrieves the index of the specified item. |
| InsertAt | Inserts the specified item at the specified index. |
| RemoveAt | Removes the item at the specified index. |
| RemoveAtEnd | Removes the last item in the collection. |
| ReplaceAll | Initially clears the collection, then inserts the provided array as new items. |
| SetAt | Sets the value at the specified index to the UIElement value specified. |
Properties
The UIElementCollection class has these properties.
| Property | Access type | Description |
|---|---|---|
| Read-only | Gets the size (count) of the collection. |
Remarks
Collection API for C# and Visual Basic
If you are writing code that accesses this collection type using C# or Visual Basic, the members shown in the class members listings are not entirely correct for C# and Visual Basic. In C# and Visual Basic, these collections support the APIs from IList<T> and IEnumerable<T>.
The following table lists the APIs that you should use to access the collection in C# or Visual Basic:
| Add method |
|---|
| Adds an item to the collection. |
|
Syntax: valueThe item to add to the end of the collection.
|
| Contains method |
| Determines whether the collection contains a specific value. |
|
Syntax: itemThe object to locate in the collection. Returns true if item is found in the collection; otherwise, false.
|
| CopyTo method |
| Copies the elements of a collection to an array, starting at a particular array index. |
|
Syntax: arrayThe one-dimensional array that is the destination of the elements copied from the collection. arrayIndexThe zero-based index in array at which copying begins.
|
| GetEnumerator method |
| Returns an enumerator that iterates through the collection. |
|
Syntax: |
| IndexOf method |
| Determines the index of a specific item in the collection. |
|
Syntax: itemThe object to find in the collection. Returns the index if found, or -1 if not found.
|
| Insert method |
| Inserts an item into the collection at the specified index. |
|
Syntax: indexThe zero-based index to insert at. valueThe object to insert into the collection.
|
| Remove method |
| Removes the first occurence of a specific object from the collection. |
|
Syntax: itemThe object to remove from the collection. Returns true if item is successfully removed from the collection; otherwise, false.
|
| RemoveAt method |
| Removes the item at a specified index. |
|
Syntax: indexThe zero-based index to remove at.
|
| Count property |
| Gets the number of elements contained in the collection. |
|
Syntax: |
| Item property |
| Gets or sets an item in the collection by accessing its zero-based index. |
|
Syntax: indexThe zero-based index of the item to get or set.
|
| IsReadOnly property |
| Gets a value that determines whether the collection is read-only. |
|
Syntax: |
Requirements
|
Minimum supported client | Windows 8 Release Preview |
|---|---|
|
Minimum supported server | Windows Server 2012 |
|
Namespace |
|
|
Metadata |
|
See also
Build date: 5/22/2012
