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. 使用中的数据,根据其ItemTemplate内容生成其内容。 CompositeCollection ItemsControlAn 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]

检索或替换位于集合中给定从零开始的偏移量处的项的索引器属性。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)

将对象引用从此集合浅表复制到给定数组。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 的浅表副本。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.

扩展方法

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)

IEnumerable 转换为 IQueryableConverts an IEnumerable to an IQueryable.

适用于

另请参阅