DataGridCollectionView Class

DataGrid-readable view over an IEnumerable.

Definition

Namespace: Avalonia.Collections
Assembly: Avalonia.Controls.DataGrid (in Avalonia.Controls.DataGrid.dll) Version: 11.3.999
public sealed class DataGridCollectionView : IDataGridCollectionView, 
	IEnumerable, INotifyCollectionChanged, IList, ICollection, INotifyPropertyChanged
Inheritance
Object    DataGridCollectionView
Implements
IDataGridCollectionView, ICollection, IEnumerable, IList, INotifyCollectionChanged, INotifyPropertyChanged

Properties

CanAddNew Gets a value indicating whether the view supports AddNew.
CanCancelEdit Gets a value indicating whether the view supports the notion of "pending changes" on the current edit item. This may vary, depending on the view and the particular item. For example, a view might return true if the current edit item implements IEditableObject, or if the view has special knowledge about the item that it can use to support rollback of pending changes.
CanChangePage Gets a value indicating whether the PageIndex value is allowed to change or not.
CanFilter Gets a value indicating whether we support filtering with this ICollectionView.
CanGroup Gets a value indicating whether this view supports grouping. When this returns false, the rest of the interface is ignored.
CanRemove Gets a value indicating whether the view supports Remove and RemoveAt.
CanSort Gets a value indicating whether we support sorting with this ICollectionView.
Count Gets the number of records in the view after filtering, sorting, and paging.
Culture Gets or sets Culture to use during sorting.
CurrentAddItem Gets the new item when an AddNew transaction is in progress Otherwise it returns null.
CurrentEditItem Gets the affected item when an EditItem transaction is in progress Otherwise it returns null.
CurrentItem Gets the "current item" for this view
CurrentPosition Gets the ordinal position of the CurrentItem within the (optionally sorted and filtered) view.
Filter Gets or sets the Filter, which is a callback set by the consumer of the ICollectionView and used by the implementation of the ICollectionView to determine if an item is suitable for inclusion in the view.
GroupDescriptions Gets the description of grouping, indexed by level.
Groups Gets the top-level groups, constructed according to the descriptions given in GroupDescriptions.
IsAddingNew Gets a value indicating whether an "AddNew" transaction is in progress.
IsCurrentAfterLast Gets a value indicating whether currency is beyond the end (End-Of-File).
IsCurrentBeforeFirst Gets a value indicating whether currency is before the beginning (Beginning-Of-File).
IsEditingItem Gets a value indicating whether an EditItem transaction is in progress.
IsEmpty Gets a value indicating whether the resulting (filtered) view is empty.
IsPageChanging Gets a value indicating whether a page index change is in process or not.
ItemInt32 Return the item at the specified index
ItemCount Gets the minimum number of items known to be in the source collection that verify the current filter if any
NeedsRefresh Gets a value indicating whether this view needs to be refreshed.
PageIndex Gets the current page we are on. (zero based)
PageSize Gets or sets the number of items to display on a page. If the PageSize = 0, then we are not paging, and will display all items in the collection. Otherwise, we will have separate pages for the items to display.
SortDescriptions Gets the Sort criteria to sort items in collection.
SourceCollection Gets the source of the IEnumerable collection we are using for our view.
TotalItemCount Gets the total number of items in the view before paging is applied.

Methods

AddNew Add a new item to the underlying collection. Returns the new item. After calling AddNew and changing the new item as desired, either CommitNew or CancelNew" should be called to complete the transaction.
CancelEdit Complete the transaction started by . The pending changes (if any) to the item are discarded.
CancelNew Complete the transaction started by AddNew. The new item is removed from the collection.
CommitEdit Complete the transaction started by . The pending changes (if any) to the item are committed.
CommitNew Complete the transaction started by AddNew. We follow the WPF convention in that the view's sort, filter, and paging specifications (if any) are applied to the new item.
Contains(Object) Return true if the item belongs to this view. No assumptions are made about the item. This method will behave similarly to IList.Contains(). If the caller knows that the item belongs to the underlying collection, it is more efficient to call PassesFilter.
DeferRefresh Enter a Defer Cycle. Defer cycles are used to coalesce changes to the ICollectionView.
EditItem(Object) Begins an editing transaction on the given item. The transaction is completed by calling either CommitEdit or CancelEdit. Any changes made to the item during the transaction are considered "pending", provided that the view supports the notion of "pending changes" for the given item.
Equals(Object)Determines whether the specified object is equal to the current object.
(Inherited from Object)
GetEnumerator Implementation of IEnumerable.GetEnumerator(). This provides a way to enumerate the members of the collection without changing the currency.
GetHashCodeServes as the default hash function.
(Inherited from Object)
GetItemAt(Int32) Retrieve item at the given zero-based index in this DataGridCollectionView, after the source collection is filtered, sorted, and paged.
GetTypeGets the Type of the current instance.
(Inherited from Object)
IndexOf(Object) Return the index where the given item appears, or -1 if doesn't appear.
MoveCurrentTo(Object) Move to the given item.
MoveCurrentToFirst Move to the first item.
MoveCurrentToLast Move to the last item.
MoveCurrentToNext Move to the next item.
MoveCurrentToPosition(Int32) Move CurrentItem to this index
MoveCurrentToPrevious Move to the previous item.
MoveToFirstPage Moves to the first page.
MoveToLastPage Moves to the last page. The move is only attempted when TotalItemCount is known.
MoveToNextPage Moves to the page after the current page we are on.
MoveToPage(Int32) Requests a page move to page pageIndex.
MoveToPreviousPage Moves to the page before the current page we are on.
PassesFilter(Object) Return true if the item belongs to this view. The item is assumed to belong to the underlying DataCollection; this method merely takes filters into account. It is commonly used during collection-changed notifications to determine if the added/removed item requires processing. Returns true if no filter is set on collection view.
Refresh Re-create the view, using any SortDescriptions and/or Filters.
Remove(Object) Remove the given item from the underlying collection. It needs to be in the current filtered, sorted, and paged view to call
RemoveAt(Int32) Remove the item at the given index from the underlying collection. The index is interpreted with respect to the view (filtered, sorted, and paged list).
ToStringReturns a string that represents the current object.
(Inherited from Object)

Events

CollectionChanged Raise this event when the (filtered) view changes
CurrentChanged Raised when the CurrentItem property changed
CurrentChanging Raised when the CurrentItem property is changing
PageChanged Raised when a page index change completed
PageChanging Raised when a page index change is requested
PropertyChanged PropertyChanged event.

Extension Methods

GetWeakCollectionChangedObservable Gets a weak observable for the CollectionChanged event.
(Defined by NotifyCollectionChangedExtensions)
WeakSubscribe(ActionNotifyCollectionChangedEventArgs) Subscribes to the CollectionChanged event using a weak subscription.
(Defined by NotifyCollectionChangedExtensions)
WeakSubscribe(NotifyCollectionChangedEventHandler) Subscribes to the CollectionChanged event using a weak subscription.
(Defined by NotifyCollectionChangedExtensions)

See Also