CollectionViewSource 类

定义

CollectionView 类的 Extensible Application Markup Language (XAML) 代理。The Extensible Application Markup Language (XAML) proxy of a CollectionView class.

public ref class CollectionViewSource : System::Windows::DependencyObject, System::ComponentModel::ISupportInitialize, System::Windows::IWeakEventListener
public class CollectionViewSource : System.Windows.DependencyObject, System.ComponentModel.ISupportInitialize, System.Windows.IWeakEventListener
type CollectionViewSource = class
    inherit DependencyObject
    interface ISupportInitialize
    interface IWeakEventListener
Public Class CollectionViewSource
Inherits DependencyObject
Implements ISupportInitialize, IWeakEventListener
继承
实现

注解

CollectionViewSourceCollectionView类的代理, 或派生自CollectionView的类。CollectionViewSource is a proxy for a CollectionView class, or a class derived from CollectionView. CollectionViewSource启用XAMLXAML代码以设置CollectionView常用属性, 并将这些设置传递到基础视图。CollectionViewSource enables XAMLXAML code to set the commonly used CollectionView properties, passing these settings to the underlying view. CollectionViewSource具有一个View属性, 该属性包含实际视图Source和保存源集合的属性。CollectionViewSource has a View property that holds the actual view and a Source property that holds the source collection.

您可以将集合视图视为绑定源集合的顶层, 这允许您根据排序、筛选和组查询来导航并显示集合, 所有这些操作都无需处理基础源集合本身。You can think of a collection view as the layer on top of the binding source collection that allows you to navigate and display the collection based on sort, filter, and group queries, all without having to manipulate the underlying source collection itself. 如果源集合实现了INotifyCollectionChanged接口, 则会将CollectionChanged事件引发的更改传播到视图。If the source collection implements the INotifyCollectionChanged interface, the changes raised by the CollectionChanged event are propagated to the views.

由于视图不会更改基础源集合,因此每个源集合都可以有多个关联的视图。Because views do not change the underlying source collections, each source collection can have multiple views associated with it. 例如, 你可能有一个对象的Task集合。For example, you may have a collection of Task objects. 使用视图,可以通过不同方式显示相同数据。With the use of views, you can display that same data in different ways. 例如,可能希望在页面左侧显示按优先级排序的任务,而在页面右侧显示按区域分组的任务。For example, on the left side of your page you may want to show tasks sorted by priority, and on the right side, grouped by area.

有关详细信息,请参阅数据绑定概述中的“绑定到集合”一节。For more information, see the Binding to Collections section in the Data Binding Overview.

构造函数

CollectionViewSource()

初始化 CollectionViewSource 类的新实例。Initializes a new instance of the CollectionViewSource class.

字段

CanChangeLiveFilteringProperty

标识 CanChangeLiveFiltering 依赖项属性。Identifies the CanChangeLiveFiltering dependency property.

CanChangeLiveGroupingProperty

标识 CanChangeLiveGrouping 依赖项属性。Identifies the CanChangeLiveGrouping dependency property.

CanChangeLiveSortingProperty

标识 CanChangeLiveSorting 依赖项属性。Identifies the CanChangeLiveSorting dependency property.

CollectionViewTypeProperty

标识 CollectionViewType 依赖项属性。Identifies the CollectionViewType dependency property.

IsLiveFilteringProperty

标识 IsLiveFiltering 依赖项属性。Identifies the IsLiveFiltering dependency property.

IsLiveFilteringRequestedProperty

标识 IsLiveFilteringRequested 依赖项属性。Identifies the IsLiveFilteringRequested dependency property.

IsLiveGroupingProperty

标识 IsLiveGrouping 依赖项属性。Identifies the IsLiveGrouping dependency property.

IsLiveGroupingRequestedProperty

标识 IsLiveGroupingRequested 依赖项属性。Identifies the IsLiveGroupingRequested dependency property.

IsLiveSortingProperty

标识 IsLiveSorting 依赖项属性。Identifies the IsLiveSorting dependency property.

IsLiveSortingRequestedProperty

标识 IsLiveSortingRequested 依赖项属性。Identifies the IsLiveSortingRequested dependency property.

SourceProperty

标识 Source 依赖项属性。Identifies the Source dependency property.

ViewProperty

标识 CollectionViewType 依赖项属性。Identifies the CollectionViewType dependency property.

属性

CanChangeLiveFiltering

获取一个值,该值指示集合视图是否支持打开或关闭实时筛选数据。Gets a value that indicates whether the collection view supports turning filtering data in real time on or off.

CanChangeLiveGrouping

获取一个值,该值指示集合视图是否支持在真实时间中打开或关闭分组数据。Gets a value that indicates whether the collection view supports turning grouping data in real time on or off.

CanChangeLiveSorting

获取一个值,该值指示集合视图是否支持在真实时间中打开或关闭排序数据。Gets a value that indicates whether the collection view supports turning sorting data in real time on or off.

CollectionViewType

获取或设置所需视图类型。Gets or sets the desired view type.

Culture

获取或设置用于排序和比较等操作的区域性。Gets or sets the culture that is used for operations such as sorting and comparisons.

DependencyObjectType

获取对此实例的 CLRCLR 类型进行包装的 DependencyObjectTypeGets the DependencyObjectType that wraps the CLRCLR type of this instance.

(继承自 DependencyObject)
Dispatcher

获取与此 Dispatcher 关联的 DispatcherObjectGets the Dispatcher this DispatcherObject is associated with.

(继承自 DispatcherObject)
GroupDescriptions

获取或设置 GroupDescription 对象的集合,该集合描述集合中的项在视图中的分组方式。Gets or sets a collection of GroupDescription objects that describes how the items in the collection are grouped in the view.

IsLiveFiltering

获取一个值,该值指示 CollectionViewSource 是否是实时筛选的数据。Gets a value that indicates whether the CollectionViewSource is filtering data in real time.

IsLiveFilteringRequested

获取或设置指示 CollectionViewSource 是否应筛选实时数据(如果它能够)的值。Gets or sets a value that indicates whether CollectionViewSource should filter the data in real time if it can.

IsLiveGrouping

获取一个值,该值指示 CollectionViewSource 组数据是否是实时的。Gets a value that indicates whether the CollectionViewSource groups data in real time.

IsLiveGroupingRequested

获取或设置指示 CollectionViewSource 是否应分组实时数据(如果它能够)的值。Gets or sets a value that indicates whether CollectionViewSource should group the data in real time if it can.

IsLiveSorting

获取一个值,该值指示 CollectionViewSource 分类数据是否是实时的。Gets a value that indicates whether the CollectionViewSource sorts data in real time.

IsLiveSortingRequested

获取或设置指示 CollectionViewSource 是否应对实时数据进行排序(如果它能够)的值。Gets or sets a value that indicates whether CollectionViewSource should sort the data in real time if it can.

IsSealed

获取一个值,该值指示此实例当前是否为密封的(只读)。Gets a value that indicates whether this instance is currently sealed (read-only).

(继承自 DependencyObject)
LiveFilteringProperties

获取在真实时间中参与筛选数据的属性的字符集合。Gets a collection of strings that specify the properties that participate in filtering data in real time.

LiveGroupingProperties

获取在真实时间中参与分组数据的属性的字符集合。Gets a collection of strings that specify the properties that participate in grouping data in real time.

LiveSortingProperties

获取在真实时间中参与排序数据的属性的字符集合。Gets a collection of strings that specify the properties that participate in sorting data in real time.

SortDescriptions

获取或设置 SortDescription 对象的集合,该集合描述集合中的项在视图中的排序方式。Gets or sets a collection of SortDescription objects that describes how the items in the collection are sorted in the view.

Source

获取或设置要从中创建该视图的集合对象。Gets or sets the collection object from which to create this view.

View

获取当前与 CollectionViewSource 的此实例关联的视图对象。Gets the view object that is currently associated with this instance of CollectionViewSource.

方法

CheckAccess()

确定调用线程是否可以访问此 DispatcherObjectDetermines whether the calling thread has access to this DispatcherObject.

(继承自 DispatcherObject)
ClearValue(DependencyProperty)

清除属性的本地值。Clears the local value of a property. 要清除的属性由 DependencyProperty 标识符指定。The property to be cleared is specified by a DependencyProperty identifier.

(继承自 DependencyObject)
ClearValue(DependencyPropertyKey)

清除只读属性的本地值。Clears the local value of a read-only property. 要清除的属性由 DependencyPropertyKey 指定。The property to be cleared is specified by a DependencyPropertyKey.

(继承自 DependencyObject)
CoerceValue(DependencyProperty)

对指定依赖属性的值进行强制。Coerces the value of the specified dependency property. 通过对调用方 DependencyObject 上存在的依赖属性的属性元数据中所指定的任何 CoerceValueCallback 函数进行调用来完成此操作。This is accomplished by invoking any CoerceValueCallback function specified in property metadata for the dependency property as it exists on the calling DependencyObject.

(继承自 DependencyObject)
DeferRefresh()

进入延迟循环,该循环可用于将更改合并到视图并延迟自动刷新。Enters a defer cycle that you can use to merge changes to the view and delay automatic refresh.

Equals(Object)

确定提供的 DependencyObject 是否等效于当前 DependencyObjectDetermines whether a provided DependencyObject is equivalent to the current DependencyObject.

(继承自 DependencyObject)
GetDefaultView(Object)

返回给定源的默认视图。Returns the default view for the given source.

GetHashCode()

获取此 DependencyObject 的哈希代码。Gets a hash code for this DependencyObject.

(继承自 DependencyObject)
GetLocalValueEnumerator()

创建一个专用的枚举数,用于确定哪些依赖项属性在此 DependencyObject 上具有以本地方式设置的值。Creates a specialized enumerator for determining which dependency properties have locally set values on this DependencyObject.

(继承自 DependencyObject)
GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
GetValue(DependencyProperty)

DependencyObject 的此实例返回依赖属性的当前有效值。Returns the current effective value of a dependency property on this instance of a DependencyObject.

(继承自 DependencyObject)
InvalidateProperty(DependencyProperty)

重新评估指定依赖属性的有效值。Re-evaluates the effective value for the specified dependency property.

(继承自 DependencyObject)
IsDefaultView(ICollectionView)

返回一个值,该值指示给定视图是否为 Source 集合的默认视图。Returns a value that indicates whether the given view is the default view for the Source collection.

MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
OnCollectionViewTypeChanged(Type, Type)

CollectionViewType 属性更改时调用。Invoked when the CollectionViewType property changes.

OnPropertyChanged(DependencyPropertyChangedEventArgs)

每当更新此 DependencyObject 的任何依赖属性的有效值时调用。Invoked whenever the effective value of any dependency property on this DependencyObject has been updated. 更改的特定依赖属性将在事件数据中报告。The specific dependency property that changed is reported in the event data.

(继承自 DependencyObject)
OnSourceChanged(Object, Object)

Source 属性更改时调用。Invoked when the Source property changes.

ReadLocalValue(DependencyProperty)

如果存在,则返回依赖属性的本地值。Returns the local value of a dependency property, if it exists.

(继承自 DependencyObject)
ReceiveWeakEvent(Type, Object, EventArgs)

处理集中事件表中的事件。Handles events from the centralized event table.

SetCurrentValue(DependencyProperty, Object)

设置依赖属性的值而不更改其值源。Sets the value of a dependency property without changing its value source.

(继承自 DependencyObject)
SetValue(DependencyProperty, Object)

设置依赖属性的本地值,该值由其依赖属性标识符指定。Sets the local value of a dependency property, specified by its dependency property identifier.

(继承自 DependencyObject)
SetValue(DependencyPropertyKey, Object)

设置一个只读依赖属性的本地值,该值由依赖属性的 DependencyPropertyKey 标识符指定。Sets the local value of a read-only dependency property, specified by the DependencyPropertyKey identifier of the dependency property.

(继承自 DependencyObject)
ShouldSerializeProperty(DependencyProperty)

返回一个值,该值指示序列化进程是否应序列化所提供的依赖属性的值。Returns a value that indicates whether serialization processes should serialize the value for the provided dependency property.

(继承自 DependencyObject)
ToString()

返回一个表示当前对象的 string。Returns a string that represents the current object.

(继承自 Object)
VerifyAccess()

强制调用线程具有此 DispatcherObject 的访问权限。Enforces that the calling thread has access to this DispatcherObject.

(继承自 DispatcherObject)

事件

Filter

提供筛选逻辑。Provides filtering logic.

显式界面实现

ISupportInitialize.BeginInit()

用信号通知对象初始化即将开始。Signals the object that initialization is starting.

ISupportInitialize.EndInit()

用信号通知对象初始化已完成。Signals the object that initialization is complete.

IWeakEventListener.ReceiveWeakEvent(Type, Object, EventArgs)

接收集中事件管理器中的事件。Receives events from the centralized event manager.

适用于