CompositeCollection CompositeCollection CompositeCollection CompositeCollection Class

定義

允許以單一清單顯示多個集合和項目。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
繼承
CompositeCollectionCompositeCollectionCompositeCollectionCompositeCollection
屬性
實作

備註

CompositeCollection 可包含項目,例如字串、 物件、XMLXML節點、 項目,以及其他集合。CompositeCollection can contain items such as strings, objects, XMLXML nodes, elements, as well as other collections. ItemsControl使用中的資料CompositeCollection來產生其內容根據其ItemTemplateAn ItemsControl uses the data in the CompositeCollection to generate its content according to its ItemTemplate. 如需使用詳細資訊ItemsControl物件繫結至集合時,請參閱 < 繫結至的 [集合] 區段資料繫結概觀For more information about using ItemsControl objects to bind to collections, see the Binding to Collections section of the Data Binding Overview.

建構函式

CompositeCollection() 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)

建立 CompositeCollection 類別的新執行個體,這個執行個體是空白且可具有指定的初始容量。Creates a new instance of the CompositeCollection class that is empty and has a specified initial capacity.

屬性

Count Count Count Count

取得儲存在此集合中的項目數。Gets the number of items stored in this collection.

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

索引子屬性,擷取或取代集合中指定以零為起始之位移 (Offset) 位置的項目。Indexer property that retrieves or replaces the item at the given zero-based offset in the collection.

方法

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)

從這個集合建立物件參考的淺層複本 (Shallow Copy) 至指定的陣列。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()

取得目前執行個體的 TypeGets 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()

建立目前 Object 的淺層複本 (Shallow Copy)。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)

事件

CollectionChanged CollectionChanged CollectionChanged CollectionChanged

集合變更 (新增或移除項目) 時發生。Occurs when the collection changes, either by adding or removing an item.

明確介面實作

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

這個成員支援 Windows Presentation Foundation (WPF)Windows Presentation Foundation (WPF) 基礎結構,但是您不可以從程式碼直接使用它。This member supports the Windows Presentation Foundation (WPF)Windows Presentation Foundation (WPF) infrastructure and is not intended to be used directly from your code.

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

這個成員支援 Windows Presentation Foundation (WPF)Windows Presentation Foundation (WPF) 基礎結構,但是您不可以從程式碼直接使用它。This member supports the Windows Presentation Foundation (WPF)Windows Presentation Foundation (WPF) infrastructure and is not intended to be used directly from your code.

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

這個成員支援 Windows Presentation Foundation (WPF)Windows Presentation Foundation (WPF) 基礎結構,但是您不可以從程式碼直接使用它。This member supports the Windows Presentation Foundation (WPF)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

這個成員支援 Windows Presentation Foundation (WPF)Windows Presentation Foundation (WPF) 基礎結構,但是您不可以從程式碼直接使用它。This member supports the Windows Presentation Foundation (WPF)Windows Presentation Foundation (WPF) infrastructure and is not intended to be used directly from your code.

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

這個成員支援 Windows Presentation Foundation (WPF)Windows Presentation Foundation (WPF) 基礎結構,但是您不可以從程式碼直接使用它。This member supports the Windows Presentation Foundation (WPF)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)

這個成員支援 Windows Presentation Foundation (WPF)Windows Presentation Foundation (WPF) 基礎結構,但是您不可以從程式碼直接使用它。This member supports the Windows Presentation Foundation (WPF)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)

IEnumerable 的項目轉換成指定的型別。Casts the elements of an IEnumerable to the specified type.

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

根據指定的型別來篩選 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)

將轉換IEnumerableIQueryableConverts an IEnumerable to an IQueryable.

適用於

另請參閱