CompositeCollection CompositeCollection CompositeCollection CompositeCollection Class

Definition

Enables multiple collections and items to be displayed as a single list.

public ref class CompositeCollection : System::Collections::IList, System::Collections::Specialized::INotifyCollectionChanged, System::ComponentModel::ICollectionViewFactory, System::Windows::IWeakEventListener
[System.Windows.Localizability(System.Windows.LocalizationCategory.Ignore)]
public class CompositeCollection : System.Collections.IList, System.Collections.Specialized.INotifyCollectionChanged, System.ComponentModel.ICollectionViewFactory, System.Windows.IWeakEventListener
type CompositeCollection = class
    interface IList
    interface ICollection
    interface IEnumerable
    interface INotifyCollectionChanged
    interface ICollectionViewFactory
    interface IWeakEventListener
Public Class CompositeCollection
Implements ICollectionViewFactory, IList, INotifyCollectionChanged, IWeakEventListener
Inheritance
CompositeCollectionCompositeCollectionCompositeCollectionCompositeCollection
Attributes
Implements

Remarks

CompositeCollection can contain items such as strings, objects, XML nodes, elements, as well as other collections. An ItemsControl uses the data in the CompositeCollection to generate its content according to its ItemTemplate. For more information about using ItemsControl objects to bind to collections, see the Binding to Collections section of the Data Binding Overview.

Constructors

CompositeCollection() CompositeCollection() CompositeCollection() CompositeCollection()

Creates a new instance of the CompositeCollection class that is empty and has default initial capacity.

CompositeCollection(Int32) CompositeCollection(Int32) CompositeCollection(Int32) CompositeCollection(Int32)

Creates a new instance of the CompositeCollection class that is empty and has a specified initial capacity.

Properties

Count Count Count Count

Gets the number of items stored in this collection.

Item[Int32] Item[Int32] Item[Int32] Item[Int32]

Indexer property that retrieves or replaces the item at the given zero-based offset in the collection.

Methods

Add(Object) Add(Object) Add(Object) Add(Object)

Adds the specified item to this collection.

Clear() Clear() Clear() Clear()

Clears the collection.

Contains(Object) Contains(Object) Contains(Object) Contains(Object)

Checks to see if a given item is in this collection.

CopyTo(Array, Int32) CopyTo(Array, Int32) CopyTo(Array, Int32) CopyTo(Array, Int32)

Makes a shallow copy of object references from this collection to the given array.

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

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

(Inherited from Object)
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)
IndexOf(Object) IndexOf(Object) IndexOf(Object) IndexOf(Object)

Returns the index in this collection where the given item is found.

Insert(Int32, Object) Insert(Int32, Object) Insert(Int32, Object) Insert(Int32, Object)

Inserts an item in the collection at a given index. All items after the given position are moved down by one.

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

Creates a shallow copy of the current Object.

(Inherited from Object)
ReceiveWeakEvent(Type, Object, EventArgs) ReceiveWeakEvent(Type, Object, EventArgs) ReceiveWeakEvent(Type, Object, EventArgs) ReceiveWeakEvent(Type, Object, EventArgs)

Handles events from the centralized event table.

Remove(Object) Remove(Object) Remove(Object) Remove(Object)

Removes the given item reference from the collection. All remaining items move up by one.

RemoveAt(Int32) RemoveAt(Int32) RemoveAt(Int32) RemoveAt(Int32)

Removes an item from the collection at the given index. All remaining items move up by one.

ToString() ToString() ToString() ToString()

Returns a string that represents the current object.

(Inherited from Object)

Events

CollectionChanged CollectionChanged CollectionChanged CollectionChanged

Occurs when the collection changes, either by adding or removing an item.

Explicit Interface Implementations

ICollection.IsSynchronized ICollection.IsSynchronized ICollection.IsSynchronized ICollection.IsSynchronized

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

ICollection.SyncRoot ICollection.SyncRoot ICollection.SyncRoot ICollection.SyncRoot

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

ICollectionViewFactory.CreateView() ICollectionViewFactory.CreateView() ICollectionViewFactory.CreateView() ICollectionViewFactory.CreateView()

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

IEnumerable.GetEnumerator() IEnumerable.GetEnumerator() IEnumerable.GetEnumerator() IEnumerable.GetEnumerator()

Returns an enumerator.

IList.IsFixedSize IList.IsFixedSize IList.IsFixedSize IList.IsFixedSize

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

IList.IsReadOnly IList.IsReadOnly IList.IsReadOnly IList.IsReadOnly

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

INotifyCollectionChanged.CollectionChanged INotifyCollectionChanged.CollectionChanged INotifyCollectionChanged.CollectionChanged INotifyCollectionChanged.CollectionChanged

Occurs when the collection has changed.

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.

Extension Methods

Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable)

Casts the elements of an IEnumerable to the specified type.

OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable)

Filters the elements of an IEnumerable based on a specified type.

AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable)

Enables parallelization of a query.

AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable)

Converts an IEnumerable to an IQueryable.

Applies to

See also