UIElementCollection Class
TOC
Collapse the table of content
Expand the table of content

UIElementCollection Class

 

Represents an ordered collection of UIElement child elements.

Namespace:   System.Windows.Controls
Assembly:  PresentationFramework (in PresentationFramework.dll)

System::Object
  System.Windows.Controls::UIElementCollection

public ref class UIElementCollection : IList, ICollection, IEnumerable

NameDescription
System_CAPS_pubmethodUIElementCollection(UIElement^, FrameworkElement^)

Initializes a new instance of the UIElementCollection class.

NameDescription
System_CAPS_pubpropertyCapacity

Gets or sets the number of elements that the UIElementCollection can contain.

System_CAPS_pubpropertyCount

Gets the actual number of elements in the collection.

System_CAPS_pubpropertyIsSynchronized

Gets a value that indicates whether access to the ICollection interface is synchronized (thread-safe).

System_CAPS_pubpropertyItem[Int32]

Gets or sets the UIElement stored at the zero-based index position of the UIElementCollection.

System_CAPS_pubpropertySyncRoot

Gets an object that you can use to synchronize access to the ICollection interface.

NameDescription
System_CAPS_pubmethodAdd(UIElement^)

Adds the specified element to the UIElementCollection.

System_CAPS_pubmethodClear()

Removes all elements from a UIElementCollection.

System_CAPS_protmethodClearLogicalParent(UIElement^)

Clears the logical parent of an element when the element leaves a UIElementCollection.

System_CAPS_pubmethodContains(UIElement^)

Determines whether a specified element is in the UIElementCollection.

System_CAPS_pubmethodCopyTo(Array^, Int32)

Copies a UIElement from a UIElementCollection to an array, starting at a specified index position.

System_CAPS_pubmethodCopyTo(array<UIElement^>^, Int32)

Copies a UIElement from a UIElementCollection to an array, starting at a specified index position.

System_CAPS_pubmethodEquals(Object^)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_protmethodFinalize()

Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.)

System_CAPS_pubmethodGetEnumerator()

Returns an enumerator that can iterate the UIElementCollection.

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_pubmethodIndexOf(UIElement^)

Returns the index position of a specified element in a UIElementCollection.

System_CAPS_pubmethodInsert(Int32, UIElement^)

Inserts an element into a UIElementCollection at the specified index position.

System_CAPS_protmethodMemberwiseClone()

Creates a shallow copy of the current Object.(Inherited from Object.)

System_CAPS_pubmethodRemove(UIElement^)

Removes the specified element from a UIElementCollection.

System_CAPS_pubmethodRemoveAt(Int32)

Removes the UIElement at the specified index.

System_CAPS_pubmethodRemoveRange(Int32, Int32)

Removes a range of elements from a UIElementCollection.

System_CAPS_protmethodSetLogicalParent(UIElement^)

Sets the logical parent of an element in a UIElementCollection.

System_CAPS_pubmethodToString()

Returns a string that represents the current object.(Inherited from Object.)

NameDescription
System_CAPS_pubinterfaceSystem_CAPS_privmethodIList::Add(Object^)

This type or member supports the Windows Presentation Foundation (WPF) infrastructure and is not intended to be used directly from your code. For a description of this member, see Add.

System_CAPS_pubinterfaceSystem_CAPS_privmethodIList::Contains(Object^)

This type or member supports the Windows Presentation Foundation (WPF) infrastructure and is not intended to be used directly from your code. For a description of this member, see Contains.

System_CAPS_pubinterfaceSystem_CAPS_privmethodIList::IndexOf(Object^)

This type or member supports the Windows Presentation Foundation (WPF) infrastructure and is not intended to be used directly from your code. For a description of this member, see IndexOf.

System_CAPS_pubinterfaceSystem_CAPS_privmethodIList::Insert(Int32, Object^)

This type or member supports the Windows Presentation Foundation (WPF) infrastructure and is not intended to be used directly from your code. For a description of this member, see Insert.

System_CAPS_pubinterfaceSystem_CAPS_privmethodIList::Remove(Object^)

This type or member supports the Windows Presentation Foundation (WPF) infrastructure and is not intended to be used directly from your code. For a description of this member, see Remove.

System_CAPS_pubinterfaceSystem_CAPS_privpropertyIList::IsFixedSize

This type or member supports the Windows Presentation Foundation (WPF) infrastructure and is not intended to be used directly from your code. For a description of this member, see IsFixedSize.

System_CAPS_pubinterfaceSystem_CAPS_privpropertyIList::IsReadOnly

This type or member supports the Windows Presentation Foundation (WPF) infrastructure and is not intended to be used directly from your code. For a description of this member, see IsReadOnly.

System_CAPS_pubinterfaceSystem_CAPS_privpropertyIList::Item[Int32]

This type or member supports the Windows Presentation Foundation (WPF) infrastructure and is not intended to be used directly from your code. For a description of this member, see Item.

NameDescription
System_CAPS_pubmethodAsParallel()

Overloaded. Enables parallelization of a query.(Defined by ParallelEnumerable.)

System_CAPS_pubmethodAsQueryable()

Overloaded. Converts an IEnumerable to an IQueryable.(Defined by Queryable.)

System_CAPS_pubmethodCast<TResult>()

Casts the elements of an IEnumerable to the specified type.(Defined by Enumerable.)

System_CAPS_pubmethodOfType<TResult>()

Filters the elements of an IEnumerable based on a specified type.(Defined by Enumerable.)

The Panel base class uses a UIElementCollection to represent its collection of child elements. Methods and properties defined by the UIElementCollection affect all objects derived from Panel and define a common feature-set for the manipulation of Panel child elements.

A UIElementCollection has affinity to its own context (class). You must access the collection from the context of the owning Panel.

The following example uses the Add method to add child content to a parent StackPanel. You do this by using the Children property, which is of type UIElementCollection.

void AddButton(object sender, MouseButtonEventArgs e)
{
	sp1.Children.Clear();
	btn = new Button();
	btn.Content = "New Button";
	sp1.Children.Add(btn);
}

.NET Framework
Available since 3.0
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show:
© 2016 Microsoft