ClassQueryableCollectionView
Represents a view for grouping, sorting, filtering and paging data collection using LINQ based query operators.
Definition
Namespace:Telerik.Windows.Data
Assembly:Telerik.Windows.Data.dll
Syntax:
public class QueryableCollectionView : IEditableCollectionView, IEditableCollectionViewAddNewItem, ICollectionView, IEnumerable, INotifyCollectionChanged, INotifyPropertyChanged, IPagedCollectionView, IQueryableCollectionView, IItemProperties, IDisposable
Inheritance: objectQueryableCollectionView
Derived Classes:
Implements:
Constructors
QueryableCollectionView(IEnumerable)
Initializes a new instance of the QueryableCollectionView class.
Declaration
public QueryableCollectionView(IEnumerable source)
Parameters
source
The source collection.
QueryableCollectionView(IEnumerable, Type)
Initializes a new instance of the QueryableCollectionView class.
Declaration
public QueryableCollectionView(IEnumerable sourceCollection, Type itemType)
Parameters
sourceCollection
The source collection.
itemType
Type which will be used for all operations.
Exceptions
sourceCollection is null.
Properties
CanAddNew
Gets a value that indicates whether a new item can be added to the collection.
Declaration
public virtual bool CanAddNew { get; }
Property Value
true if SourceCollection is not IsFixedSize or Add method is available and collection element has a default constructor; otherwise, false.
CanAddNewItem
Gets a value that indicates whether a specified object can be added to the collection.
Declaration
public virtual bool CanAddNewItem { get; }
Property Value
true if a specified object can be added to the collection; otherwise false.
CanCancelEdit
Gets a value that indicates whether the editing of an item can be canceled.
Declaration
public virtual bool CanCancelEdit { get; }
Property Value
true if CurrentEditItem implements IEditableObject; otherwise, false.
CanChangePage
Gets a value that indicates whether the PageIndex value can change.
CanFilter
Gets a value that indicates whether this view supports filtering via the FilterDescriptors property.
Declaration
public virtual bool CanFilter { get; }
Property Value
For a default instance of QueryableCollectionView, this property always returns true.
CanGroup
Gets a value that indicates whether this view supports grouping via the GroupDescriptors property.
Declaration
public virtual bool CanGroup { get; }
Property Value
For a default instance of QueryableCollectionView, this property always returns true.
CanRemove
Gets a value that indicates whether an item can be removed from the collection.
Declaration
public virtual bool CanRemove { get; }
Property Value
true if an item can be removed from the collection; otherwise, false.
CanSort
Gets a value that indicates whether this view supports sorting via the SortDescriptors property.
Declaration
public virtual bool CanSort { get; }
Property Value
For a default instance of QueryableCollectionView, this property always returns true.
Count
Gets the number of records in the view after grouping, filtering, sorting, and paging.
Declaration
public int Count { get; }
Property Value
The number of records in the view after grouping, filtering, sorting, and paging.
Culture
Gets or sets the cultural info for any operations of the view that may differ by culture, such as sorting.
Declaration
public virtual CultureInfo Culture { get; set; }
Property Value
The culture to use during sorting.
CurrentAddItem
Gets the item that is being added during the current add transaction.
Declaration
public virtual object CurrentAddItem { get; }
Property Value
The item that is being added if IsAddingNew is true; otherwise, null.
CurrentEditItem
Gets the item in the collection that is being edited.
Declaration
public virtual object CurrentEditItem { get; }
Property Value
The item in the collection that is being edited if IsEditingItem is true; otherwise, null.
Filter
Gets or sets a callback used to determine if an item is suitable for inclusion in the view.
Declaration
public virtual Predicate<object> Filter { get; set; }
Property Value
A method used to determine if an item is suitable for inclusion in the view.
Exceptions
Setting Filter property is not supported. Use FilterDescriptors property instead.
FilterDescriptors
Gets the filter descriptors used for filtering operations.
Declaration
public virtual CompositeFilterDescriptorCollection FilterDescriptors { get; }
Property Value
CompositeFilterDescriptorCollection
The filter descriptors.
Implements
GroupDescriptions
Gets the underlying collection.
Declaration
protected ObservableCollection<GroupDescription> GroupDescriptions { get; }
Property Value
ObservableCollection<GroupDescription>
The for this view.
GroupDescriptors
Gets the group descriptors used for grouping operations.
Declaration
public virtual GroupDescriptorCollection GroupDescriptors { get; }
Property Value
The group descriptors.
Implements
Groups
Gets the top-level groups.
Declaration
public ReadOnlyObservableCollection<object> Groups { get; }
Property Value
ReadOnlyObservableCollection<object>
A read-only collection of the top-level groups or null if there are no groups.
InternalCount
Protected accessor to private count.
InternalList
Gets the list created from resulting query after applying filtering, sorting, grouping and paging.
Declaration
protected virtual IList InternalList { get; }
Property Value
The internal list for the current view.
IsAddingNew
Gets a value that indicates whether an add transaction is in progress.
Declaration
public virtual bool IsAddingNew { get; }
Property Value
true if an add transaction is in progress; otherwise, false.
IsEditingItem
Gets a value that indicates whether an edit transaction is in progress.
Declaration
public virtual bool IsEditingItem { get; }
Property Value
true if an edit transaction is in progress; otherwise, false.
IsEmpty
Returns a value that indicates whether the resulting view is empty.
Declaration
public bool IsEmpty { get; }
Property Value
true if the resulting view is empty; otherwise, false.
IsGrouped
Gets a value indicating whether this instance is grouped.
Declaration
public virtual bool IsGrouped { get; }
Property Value
true if this instance is grouped; otherwise, false.
IsLoading
Gets a value that indicates whether this view is loading data.
Declaration
public virtual bool IsLoading { get; protected set; }
Property Value
IsPageChanging
Gets a value that indicates whether a page index change is in process.
Declaration
public bool IsPageChanging { get; protected set; }
Property Value
true if the page index is changing; otherwise, false.
Implements
IsPaged
Gets a value indicating whether this instance has pages or not.
Declaration
protected virtual bool IsPaged { get; }
Property Value
true if this instance has PageSize greater than 0; otherwise, false.
ItemCount
Gets the minimum number of items known to be in the source collection.
Declaration
public virtual int ItemCount { get; }
Property Value
The minimum number of items known to be in the source collection.
Implements
ItemProperties
Gets a collection of objects that describes the properties of the items in the collection.
Declaration
public ReadOnlyCollection<ItemPropertyInfo> ItemProperties { get; }
Property Value
ReadOnlyCollection<ItemPropertyInfo>
A collection of objects that describes the properties of the items in the collection.
ItemPropertiesByPropertyName
Gets a dictionary of objects that describes the properties of the items in the collection by property name.
Declaration
public Dictionary<string, ItemPropertyInfo> ItemPropertiesByPropertyName { get; }
Property Value
Dictionary<string, ItemPropertyInfo>
A dictionary of objects that describes the properties of the items in the collection by property name.
ItemType
Gets or sets the type used for all internal data engine operations.
Declaration
public Type ItemType { get; set; }
Property Value
The type of the item.
NeedsRefresh
Gets a value that indicates whether this view needs to be refreshed.
Declaration
public bool NeedsRefresh { get; set; }
Property Value
true if the view needs to be refreshed; otherwise, false.
NewItemPlaceholderPosition
Gets or sets the position of the new item placeholder in the collection.
Declaration
public virtual NewItemPlaceholderPosition NewItemPlaceholderPosition { get; set; }
Property Value
NewItemPlaceholderPosition
One of the enumeration values that specifies the position of the new item placeholder in the collection.
PageIndex
Gets the zero-based index of the current page.
Declaration
public int PageIndex { get; protected set; }
Property Value
The zero-based index of the current page.
Implements
PageSize
Gets or sets the number of items to display on a page.
Declaration
public int PageSize { get; set; }
Property Value
The number of items to display on a page.
Implements
PendingCurrencyRefresh
Used to hold "old" currency info when DataLoadMode is Asynchronous and we need to refresh the currency after the load is complete. This field is not supposed to be used directly from your code.
Declaration
protected QueryableCollectionView.CurrencyRefreshInfo PendingCurrencyRefresh { get; set; }
Property Value
QueryableSourceCollection
Returns the queryable collection, constructed from SourceCollection.
Declaration
public virtual IQueryable QueryableSourceCollection { get; }
Property Value
An IQueryable object that is constructed from the underlying collection.
ShouldInitializeGroupProxy
Gets a value indicating whether should initialize group proxy.
Declaration
protected virtual bool ShouldInitializeGroupProxy { get; }
Property Value
true if should initialize group proxy; otherwise, false.
ShouldRefreshOrDeferOnPageSizeChange
Gets a value indicating whether this instance should RefreshOrDefer when PageSize changes.
Declaration
protected virtual bool ShouldRefreshOrDeferOnPageSizeChange { get; }
Property Value
true if this instance should RefreshOrDefer when PageSize changes; otherwise, false.
ShouldRespectIEditableObject
Gets or set a value that indicates whether IEditableObject methods are automatically invoked by QueryableCollectionView.
Declaration
public bool ShouldRespectIEditableObject { get; set; }
Property Value
SortDescriptions
Gets the underlying collection.
Declaration
protected SortDescriptionCollection SortDescriptions { get; }
Property Value
SortDescriptionCollection
The for this view.
SortDescriptors
Gets the sort descriptors used for sorting operations.
Declaration
public virtual SortDescriptorCollection SortDescriptors { get; }
Property Value
The sort descriptors.
Implements
SourceCollection
Returns the underlying collection.
Declaration
public IEnumerable SourceCollection { get; }
Property Value
An IEnumerable object that is the underlying collection.
TotalItemCount
Gets the total number of items in the source collection, or -1 if the total number is unknown.
Declaration
public virtual int TotalItemCount { get; protected set; }
Property Value
The total number of items in the source collection, or -1 if the total number is unknown.
Implements
Methods
AddNew()
Adds a new item to the collection.
Declaration
public virtual object AddNew()
Returns
The new item that is added to the collection.
Exceptions
CanAddNew is false.
AddNew(object)
Adds the new item to the collection.
Declaration
public void AddNew(object newItem)
Parameters
newItem
The new item that will be added to the collection.
Exceptions
CanAddNew is false.
AddNewItem(object)
Adds the specified object to the collection.
ApplySelectDescriptors(IQueryable)
Applies SelectDescriptors over the specified queryable.
Declaration
protected virtual IQueryable ApplySelectDescriptors(IQueryable queryable)
Parameters
queryable
The queryable.
Returns
CancelEdit()
Ends the edit transaction and discards any pending changes to the item.
Declaration
public virtual void CancelEdit()
Exceptions
CancelEdit is not supported for the current edit item. Only items implementing IEditableObject are supported.
CancelNew()
Ends the add transaction and discards the pending new item.
Declaration
public virtual void CancelNew()
CommitEdit()
Ends the edit transaction and saves the pending changes.
Declaration
public virtual void CommitEdit()
CommitNew()
Ends the add transaction and saves the pending new item.
Declaration
public virtual void CommitNew()
CompletePageMove(int)
Completes the page move.
Declaration
protected virtual void CompletePageMove(int newPageIndex)
Parameters
newPageIndex
The index of the new page.
ConstructNewItem()
Constructs a new item.
Contains(object)
Returns a value that indicates whether a given item belongs to this collection view.
CreateInternalList()
Called when internal list needs to be created.
Declaration
protected virtual void CreateInternalList()
CreateView()
Returns IQueryable with applied filtering, sorting, grouping and paging.
DeferRefresh()
Enters a defer cycle that you can use to merge changes to the view and delay automatic refresh.
Declaration
public IDisposable DeferRefresh()
Returns
An IDisposable object that you can use to dispose of the calling object.
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
public void Dispose()
Implements
Dispose(bool)
Unsubscribes form collection changed events.
Declaration
protected virtual void Dispose(bool disposing)
Parameters
disposing
EditItem(object)
Begins an edit transaction of the specified item.
Declaration
public virtual void EditItem(object item)
Parameters
item
The item to edit.
GetEffectiveItemCount()
Gets the count of items depending on the page and/or grouped state.
Declaration
protected virtual int GetEffectiveItemCount()
Returns
The count of items.
GetEnumerator()
Declaration
public virtual IEnumerator GetEnumerator()
Returns
Implements
GetInternalList()
Called when internal list is required.
GetItemAt(int)
Retrieves the item at the specified zero-based index in the view.
Declaration
public virtual object GetItemAt(int index)
Parameters
index
The zero-based index of the item to retrieve.
Returns
The item at the specified zero-based index in the view.
Exceptions
index is less than 0 or greater than ItemCount.
GetPagingDeterminativeItemCount()
Gets the paging determinative item count.
Declaration
protected virtual int GetPagingDeterminativeItemCount()
Returns
The paging determinative item count.
IndexOf(object)
Returns the zero-based index at which the specified item is located.
InitializeCurrencyOnRefresh(CurrencyRefreshInfo)
Initializes the currency on refresh.
Declaration
protected void InitializeCurrencyOnRefresh(QueryableCollectionView.CurrencyRefreshInfo currencyRefreshInfo)
Parameters
currencyRefreshInfo
QueryableCollectionView.CurrencyRefreshInfo
The currency refresh info.
InitializeCurrentItem()
Called when the current item should be initialized.
Declaration
protected void InitializeCurrentItem()
InitializeInternalList(IQueryable)
Called when internal list should be initialized.
Declaration
protected virtual void InitializeInternalList(IQueryable view)
Parameters
view
InvalidatePagingAndRefresh()
Invalidates the paging and refreshes the view.
Declaration
protected virtual void InvalidatePagingAndRefresh()
InvalidatePagingDeterminativeItemCount()
Invalidates the paging determinative item count.
Declaration
protected virtual void InvalidatePagingDeterminativeItemCount()
MoveCurrentToPosition(int)
Sets the item at the specified index to be the CurrentItem in the view.
Declaration
public bool MoveCurrentToPosition(int position)
Parameters
position
The index to set the CurrentItem to.
Returns
True if the resulting CurrentItem is an item within the view; otherwise, false.
Exceptions
position is out of range.
MoveToFirstPage()
Sets the first page as the current page.
Declaration
public bool MoveToFirstPage()
Returns
true if the operation was successful; otherwise, false.
Implements
MoveToLastPage()
Sets the last page as the current page.
Declaration
public bool MoveToLastPage()
Returns
true if the operation was successful; otherwise, false.
Implements
MoveToNextPage()
Moves to the page after the current page.
Declaration
public bool MoveToNextPage()
Returns
true if the operation was successful; otherwise, false.
Implements
MoveToPage(int)
Requests a page move to the page at the specified index.
MoveToPageCore(int)
Requests a page move to the page at the specified index.
MoveToPreviousPage()
Moves to the page before the current page.
Declaration
public bool MoveToPreviousPage()
Returns
true if the operation was successful; otherwise, false.
Implements
OnCollectionChanged(NotifyCollectionChangedEventArgs)
Raises the CollectionChanged event.
Declaration
protected virtual void OnCollectionChanged(NotifyCollectionChangedEventArgs args)
Parameters
args
NotifyCollectionChangedEventArgs
The NotifyCollectionChangedEventArgs instance containing the event data.
OnCurrentChanged(EventArgs)
Raises the CurrentChanged event.
OnCurrentChanging()
Raise a non-cancelable CurrentChanging event This is called when CurrentItem is affected by a CollectionChange (Remove or Refresh).
Declaration
protected void OnCurrentChanging()
OnCurrentChanging(CurrentChangingEventArgs)
Raises the CurrentChanging event.
Declaration
protected virtual void OnCurrentChanging(CurrentChangingEventArgs args)
Parameters
args
CurrentChangingEventArgs
The CurrentChangingEventArgs instance containing the event data.
OnFilterDescriptorsChanged()
Called when anything in the filter descriptors changes.
Declaration
[SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")]
protected virtual void OnFilterDescriptorsChanged()
OnFilterDescriptorsCollectionChanged(object, NotifyCollectionChangedEventArgs)
Invoked when the FilterDescriptors collection changes.
Declaration
protected virtual void OnFilterDescriptorsCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
Parameters
sender
Current instance of the QueryableCollectionView collection.
e
NotifyCollectionChangedEventArgs
Information about the change.
OnFilterDescriptorsItemChanged(object, ItemChangedEventArgs<IFilterDescriptor>)
Invoked when the FilterDescriptors item changes.
Declaration
protected virtual void OnFilterDescriptorsItemChanged(object sender, ItemChangedEventArgs<IFilterDescriptor> e)
Parameters
sender
Current instance of the QueryableCollectionView collection.
e
ItemChangedEventArgs<IFilterDescriptor>
Information about the change.
OnFilterDescriptorsLogicalOperatorChanged()
Invoked when the FilterDescriptors logical operator changes.
Declaration
protected virtual void OnFilterDescriptorsLogicalOperatorChanged()
OnGroupDescriptorsCollectionChanged(object, NotifyCollectionChangedEventArgs)
Invoked when the collection changes.
Declaration
protected virtual void OnGroupDescriptorsCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
Parameters
sender
Current instance of the QueryableCollectionView collection.
e
NotifyCollectionChangedEventArgs
Information about the change.
OnGroupDescriptorsItemChanged(object, ItemChangedEventArgs<IGroupDescriptor>)
Invoked when the GroupDescriptors item changes.
Declaration
protected virtual void OnGroupDescriptorsItemChanged(object sender, ItemChangedEventArgs<IGroupDescriptor> e)
Parameters
sender
Current instance of the QueryableCollectionView collection.
e
ItemChangedEventArgs<IGroupDescriptor>
Information about the change.
OnInternalListCreated()
Called when internal list is created.
Declaration
protected void OnInternalListCreated()
OnPropertyChanged(PropertyChangedEventArgs)
Raises the PropertyChanged event.
Declaration
protected virtual void OnPropertyChanged(PropertyChangedEventArgs e)
Parameters
e
The PropertyChangedEventArgs instance containing the event data.
OnPropertyChanged(string)
Raises the PropertyChanged event.
Declaration
protected void OnPropertyChanged(string propertyName)
Parameters
propertyName
Name of the property.
OnRefresh()
Invoked when the instance should be refreshed.
Declaration
protected virtual void OnRefresh()
OnSortDescriptorsCollectionChanged(object, NotifyCollectionChangedEventArgs)
Invoked when the SortDescriptors collection changes.
Declaration
protected virtual void OnSortDescriptorsCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
Parameters
sender
Current instance of the QueryableCollectionView collection.
e
NotifyCollectionChangedEventArgs
Information about the change.
OnSortDescriptorsItemChanged(object, ItemChangedEventArgs<ISortDescriptor>)
Invoked when the SortDescriptors item changes.
Declaration
protected virtual void OnSortDescriptorsItemChanged(object sender, ItemChangedEventArgs<ISortDescriptor> e)
Parameters
sender
Current instance of the QueryableCollectionView collection.
e
ItemChangedEventArgs<ISortDescriptor>
Information about the change.
PopulateInternalList(IQueryable)
Called when internal list should be populated.
Declaration
protected virtual void PopulateInternalList(IQueryable view)
Parameters
view
RaisePageChanged()
Raises the PageChanged event.
Declaration
protected void RaisePageChanged()
Refresh()
Declaration
public void Refresh()
RefreshGroupsOnItemAction(object, ItemAction)
Refreshes the groups according to the item and the respective action.
Declaration
protected void RefreshGroupsOnItemAction(object item, ItemAction action)
Parameters
item
The item.
action
The action.
RefreshOnItemAction(object, ItemAction)
Refreshes the view according to the item and the respective action.
Declaration
protected virtual void RefreshOnItemAction(object item, ItemAction action)
Parameters
item
The item.
action
The action.
RefreshOnItemActionWithoutPaging(object, ItemAction)
Refreshes the view according to the item and the respective action when there is no paging involved.
Declaration
protected void RefreshOnItemActionWithoutPaging(object item, ItemAction action)
Parameters
item
The item.
action
The action.
RefreshOverride()
Re-create the view over the associated IList.
Declaration
protected virtual void RefreshOverride()
RefreshOverrideCore()
Re-create the view over the associated IList.
Declaration
protected void RefreshOverrideCore()
Remove(object)
Removes the specified item from the collection.
Declaration
public virtual void Remove(object item)
Parameters
item
The item to remove.
RemoveAt(int)
Removes the item at the specified position from the collection.
Declaration
public virtual void RemoveAt(int index)
Parameters
index
The position of the item to remove.
SetCurrent(object, int)
Sets the CurrentItem and CurrentPosition.
SetCurrentPosition(int)
Sets the CurrentPosition to the given newPosition .
Declaration
protected void SetCurrentPosition(int newPosition)
Parameters
newPosition
The new position.
SetInternalList(IList)
Called when internal list should be set.
Sort(IQueryable)
Sorts the specified queryable.
Declaration
protected IQueryable Sort(IQueryable queryable)
Parameters
queryable
Returns
UpdateItemCount()
Called when the count of the items should be updated.
Declaration
protected void UpdateItemCount()
UpdateTotalItemCount()
Called when the count of all items should be updated.
Declaration
protected virtual void UpdateTotalItemCount()
Events
CollectionChanged
Declaration
public event NotifyCollectionChangedEventHandler CollectionChanged
Event Value
Implements
CurrentChanging
Declaration
public event CurrentChangingEventHandler CurrentChanging
Event Value
CurrentChangingEventHandler
GroupCollectionChanged
This is for internal use only and is not intended to be used directly from your code.
Declaration
public event EventHandler<NotifyGroupCollectionChangedEventArgs> GroupCollectionChanged
Event Value
PageChanged
Occurs when the PageIndex has changed.
Declaration
public event EventHandler<EventArgs> PageChanged
Event Value
Implements
PageChanging
Occurs when the PageIndex is changing.
Declaration
public event EventHandler<PageChangingEventArgs> PageChanging
Event Value
Implements
PropertyChanged
Declaration
public event PropertyChangedEventHandler PropertyChanged
Event Value
Implements