ListCollectionView 類別

定義

表示實作 IList 之集合的集合檢視。Represents the collection view for collections that implement IList.

public ref class ListCollectionView : System::Windows::Data::CollectionView, System::Collections::IComparer, System::ComponentModel::ICollectionViewLiveShaping, System::ComponentModel::IEditableCollectionView, System::ComponentModel::IEditableCollectionViewAddNewItem, System::ComponentModel::IItemProperties
public ref class ListCollectionView : System::Windows::Data::CollectionView, System::Collections::IComparer, System::ComponentModel::ICollectionViewLiveShaping, System::ComponentModel::IEditableCollectionViewAddNewItem, System::ComponentModel::IItemProperties
public ref class ListCollectionView : System::Windows::Data::CollectionView, System::Collections::IComparer, System::ComponentModel::IEditableCollectionView, System::ComponentModel::IItemProperties
public ref class ListCollectionView : System::Windows::Data::CollectionView, System::Collections::IComparer, System::ComponentModel::IEditableCollectionViewAddNewItem, System::ComponentModel::IItemProperties
public class ListCollectionView : System.Windows.Data.CollectionView, System.Collections.IComparer, System.ComponentModel.ICollectionViewLiveShaping, System.ComponentModel.IEditableCollectionView, System.ComponentModel.IEditableCollectionViewAddNewItem, System.ComponentModel.IItemProperties
public class ListCollectionView : System.Windows.Data.CollectionView, System.Collections.IComparer, System.ComponentModel.ICollectionViewLiveShaping, System.ComponentModel.IEditableCollectionViewAddNewItem, System.ComponentModel.IItemProperties
public class ListCollectionView : System.Windows.Data.CollectionView, System.Collections.IComparer, System.ComponentModel.IEditableCollectionView, System.ComponentModel.IItemProperties
public class ListCollectionView : System.Windows.Data.CollectionView, System.Collections.IComparer, System.ComponentModel.IEditableCollectionViewAddNewItem, System.ComponentModel.IItemProperties
type ListCollectionView = class
    inherit CollectionView
    interface IComparer
    interface ICollectionViewLiveShaping
    interface IEditableCollectionView
    interface IEditableCollectionViewAddNewItem
    interface IItemProperties
type ListCollectionView = class
    inherit CollectionView
    interface IComparer
    interface IEditableCollectionView
    interface IItemProperties
type ListCollectionView = class
    inherit CollectionView
    interface IComparer
    interface IEditableCollectionViewAddNewItem
    interface IEditableCollectionView
    interface IItemProperties
type ListCollectionView = class
    inherit CollectionView
    interface IComparer
    interface IEditableCollectionViewAddNewItem
    interface IEditableCollectionView
    interface ICollectionViewLiveShaping
    interface IItemProperties
Public Class ListCollectionView
Inherits CollectionView
Implements ICollectionViewLiveShaping, IComparer, IEditableCollectionView, IEditableCollectionViewAddNewItem, IItemProperties
Public Class ListCollectionView
Inherits CollectionView
Implements ICollectionViewLiveShaping, IComparer, IEditableCollectionViewAddNewItem, IItemProperties
Public Class ListCollectionView
Inherits CollectionView
Implements IComparer, IEditableCollectionView, IItemProperties
Public Class ListCollectionView
Inherits CollectionView
Implements IComparer, IEditableCollectionViewAddNewItem, IItemProperties
繼承
實作

備註

當您系結至資料集合時,可能會想要排序、篩選或分組資料。When you bind to a data collection, you may want to sort, filter, or group the data. 若要這樣做,您可以使用集合視圖。To do that, you use collection views. 您可以將作為系結 CollectionView 來源集合頂端的圖層,讓您能夠根據排序、篩選和群組查詢來流覽和顯示來源集合,而不需要操作基礎來源集合本身。You can think of a CollectionView as the layer on top of the binding source collection that allows you to navigate and display the source collection based on sort, filter, and group queries, all without having to manipulate the underlying source collection itself. 如果來源集合實作為 INotifyCollectionChanged 介面,事件所引發的變更 CollectionChanged 就會傳播到 views。If the source collection implements the INotifyCollectionChanged interface, the changes raised by the CollectionChanged event are propagated to the views.

所有集合都有預設值 CollectionViewAll collections have a default CollectionView. 針對所有執行的集合 IList ,此 ListCollectionView 物件為預設 view 物件。For all collections implementing IList, the ListCollectionView object is the default view object. BindingListCollectionView是集合視圖類別,用於執行的集合 IBindingListThe BindingListCollectionView is the collection view class used for collections that implement IBindingList. 若要取得預設視圖,請使用 GetDefaultView 方法。To get the default view, you use the GetDefaultView method. 如需範例,請參閱 如何:取得資料集合的預設視圖For an example, see How to: Get the Default View of a Data Collection.

如需集合視圖的詳細資訊,請參閱資料系結 總覽For more information about collection views, see Data Binding Overview.

建構函式

ListCollectionView(IList)

使用已提供實作 ListCollectionView 的集合,初始化 IList 類別的新執行個體。Initializes a new instance of the ListCollectionView class, using a supplied collection that implements IList.

屬性

ActiveComparer

取得或設定目前正用於排序的比較子 (Comparer)。Gets or sets the current active comparer that is used in sorting.

ActiveFilter

取得或設定目前使用中的 Filter 回呼。Gets or sets the current active Filter callback.

AllowsCrossThreadChanges

取得值,指出建立 CollectionView 的執行緒之外的執行緒是否可以變更 SourceCollectionGets a value that indicates whether a thread other than the one that created the CollectionView can change the SourceCollection.

(繼承來源 CollectionView)
CanAddNew

取得值,這個值表示新項目是否可以加入至此集合。Gets a value that indicates whether a new item can be added to the collection.

CanAddNewItem

取得值,這個值表示指定的物件是否可以加入至此集合。Gets a value that indicates whether a specified object can be added to the collection.

CanCancelEdit

取得值,這個值表示集合檢視是否可以捨棄暫止的變更,並還原已編輯物件的原始值。Gets a value that indicates whether the collection view can discard pending changes and restore the original values of an edited object.

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.

CanFilter

取得值,這個值指出檢視是否支援回呼架構的篩選。Gets a value that indicates whether the view supports callback-based filtering.

CanGroup

取得值,這個值表示此集合檢視是否支援群組。Gets a value that indicates whether the collection view supports grouping.

CanRemove

取得值,這個值表示是否可以從集合中移除某個項目。Gets a value that indicates whether an item can be removed from the collection.

CanSort

取得值,這個值表示此集合檢視是否支援排序。Gets a value that indicates whether the collection view supports sorting.

Comparer

傳回物件,可用來比較檢視中的項目。Returns an object that you can use to compare items in the view.

(繼承來源 CollectionView)
Count

取得估計的資料錄數目。Gets the estimated number of records.

Culture

取得或設定排序期間要使用的文化特性 (Culture) 資訊。Gets or sets the culture information to use during sorting.

(繼承來源 CollectionView)
CurrentAddItem

取得要在目前加入異動期間加入的項目。Gets the item that is being added during the current add transaction.

CurrentEditItem

取得集合內將被編輯的項目。Gets the item in the collection that is being edited.

CurrentItem

取得檢視中的目前項目。Gets the current item in the view.

(繼承來源 CollectionView)
CurrentPosition

取得 CurrentItem 在 (可選擇經過排序及篩選) 檢視內的序數位置。Gets the ordinal position of the CurrentItem within the (optionally sorted and filtered) view.

(繼承來源 CollectionView)
CustomSort

取得或設定實作 IComparer 的自訂物件,以排序檢視中的項目。Gets or sets a custom object that implements IComparer to sort items in the view.

Dispatcher

取得與這個 Dispatcher 關聯的 DispatcherObjectGets the Dispatcher this DispatcherObject is associated with.

(繼承來源 DispatcherObject)
Filter

取得或設定方法,這個方法會用來判斷項目是否適合包含在檢視中。Gets or sets a method that is used to determine whether an item is suitable for inclusion in the view.

GroupBySelector

取得或設定委派 (Delegate),以選取 GroupDescription 做為父群組及其層級的功能。Gets or sets a delegate to select the GroupDescription as a function of the parent group and its level.

GroupDescriptions

取得 GroupDescription 物件的集合,這些物件會描述如何在檢視中分組集合內的項目。Gets a collection of GroupDescription objects that describe how the items in the collection are grouped in the view.

Groups

取得最上層群組。Gets the top-level groups.

InternalCount

取得 InternalList 中的資料錄數目。Gets the number of records in the InternalList.

InternalList

取得已篩選和已排序的項目清單。Gets the filtered and sorted list of items.

IsAddingNew

取得值,這個值表示加入異動是否正在進行中。Gets a value that indicates whether an add transaction is in progress.

IsCurrentAfterLast

取得值,這個值表示檢視的 CurrentItem 是否超過集合的結尾。Gets a value that indicates whether the CurrentItem of the view is beyond the end of the collection.

(繼承來源 CollectionView)
IsCurrentBeforeFirst

取得值,指出檢視的 CurrentItem 是否在集合開頭之前。Gets a value that indicates whether the CurrentItem of the view is before the beginning of the collection.

(繼承來源 CollectionView)
IsCurrentInSync

取得值,指出 CurrentItem 是否位於 CurrentPositionGets a value that indicates whether the CurrentItem is at the CurrentPosition.

(繼承來源 CollectionView)
IsDataInGroupOrder

取得或設定值,這個值表示項目清單 (在套用任何排序和篩選條件 (如果有的話) 之後) 是否已經依照正確順序來分組。Gets or sets a value that indicates whether the list of items (after applying the sort and filters, if any) is already in the correct order for grouping.

IsDynamic

取得值,表示基礎集合是否提供變更通知。Gets a value that indicates whether the underlying collection provides change notifications.

(繼承來源 CollectionView)
IsEditingItem

取得值,這個值表示編輯異動是否正在進行中。Gets a value that indicates whether an edit transaction is in progress.

IsEmpty

傳回值,這個值表示結果 (已篩選) 檢視是否為空白。Returns a value that indicates whether the resulting (filtered) view is empty.

IsGrouping

取得值,這個值表示檢視中是否有群組。Gets a value that indicates whether there are groups in the view.

IsInUse

取得值,指出是否有任何物件訂閱這個 CollectionView 的事件。Gets a value that indicates whether any object is subscribing to the events of this CollectionView.

(繼承來源 CollectionView)
IsLiveFiltering

取得或設定值,指出是否已啟用即時篩選資料。Gets or sets a value that indicates whether filtering data in real time is enabled.

IsLiveGrouping

取得或設定值,指出是否已啟用即時設定資料群組。Gets or sets a value that indicates whether grouping data in real time is enabled.

IsLiveSorting

取得或設定值,指出是否已啟用即時排序。Gets or sets a value that indicates whether sorting in real time is enabled.

IsRefreshDeferred

取得值,指出是否仍然有未處理的 DeferRefresh() 在使用中。Gets a value that indicates whether there is an outstanding DeferRefresh() in use.

(繼承來源 CollectionView)
ItemProperties

取得物件的集合,這類物件會描述集合內項目的屬性。Gets a collection of objects that describes the properties of the items in the collection.

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.

NeedsRefresh

取得值,表示檢視是否需要重新整理。Gets a value that indicates whether the view needs to be refreshed.

(繼承來源 CollectionView)
NewItemPlaceholderPosition

取得或設定新項目預留位置 (Placeholder) 在 ListCollectionView 中的位置 (Position)。Gets or sets the position of the new item placeholder in the ListCollectionView.

SortDescriptions

取得 SortDescription 物件的集合,說明集合內的項目如何在檢視中分組。Gets a collection of SortDescription objects that describes how the items in the collection are sorted in the view.

SourceCollection

傳回未經篩選的基礎集合。Returns the underlying unfiltered collection.

(繼承來源 CollectionView)
UpdatedOutsideDispatcher

取得值,指出是否已有需要更新變更記錄,因為已經在另一個執行緒上接收到 CollectionChanged 通知,而沒有先進入使用者介面 (UI)user interface (UI) 執行緒發送器。Gets a value that indicates whether it has been necessary to update the change log because a CollectionChanged notification has been received on a different thread without first entering the 使用者介面 (UI)user interface (UI) thread dispatcher.

(繼承來源 CollectionView)
UsesLocalArray

取得值,這個值表示是否需要資料的私用複本進行排序和篩選。Gets a value that indicates whether a private copy of the data is needed for sorting and filtering.

方法

AddNew()

開始加入異動並傳回暫止的新項目。Starts an add transaction and returns the pending new item.

AddNewItem(Object)

將指定的物件加入至集合。Adds the specified object to the collection.

CancelEdit()

結束編輯異動,並在可能情況下還原項目的原始值。Ends the edit transaction, and if possible, restores the original value to the item.

CancelNew()

結束加入異動並捨棄暫止的新項目。Ends the add transaction and discards the pending new item.

CheckAccess()

判斷呼叫的執行是否可以存取這個 DispatcherObjectDetermines whether the calling thread has access to this DispatcherObject.

(繼承來源 DispatcherObject)
ClearChangeLog()
已過時。

清除變更記錄中任何暫止的變更。Clears any pending changes from the change log.

(繼承來源 CollectionView)
ClearPendingChanges()

清除集合的未處理變更。Clears unprocessed changed to the collection.

(繼承來源 CollectionView)
CommitEdit()

結束編輯異動並儲存暫止的變更。Ends the edit transaction and saves the pending changes.

CommitNew()

結束加入異動並儲存暫止的新項目。Ends the add transaction and saves the pending new item.

Compare(Object, Object)

比較兩個物件並傳回值,表示一個物件是小於、等於還是大於另一個物件。Compares two objects and returns a value that indicates whether one is less than, equal to, or greater than the other.

Contains(Object)

傳回值,這個值指出指定的項目是否屬於此集合檢視。Returns a value that indicates whether a given item belongs to the collection view.

DeferRefresh()

進入延後循環,您可以用來合併變更到檢視,並且延遲自動重新整理。Enters a defer cycle that you can use to merge changes to the view and delay automatic refresh.

(繼承來源 CollectionView)
DetachFromSourceCollection()

CollectionView 移除基礎集合的參考。Removes the reference to the underlying collection from the CollectionView.

(繼承來源 CollectionView)
EditItem(Object)

開始所指定項目的編輯異動。Begins an edit transaction of the specified item.

Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(繼承來源 Object)
GetEnumerator()

傳回物件,可用來列舉檢視中的項目。Returns an object that you can use to enumerate the items in the view.

GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(繼承來源 Object)
GetItemAt(Int32)

擷取位於檢視中指定位置的項目。Retrieves the item at the specified position in the view.

GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(繼承來源 Object)
IndexOf(Object)

傳回此集合中指定之資料項目的索引,如果該項目的索引為未知,則為 -1。Returns the index where the given data item belongs in the collection, or -1 if the index of that item is unknown.

InternalContains(Object)

傳回值,這個值表示 InternalList 是否包含項目。Return a value that indicates whether the InternalList contains the item.

InternalGetEnumerator()

傳回 InternalList 的列舉值。Returns an enumerator for the InternalList.

InternalIndexOf(Object)

傳回 InternalList 中指定項目的索引。Returns the index of the specified item in the InternalList.

InternalItemAt(Int32)

傳回 InternalList 中指定索引處的項目。Returns the item at the given index in the InternalList.

MemberwiseClone()

建立目前 Object 的淺層複製。Creates a shallow copy of the current Object.

(繼承來源 Object)
MoveCurrentTo(Object)

將指定項目設定為檢視中的 CurrentItemSets the specified item to be the CurrentItem in the view.

(繼承來源 CollectionView)
MoveCurrentToFirst()

將檢視中的第一個項目設定為 CurrentItemSets the first item in the view as the CurrentItem.

(繼承來源 CollectionView)
MoveCurrentToLast()

將檢視中的最後一個項目設定為 CurrentItemSets the last item in the view as the CurrentItem.

(繼承來源 CollectionView)
MoveCurrentToNext()

將檢視中 CurrentItem 後面的項目設定為 CurrentItemSets the item after the CurrentItem in the view as the CurrentItem.

(繼承來源 CollectionView)
MoveCurrentToPosition(Int32)

將指定索引處的項目設定為檢視中的 CurrentItemSets the item at the specified index to be the CurrentItem in the view.

MoveCurrentToPrevious()

將檢視中 CurrentItem 前面的項目設定為 CurrentItemSets the item before the CurrentItem in the view as the CurrentItem.

(繼承來源 CollectionView)
OKToChangeCurrent()

傳回值,指出檢視是否可以變更哪一個項目是 CurrentItemReturns a value that indicates whether the view can change which item is the CurrentItem.

(繼承來源 CollectionView)
OnAllowsCrossThreadChangesChanged()

發生於 AllowsCrossThreadChanges 屬性變更時。Occurs when the AllowsCrossThreadChanges property changes.

OnAllowsCrossThreadChangesChanged()

發生於 AllowsCrossThreadChanges 屬性變更時。Occurs when the AllowsCrossThreadChanges property changes.

(繼承來源 CollectionView)
OnBeginChangeLogging(NotifyCollectionChangedEventArgs)
已過時。

由基底類別 (Base Class) 呼叫,以通知衍生類別 (Derived Class) CollectionChanged 事件已經公佈至訊息佇列。Called by the base class to notify the derived class that a CollectionChanged event has been posted to the message queue.

OnCollectionChanged(NotifyCollectionChangedEventArgs)

引發 CollectionChanged 事件。Raises the CollectionChanged event.

(繼承來源 CollectionView)
OnCollectionChanged(Object, NotifyCollectionChangedEventArgs)

引發 CollectionChanged 事件。Raises the CollectionChanged event.

(繼承來源 CollectionView)
OnCurrentChanged()

引發 CurrentChanged 事件。Raises the CurrentChanged event.

(繼承來源 CollectionView)
OnCurrentChanging()

引發 CurrentChanging 事件,此事件無法取消。Raises a CurrentChanging event that is not cancelable.

(繼承來源 CollectionView)
OnCurrentChanging(CurrentChangingEventArgs)

使用指定的引數,引發 CurrentChanging 事件。Raises the CurrentChanging event with the specified arguments.

(繼承來源 CollectionView)
OnPropertyChanged(PropertyChangedEventArgs)

使用指定的引數,引發 PropertyChanged 事件。Raises the PropertyChanged event using the specified arguments.

(繼承來源 CollectionView)
PassesFilter(Object)

傳回值,指出指定的項目是否在屬於檢視的基礎集合中。Returns a value that indicates whether the specified item in the underlying collection belongs to the view.

ProcessCollectionChanged(NotifyCollectionChangedEventArgs)

處理 CollectionChanged 事件。Handles CollectionChanged events.

ProcessPendingChanges()

確認已認可對集合的所有暫止變更。Ensures that all pending changes to the collection have been committed.

(繼承來源 CollectionView)
Refresh()

重新建立檢視。Re-creates the view.

(繼承來源 CollectionView)
RefreshOrDefer()

重新整理檢視,或是指定檢視在延後循環完成時需要重新整理。Refreshes the view or specifies that the view needs to be refreshed when the defer cycle completes.

(繼承來源 CollectionView)
RefreshOverride()

重新建立檢視。Recreates the view.

Remove(Object)

從集合中移除指定的項目。Removes the specified item from the collection.

RemoveAt(Int32)

從集合中移除位於指定之位置的項目。Removes the item at the specified position from the collection.

SetCurrent(Object, Int32)

將指定的項目與索引設定為 CurrentItemCurrentPosition 屬性的值。Sets the specified item and index as the values of the CurrentItem and CurrentPosition properties.

(繼承來源 CollectionView)
SetCurrent(Object, Int32, Int32)

將指定的項目與索引設定為 CurrentItemCurrentPosition 屬性的值。Sets the specified item and index as the values of the CurrentItem and CurrentPosition properties. 這個方法可從衍生類別的建構函式呼叫。This method can be called from a constructor of a derived class.

(繼承來源 CollectionView)
ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(繼承來源 Object)
VerifyAccess()

請強制執行可以存取這個 DispatcherObject 的呼叫執行緒。Enforces that the calling thread has access to this DispatcherObject.

(繼承來源 DispatcherObject)

事件

CollectionChanged

當檢視變更時發生。Occurs when the view has changed.

(繼承來源 CollectionView)
CurrentChanged

CurrentItem 已經變更之後發生。Occurs after the CurrentItem has changed.

(繼承來源 CollectionView)
CurrentChanging

發生在 CurrentItem 正在變更時。Occurs when the CurrentItem is changing.

(繼承來源 CollectionView)
PropertyChanged

當屬性值已變更時發生。Occurs when a property value has changed.

(繼承來源 CollectionView)

明確介面實作

IComparer.Compare(Object, Object)

這個成員支援 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()

傳回 IEnumerator 物件,可用來列舉檢視中的項目。Returns an IEnumerator object that you can use to enumerate the items in the view.

(繼承來源 CollectionView)
INotifyCollectionChanged.CollectionChanged

當檢視變更時發生。Occurs when the view has changed.

(繼承來源 CollectionView)
INotifyPropertyChanged.PropertyChanged

當屬性值變更時發生。Occurs when a property value changes.

(繼承來源 CollectionView)

擴充方法

Cast<TResult>(IEnumerable)

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

OfType<TResult>(IEnumerable)

根據指定的型別來篩選 IEnumerable 的項目。Filters the elements of an IEnumerable based on a specified type.

AsParallel(IEnumerable)

啟用查詢的平行化作業。Enables parallelization of a query.

AsQueryable(IEnumerable)

IEnumerable 轉換成 IQueryableConverts an IEnumerable to an IQueryable.

適用於