Class
DataItemCollection

DataItemCollection.

Definition

Namespace:Telerik.Windows.Data

Assembly:Telerik.Windows.Data.dll

Syntax:

cs-api-definition
public class DataItemCollection : IList, ICollection, IEnumerable, IQueryableCollectionView, IItemProperties, IEditableCollectionView, IEditableCollectionViewAddNewItem, ICollectionView, INotifyCollectionChanged, INotifyPropertyChanged, IPagedCollectionView

Inheritance: objectDataItemCollection

Implements: ICollectionICollectionViewIEditableCollectionViewIEditableCollectionViewAddNewItemIEnumerableIItemPropertiesIListINotifyCollectionChangedINotifyPropertyChangedIPagedCollectionViewIQueryableCollectionView

Properties

CanAddNew

Gets a value that indicates whether a new item can be added to the collection.

Declaration

cs-api-definition
public bool CanAddNew { get; }

Property Value

bool

true if SourceCollection is not IsFixedSize 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

cs-api-definition
public bool CanAddNewItem { get; }

Property Value

bool

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

cs-api-definition
public bool CanCancelEdit { get; }

Property Value

bool

true if CurrentEditItem implements IEditableObject; otherwise, false.

CanChangePage

Gets a value that indicates whether the PageIndex value can change.

Declaration

cs-api-definition
public bool CanChangePage { get; }

Property Value

bool

true if the PageIndex value can change; otherwise, false.

Implements IPagedCollectionView.CanChangePage

CanFilter

Gets a value that indicates whether this view supports filtering via the property.

Declaration

cs-api-definition
public bool CanFilter { get; }

Property Value

bool

CanGroup

Gets a value that indicates whether this view supports grouping via the property.

Declaration

cs-api-definition
public bool CanGroup { get; }

Property Value

bool

CanRemove

Gets a value that indicates whether an item can be removed from the collection.

Declaration

cs-api-definition
public bool CanRemove { get; }

Property Value

bool

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 property.

Declaration

cs-api-definition
public bool CanSort { get; }

Property Value

bool

Count

Gets the number of elements contained in the ICollection.

Declaration

cs-api-definition
public int Count { get; }

Property Value

int

Implements ICollection.Count

Culture

Gets or sets the cultural info for any operations of the view that may differ by culture, such as sorting.

Declaration

cs-api-definition
public virtual CultureInfo Culture { get; set; }

Property Value

CultureInfo

The culture to use during sorting.

CurrentAddItem

Gets the item that is being added during the current add transaction.

Declaration

cs-api-definition
public object CurrentAddItem { get; }

Property Value

object

The item that is being added if IsAddingNew is true; otherwise, null.

CurrentEditItem

Gets the item in the collection that is being edited.

Declaration

cs-api-definition
public object CurrentEditItem { get; }

Property Value

object

The item in the collection that is being edited if IsEditingItem is true; otherwise, null.

CurrentItem

Gets the current item in the view.

Declaration

cs-api-definition
public object CurrentItem { get; }

Property Value

object

CurrentPosition

Gets the ordinal position of the within the view.

Declaration

cs-api-definition
public int CurrentPosition { get; }

Property Value

int

DescriptorsSynchronizationMode

Gets or sets a value that controls how this DataItemCollection synchronizes its FilterDescriptors, GroupDescriptor and SortDescriptors, as well as GroupDescription and SortDescriptions (if applicable), with its source.

Declaration

cs-api-definition
public SynchronizationMode DescriptorsSynchronizationMode { get; set; }

Property Value

SynchronizationMode

Filter

Gets or sets a callback used to determine if an item is suitable for inclusion in the view.

Declaration

cs-api-definition
public Predicate<object> Filter { get; set; }

Property Value

Predicate<object>

FilterDescriptors

Gets the filter descriptors used for filtering operations.

Declaration

cs-api-definition
public CompositeFilterDescriptorCollection FilterDescriptors { get; }

Property Value

CompositeFilterDescriptorCollection

The filter descriptors.

Implements IQueryableCollectionView.FilterDescriptors

GroupDescriptions

Gets a collection of objects that describe how the items in the collection are grouped in the view.

Declaration

cs-api-definition
public ObservableCollection<GroupDescription> GroupDescriptions { get; }

Property Value

ObservableCollection<GroupDescription>

GroupDescriptors

Gets the group descriptors used for grouping operations.

Declaration

cs-api-definition
public GroupDescriptorCollection GroupDescriptors { get; }

Property Value

GroupDescriptorCollection

The group descriptors.

Implements IQueryableCollectionView.GroupDescriptors

Groups

Gets the top-level groups.

Declaration

cs-api-definition
public ReadOnlyObservableCollection<object> Groups { get; }

Property Value

ReadOnlyObservableCollection<object>

IsAddingNew

Gets a value that indicates whether an add transaction is in progress.

Declaration

cs-api-definition
public bool IsAddingNew { get; }

Property Value

bool

true if an add transaction is in progress; otherwise, false.

IsCurrentAfterLast

Gets a value that indicates whether the of the view is beyond the end of the collection.

Declaration

cs-api-definition
public bool IsCurrentAfterLast { get; }

Property Value

bool

IsCurrentBeforeFirst

Gets a value that indicates whether the of the view is beyond the beginning of the collection.

Declaration

cs-api-definition
public bool IsCurrentBeforeFirst { get; }

Property Value

bool

IsEditingItem

Gets a value that indicates whether an edit transaction is in progress.

Declaration

cs-api-definition
public bool IsEditingItem { get; }

Property Value

bool

true if an edit transaction is in progress; otherwise, false.

IsEmpty

Returns a value that indicates whether the resulting view is empty.

Declaration

cs-api-definition
public bool IsEmpty { get; }

Property Value

bool

IsPageChanging

Gets a value that indicates whether a page index change is in process.

Declaration

cs-api-definition
public bool IsPageChanging { get; }

Property Value

bool

true if the page index is changing; otherwise, false.

Implements IPagedCollectionView.IsPageChanging

ItemCount

Gets the minimum number of items known to be in the source collection.

Declaration

cs-api-definition
public int ItemCount { get; }

Property Value

int

The minimum number of items known to be in the source collection.

Implements IPagedCollectionView.ItemCount

ItemProperties

Gets a collection of objects that describes the properties of the items in the collection.

Declaration

cs-api-definition
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

cs-api-definition
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

cs-api-definition
public Type ItemType { get; set; }

Property Value

Type

The type of the item.

NewItemPlaceholderPosition

Gets or sets the position of the new item placeholder in the collection.

Declaration

cs-api-definition
public 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

cs-api-definition
public int PageIndex { get; }

Property Value

int

The zero-based index of the current page.

Implements IPagedCollectionView.PageIndex

PageSize

Gets or sets the number of items to display on a page.

Declaration

cs-api-definition
public int PageSize { get; set; }

Property Value

int

The number of items to display on a page.

Implements IPagedCollectionView.PageSize

SortDescriptions

Gets a collection of objects that describe how the items in the collection are sorted in the view.

Declaration

cs-api-definition
public SortDescriptionCollection SortDescriptions { get; }

Property Value

SortDescriptionCollection

SortDescriptors

Gets the sort descriptors used for sorting operations.

Declaration

cs-api-definition
public SortDescriptorCollection SortDescriptors { get; }

Property Value

SortDescriptorCollection

The sort descriptors.

Implements IQueryableCollectionView.SortDescriptors

SourceCollection

Returns the underlying collection.

Declaration

cs-api-definition
public IEnumerable SourceCollection { get; }

Property Value

IEnumerable

TotalItemCount

Gets the total number of items in the source collection, or -1 if the total number is unknown.

Declaration

cs-api-definition
public int TotalItemCount { get; }

Property Value

int

The total number of items in the source collection, or -1 if the total number is unknown.

Implements IPagedCollectionView.TotalItemCount

this[int]

Gets or sets the object at the specified index.

Declaration

cs-api-definition
public object this[int index] { get; set; }

Parameters

index

int

Property Value

object

Implements IList.this[int]

Methods

Add(object)

Adds an item to the IList.

Declaration

cs-api-definition
public int Add(object value)

Parameters

value

object

The object to add to the IList.

Returns

int

The position into which the new element was inserted.

Exceptions

NotSupportedException

The IList is read-only. -or- The IList has a fixed size.

Implements IList.Add(object)

AddNew()

Adds a new item to the collection.

Declaration

cs-api-definition
public object AddNew()

Returns

object

The new item that is added to the collection.

Exceptions

InvalidOperationException

CanAddNew is false.

AddNewItem(object)

Adds the specified object to the collection.

Declaration

cs-api-definition
public virtual object AddNewItem(object newItem)

Parameters

newItem

object

The object to add to the collection.

Returns

object

CancelEdit()

Ends the edit transaction and discards any pending changes to the item.

Declaration

cs-api-definition
public void CancelEdit()

Exceptions

InvalidOperationException

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

cs-api-definition
public void CancelNew()

Clear()

Removes all items from the IList.

Declaration

cs-api-definition
public void Clear()

Exceptions

NotSupportedException

The IList is read-only.

Implements IList.Clear()

CommitEdit()

Ends the edit transaction and saves the pending changes.

Declaration

cs-api-definition
public void CommitEdit()

CommitNew()

Ends the add transaction and saves the pending new item.

Declaration

cs-api-definition
public void CommitNew()

Contains(object)

Determines whether the IList contains a specific value.

Declaration

cs-api-definition
public bool Contains(object value)

Parameters

value

object

The object to locate in the IList.

Returns

bool

True if the object is found in the IList; otherwise, false.

Implements IList.Contains(object)

CopyTo(Array, int)

Copies the elements of the ICollection to an Array, starting at a particular Array index.

Declaration

cs-api-definition
public void CopyTo(Array array, int index)

Parameters

array

Array

The one-dimensional Array that is the destination of the elements copied from ICollection. The Array must have zero-based indexing.

index

int

The zero-based index in array at which copying begins.

Exceptions

ArgumentNullException

array is null.

ArgumentOutOfRangeException

index is less than zero.

ArgumentException

<code class="paramref">array</code> is multidimensional.

-or- index is equal to or greater than the length of array. -or- The number of elements in the source ICollection is greater than the available space from index to the end of the destination array.

ArgumentException

The type of the source ICollection cannot be cast automatically to the type of the destination array.

Implements ICollection.CopyTo(Array, int)

DeferRefresh()

Enters a defer cycle that you can use to merge changes to the view and delay automatic refresh.

Declaration

cs-api-definition
public IDisposable DeferRefresh()

Returns

IDisposable

An IDisposable object that you can use to dispose of the calling object.

EditItem(object)

Begins an edit transaction of the specified item.

Declaration

cs-api-definition
public void EditItem(object item)

Parameters

item

object

The item to edit.

GetEnumerator()

Returns an enumerator that iterates through a collection.

Declaration

cs-api-definition
public IEnumerator GetEnumerator()

Returns

IEnumerator

An IEnumerator object that can be used to iterate through the collection.

Implements IEnumerable.GetEnumerator()

IndexOf(object)

Determines the index of a specific item in the IList.

Declaration

cs-api-definition
public int IndexOf(object value)

Parameters

value

object

The object to locate in the IList.

Returns

int

The index of value if found in the list; otherwise, -1.

Implements IList.IndexOf(object)

Insert(int, object)

Inserts an item to the IList at the specified index.

Declaration

cs-api-definition
public void Insert(int index, object value)

Parameters

index

int

The zero-based index at which value should be inserted.

value

object

The object to insert into the IList.

Exceptions

ArgumentOutOfRangeException

index is not a valid index in the IList.

NotSupportedException

The IList is read-only. -or- The IList has a fixed size.

NullReferenceException

value is null reference in the IList.

Implements IList.Insert(int, object)

MoveCurrentTo(object)

Sets the specified item to be the in the view.

Declaration

cs-api-definition
public bool MoveCurrentTo(object item)

Parameters

item

object

The item to set as the .

Returns

bool

True if the resulting is within the view; otherwise, false.

MoveCurrentToFirst()

Sets the first item in the view as the .

Declaration

cs-api-definition
public bool MoveCurrentToFirst()

Returns

bool

True if the resulting is an item within the view; otherwise, false.

MoveCurrentToLast()

Sets the last item in the view as the .

Declaration

cs-api-definition
public bool MoveCurrentToLast()

Returns

bool

True if the resulting is an item within the view; otherwise, false.

MoveCurrentToNext()

Sets the item after the in the view as the .

Declaration

cs-api-definition
public bool MoveCurrentToNext()

Returns

bool

True if the resulting is an item within the view; otherwise, false.

MoveCurrentToPosition(int)

Sets the item at the specified index to be the in the view.

Declaration

cs-api-definition
public bool MoveCurrentToPosition(int position)

Parameters

position

int

The index to set the to.

Returns

bool

True if the resulting is an item within the view; otherwise, false.

MoveCurrentToPrevious()

Sets the item before the in the view as the .

Declaration

cs-api-definition
public bool MoveCurrentToPrevious()

Returns

bool

True if the resulting is an item within the view; otherwise, false.

MoveToFirstPage()

Sets the first page as the current page.

Declaration

cs-api-definition
public bool MoveToFirstPage()

Returns

bool

true if the operation was successful; otherwise, false.

Implements IPagedCollectionView.MoveToFirstPage()

MoveToLastPage()

Sets the last page as the current page.

Declaration

cs-api-definition
public bool MoveToLastPage()

Returns

bool

true if the operation was successful; otherwise, false.

Implements IPagedCollectionView.MoveToLastPage()

MoveToNextPage()

Moves to the page after the current page.

Declaration

cs-api-definition
public bool MoveToNextPage()

Returns

bool

true if the operation was successful; otherwise, false.

Implements IPagedCollectionView.MoveToNextPage()

MoveToPage(int)

Requests a page move to the page at the specified index.

Declaration

cs-api-definition
public bool MoveToPage(int pageIndex)

Parameters

pageIndex

int

The index of the page to move to.

Returns

bool

true if the move was successfully initiated; otherwise, false.

Implements IPagedCollectionView.MoveToPage(int)

MoveToPreviousPage()

Moves to the page before the current page.

Declaration

cs-api-definition
public bool MoveToPreviousPage()

Returns

bool

true if the operation was successful; otherwise, false.

Implements IPagedCollectionView.MoveToPreviousPage()

OnPropertyChanged(PropertyChangedEventArgs)

Raises the event.

Declaration

cs-api-definition
protected virtual void OnPropertyChanged(PropertyChangedEventArgs e)

Parameters

e

PropertyChangedEventArgs

The PropertyChangedEventArgs instance containing the event data.

Refresh()

Recreates the view.

Declaration

cs-api-definition
public void Refresh()

Remove(object)

Removes the specified item from the collection.

Declaration

cs-api-definition
public void Remove(object item)

Parameters

item

object

The item to remove.

Implements IList.Remove(object)

RemoveAt(int)

Removes the item at the specified position from the collection.

Declaration

cs-api-definition
public void RemoveAt(int index)

Parameters

index

int

The position of the item to remove.

Implements IList.RemoveAt(int)

Events

CollectionChanged

Occurs when the collection changes.

Declaration

cs-api-definition
public event NotifyCollectionChangedEventHandler CollectionChanged

Event Value

NotifyCollectionChangedEventHandler

Implements INotifyCollectionChanged.CollectionChanged

CurrentChanged

When implementing this interface, raise this event after the current item has been changed.

Declaration

cs-api-definition
public event EventHandler CurrentChanged

Event Value

EventHandler

CurrentChanging

When implementing this interface, raise this event before changing the current item. Event handler can cancel this event.

Declaration

cs-api-definition
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

cs-api-definition
public event EventHandler<NotifyGroupCollectionChangedEventArgs> GroupCollectionChanged

Event Value

EventHandler<NotifyGroupCollectionChangedEventArgs>

PageChanged

Occurs when the PageIndex has changed.

Declaration

cs-api-definition
public event EventHandler<EventArgs> PageChanged

Event Value

EventHandler<EventArgs>

Implements IPagedCollectionView.PageChanged

PageChanging

Occurs when the PageIndex is changing.

Declaration

cs-api-definition
public event EventHandler<PageChangingEventArgs> PageChanging

Event Value

EventHandler<PageChangingEventArgs>

Implements IPagedCollectionView.PageChanging

PropertyChanged

Occurs when a property value changes.

Declaration

cs-api-definition
public event PropertyChangedEventHandler PropertyChanged

Event Value

PropertyChangedEventHandler

Implements INotifyPropertyChanged.PropertyChanged