New to Telerik UI for WPFStart a free 30-day trial

DataItemCollection.

Definition

Namespace:Telerik.Windows.Data

Assembly:Telerik.Windows.Data.dll

Syntax:

C#
public class DataItemCollection : IList, ICollection, IEnumerable, IQueryableCollectionView, IItemProperties, IEditableCollectionView, IEditableCollectionViewAddNewItem, ICollectionView, INotifyCollectionChanged, INotifyPropertyChanged, IPagedCollectionView

Inheritance: objectDataItemCollection

Implements: ICollectionICollectionViewIEditableCollectionViewIEditableCollectionViewAddNewItemIEnumerableIItemPropertiesIListINotifyCollectionChangedINotifyPropertyChangedIPagedCollectionViewIQueryableCollectionView...

Properties

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

C#
public bool CanAddNew { get; }
Property Value:

true if SourceCollection is not IsFixedSize and collection element has a default constructor; otherwise, false.

Gets a value that indicates whether a specified object can be added to the collection.

C#
public bool CanAddNewItem { get; }
Property Value:

true if a specified object can be added to the collection; otherwise false.

Gets a value that indicates whether the editing of an item can be canceled.

C#
public bool CanCancelEdit { get; }
Property Value:

true if CurrentEditItem implements IEditableObject; otherwise, false.

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

C#
public bool CanChangePage { get; }
Property Value:

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

Implements: IPagedCollectionView.CanChangePage

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

C#
public bool CanFilter { get; }

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

C#
public bool CanGroup { get; }

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

C#
public bool CanRemove { get; }
Property Value:

true if an item can be removed from the collection; otherwise, false.

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

C#
public bool CanSort { get; }

Gets the number of elements contained in the ICollection.

C#
public int Count { get; }

Implements: ICollection.Count

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

C#
public virtual CultureInfo Culture { get; set; }
Property Value:

The culture to use during sorting.

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

C#
public object CurrentAddItem { get; }
Property Value:

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

Gets the item in the collection that is being edited.

C#
public object CurrentEditItem { get; }
Property Value:

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

Gets the current item in the view.

C#
public object CurrentItem { get; }

Gets the ordinal position of the within the view.

C#
public int CurrentPosition { get; }

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.

C#
public SynchronizationMode DescriptorsSynchronizationMode { get; set; }

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

C#
public Predicate<object> Filter { get; set; }

Gets the filter descriptors used for filtering operations.

C#
public CompositeFilterDescriptorCollection FilterDescriptors { get; }
Property Value:

The filter descriptors.

Implements: IQueryableCollectionView.FilterDescriptors

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

C#
public ObservableCollection<GroupDescription> GroupDescriptions { get; }

Gets the group descriptors used for grouping operations.

C#
public GroupDescriptorCollection GroupDescriptors { get; }
Property Value:

The group descriptors.

Implements: IQueryableCollectionView.GroupDescriptors

Gets the top-level groups.

C#
public ReadOnlyObservableCollection<object> Groups { get; }

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

C#
public bool IsAddingNew { get; }
Property Value:

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

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

C#
public bool IsCurrentAfterLast { get; }

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

C#
public bool IsCurrentBeforeFirst { get; }

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

C#
public bool IsEditingItem { get; }
Property Value:

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

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

C#
public bool IsEmpty { get; }

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

C#
public bool IsPageChanging { get; }
Property Value:

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

Implements: IPagedCollectionView.IsPageChanging

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

C#
public int ItemCount { get; }
Property Value:

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

Implements: IPagedCollectionView.ItemCount

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

C#
public ReadOnlyCollection<ItemPropertyInfo> ItemProperties { get; }
Property Value:

A collection of objects that describes the properties of the items in the collection.

Gets a dictionary of objects that describes the properties of the items in the collection by property name.

C#
public Dictionary<string, ItemPropertyInfo> ItemPropertiesByPropertyName { get; }
Property Value:

A dictionary of objects that describes the properties of the items in the collection by property name.

Gets or sets the type used for all internal data engine operations.

C#
public Type ItemType { get; set; }
Property Value:

The type of the item.

NewItemPlaceholderPosition

NewItemPlaceholderPosition

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

C#
public NewItemPlaceholderPosition NewItemPlaceholderPosition { get; set; }
Property Value:

One of the enumeration values that specifies the position of the new item placeholder in the collection.

Gets the zero-based index of the current page.

C#
public int PageIndex { get; }
Property Value:

The zero-based index of the current page.

Implements: IPagedCollectionView.PageIndex

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

C#
public int PageSize { get; set; }
Property Value:

The number of items to display on a page.

Implements: IPagedCollectionView.PageSize

SortDescriptions

SortDescriptionCollection

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

C#
public SortDescriptionCollection SortDescriptions { get; }

Gets the sort descriptors used for sorting operations.

C#
public SortDescriptorCollection SortDescriptors { get; }
Property Value:

The sort descriptors.

Implements: IQueryableCollectionView.SortDescriptors

Returns the underlying collection.

C#
public IEnumerable SourceCollection { get; }

Gets or sets the object at the specified index.

C#
public object this[int index] { get; set; }
Parameters:indexint

Implements: IList.this[int]

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

C#
public int TotalItemCount { get; }
Property Value:

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

Implements: IPagedCollectionView.TotalItemCount

Methods

Adds an item to the IList.

C#
public int Add(object value)
Parameters:valueobject

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)

Adds a new item to the collection.

C#
public object AddNew()
Returns:

object

The new item that is added to the collection.

Exceptions:

InvalidOperationException

CanAddNew is false.

Adds the specified object to the collection.

C#
public virtual object AddNewItem(object newItem)
Parameters:newItemobject

The object to add to the collection.

Returns:

object

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

C#
public void CancelEdit()
Exceptions:

InvalidOperationException

CancelEdit is not supported for the current edit item. Only items implementing IEditableObject are supported.

Ends the add transaction and discards the pending new item.

C#
public void CancelNew()

Removes all items from the IList.

C#
public void Clear()
Exceptions:

NotSupportedException

The IList is read-only.

Implements: IList.Clear()

Ends the edit transaction and saves the pending changes.

C#
public void CommitEdit()

Ends the add transaction and saves the pending new item.

C#
public void CommitNew()

Determines whether the IList contains a specific value.

C#
public bool Contains(object value)
Parameters:valueobject

The object to locate in the IList.

Returns:

bool

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

Implements: IList.Contains(object)

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

C#
public void CopyTo(Array array, int index)
Parameters:arrayArray

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

indexint

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

Exceptions:

ArgumentNullException

array is null.

ArgumentOutOfRangeException

index is less than zero.

ArgumentException

array 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)

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

C#
public IDisposable DeferRefresh()
Returns:

IDisposable

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

Begins an edit transaction of the specified item.

C#
public void EditItem(object item)
Parameters:itemobject

The item to edit.

Returns an enumerator that iterates through a collection.

C#
public IEnumerator GetEnumerator()
Returns:

IEnumerator

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

Implements: IEnumerable.GetEnumerator()

Determines the index of a specific item in the IList.

C#
public int IndexOf(object value)
Parameters:valueobject

The object to locate in the IList.

Returns:

int

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

Implements: IList.IndexOf(object)

Inserts an item to the IList at the specified index.

C#
public void Insert(int index, object value)
Parameters:indexint

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

valueobject

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)

Sets the specified item to be the in the view.

C#
public bool MoveCurrentTo(object item)
Parameters:itemobject

The item to set as the .

Returns:

bool

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

Sets the first item in the view as the .

C#
public bool MoveCurrentToFirst()
Returns:

bool

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

Sets the last item in the view as the .

C#
public bool MoveCurrentToLast()
Returns:

bool

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

Sets the item after the in the view as the .

C#
public bool MoveCurrentToNext()
Returns:

bool

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

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

C#
public bool MoveCurrentToPosition(int position)
Parameters:positionint

The index to set the to.

Returns:

bool

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

Sets the item before the in the view as the .

C#
public bool MoveCurrentToPrevious()
Returns:

bool

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

Sets the first page as the current page.

C#
public bool MoveToFirstPage()
Returns:

bool

true if the operation was successful; otherwise, false.

Implements: IPagedCollectionView.MoveToFirstPage()

Sets the last page as the current page.

C#
public bool MoveToLastPage()
Returns:

bool

true if the operation was successful; otherwise, false.

Implements: IPagedCollectionView.MoveToLastPage()

Moves to the page after the current page.

C#
public bool MoveToNextPage()
Returns:

bool

true if the operation was successful; otherwise, false.

Implements: IPagedCollectionView.MoveToNextPage()

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

C#
public bool MoveToPage(int pageIndex)
Parameters:pageIndexint

The index of the page to move to.

Returns:

bool

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

Implements: IPagedCollectionView.MoveToPage(int)

Moves to the page before the current page.

C#
public bool MoveToPreviousPage()
Returns:

bool

true if the operation was successful; otherwise, false.

Implements: IPagedCollectionView.MoveToPreviousPage()

Raises the event.

C#
protected virtual void OnPropertyChanged(PropertyChangedEventArgs e)
Parameters:ePropertyChangedEventArgs

The PropertyChangedEventArgs instance containing the event data.

Recreates the view.

C#
public void Refresh()

Removes the specified item from the collection.

C#
public void Remove(object item)
Parameters:itemobject

The item to remove.

Implements: IList.Remove(object)

Removes the item at the specified position from the collection.

C#
public void RemoveAt(int index)
Parameters:indexint

The position of the item to remove.

Implements: IList.RemoveAt(int)

Events

Occurs when the collection changes.

C#
public event NotifyCollectionChangedEventHandler CollectionChanged

Implements: INotifyCollectionChanged.CollectionChanged

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

C#
public event EventHandler CurrentChanged

CurrentChanging

CurrentChangingEventHandler

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

C#
public event CurrentChangingEventHandler CurrentChanging

This is for internal use only and is not intended to be used directly from your code.

C#
public event EventHandler<NotifyGroupCollectionChangedEventArgs> GroupCollectionChanged

Occurs when the PageIndex has changed.

C#
public event EventHandler<EventArgs> PageChanged

Implements: IPagedCollectionView.PageChanged

Occurs when the PageIndex is changing.

C#
public event EventHandler<PageChangingEventArgs> PageChanging

Implements: IPagedCollectionView.PageChanging

Occurs when a property value changes.

C#
public event PropertyChangedEventHandler PropertyChanged

Implements: INotifyPropertyChanged.PropertyChanged