• Product Bundles

    DevCraft

    All Telerik .NET tools and Kendo UI JavaScript components in one package. Now enhanced with:

    • NEW: Design Kits for Figma
    • Online Training
    • Document Processing Library
    • Embedded Reporting for web and desktop
    Web
    Kendo UI UI for jQuery UI for Angular UI for React UI for Vue UI for ASP.NET AJAX UI for ASP.NET MVC UI for ASP.NET Core UI for Blazor UI for Silverlight UI for PHP UI for JSP
    Mobile
    UI for .NET MAUI UI for Xamarin
    Document Management
    Telerik Document Processing
    Desktop
    UI for .NET MAUI UI for WinUI UI for WinForms UI for WPF UI for UWP
    Reporting & Mocking
    Telerik Reporting Telerik Report Server Telerik JustMock
    Automated Testing
    Test Studio Test Studio Dev Edition
    CMS
    Sitefinity
    UI/UX Design
    Unite UX
    Debugging
    Fiddler Fiddler Everywhere Fiddler Classic Fiddler Jam FiddlerCap FiddlerCore
    Extended Reality
    UI for Unity XR
    Free Tools
    JustAssembly JustDecompile VB.NET to C# Converter Testing Framework
    View all products
  • Overview
  • Demos
    • What's New
    • Release History
  • Docs & Support
  • Pricing
  • Search
  • Shopping cart
    • Account Overview
    • Your Licenses
    • Support Center
    • Forum Profile
    • Payment Methods
    • Edit Profile
    • Log out
  • Login
  • Contact Us
  • Try now

Class DataItemCollection

DataItemCollection.

Inheritance
System.Object
DataItemCollection
Namespace: Telerik.Windows.Data
Assembly: Telerik.Windows.Data.dll

Syntax

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

Properties

CanAddNew

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

Declaration
public bool CanAddNew { get; }
Property Value
System.Boolean

true if SourceCollection is not System.Collections.IList.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
public bool CanAddNewItem { get; }
Property Value
System.Boolean

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

Implements
IEditableCollectionViewAddNewItem.CanAddNewItem

CanCancelEdit

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

Declaration
public bool CanCancelEdit { get; }
Property Value
System.Boolean

true if CurrentEditItem implements System.ComponentModel.IEditableObject; otherwise, false.

CanChangePage

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

Declaration
public bool CanChangePage { get; }
Property Value
System.Boolean

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

CanFilter

Gets a value that indicates whether this view supports filtering via the System.ComponentModel.ICollectionView.Filter property.

Declaration
public bool CanFilter { get; }
Property Value
System.Boolean

CanGroup

Gets a value that indicates whether this view supports grouping via the System.ComponentModel.ICollectionView.GroupDescriptions property.

Declaration
public bool CanGroup { get; }
Property Value
System.Boolean

CanRemove

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

Declaration
public bool CanRemove { get; }
Property Value
System.Boolean

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 System.ComponentModel.ICollectionView.SortDescriptions property.

Declaration
public bool CanSort { get; }
Property Value
System.Boolean

Count

Gets the number of elements contained in the System.Collections.ICollection.

Declaration
public int Count { get; }
Property Value
System.Int32

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
System.Globalization.CultureInfo

The culture to use during sorting.

CurrentAddItem

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

Declaration
public object CurrentAddItem { get; }
Property Value
System.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
public object CurrentEditItem { get; }
Property Value
System.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
public object CurrentItem { get; }
Property Value
System.Object

CurrentPosition

Gets the ordinal position of the System.ComponentModel.ICollectionView.CurrentItem within the view.

Declaration
public int CurrentPosition { get; }
Property Value
System.Int32

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
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
public Predicate<object> Filter { get; set; }
Property Value
System.Predicate<System.Object>

FilterDescriptors

Gets the filter descriptors used for filtering operations.

Declaration
public CompositeFilterDescriptorCollection FilterDescriptors { get; }
Property Value
CompositeFilterDescriptorCollection

The filter descriptors.

Implements
IQueryableCollectionView.FilterDescriptors

GroupDescriptions

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

Declaration
public ObservableCollection<GroupDescription> GroupDescriptions { get; }
Property Value
System.Collections.ObjectModel.ObservableCollection<System.ComponentModel.GroupDescription>

GroupDescriptors

Gets the group descriptors used for grouping operations.

Declaration
public GroupDescriptorCollection GroupDescriptors { get; }
Property Value
GroupDescriptorCollection

The group descriptors.

Implements
IQueryableCollectionView.GroupDescriptors

Groups

Gets the top-level groups.

Declaration
public ReadOnlyObservableCollection<object> Groups { get; }
Property Value
System.Collections.ObjectModel.ReadOnlyObservableCollection<System.Object>

IsAddingNew

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

Declaration
public bool IsAddingNew { get; }
Property Value
System.Boolean

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

IsCurrentAfterLast

Gets a value that indicates whether the System.ComponentModel.ICollectionView.CurrentItem of the view is beyond the end of the collection.

Declaration
public bool IsCurrentAfterLast { get; }
Property Value
System.Boolean

IsCurrentBeforeFirst

Gets a value that indicates whether the System.ComponentModel.ICollectionView.CurrentItem of the view is beyond the beginning of the collection.

Declaration
public bool IsCurrentBeforeFirst { get; }
Property Value
System.Boolean

IsEditingItem

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

Declaration
public bool IsEditingItem { get; }
Property Value
System.Boolean

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
System.Boolean

IsPageChanging

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

Declaration
public bool IsPageChanging { get; }
Property Value
System.Boolean

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

Item[Int32]

Gets or sets the System.Object at the specified index.

Declaration
public object this[int index] { get; set; }
Parameters
System.Int32 index

Property Value
System.Object

ItemCount

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

Declaration
public int ItemCount { get; }
Property Value
System.Int32

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

ItemProperties

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

Declaration
public ReadOnlyCollection<ItemPropertyInfo> ItemProperties { get; }
Property Value
System.Collections.ObjectModel.ReadOnlyCollection<ItemPropertyInfo>

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

Implements
IItemProperties.ItemProperties

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
System.Collections.Generic.Dictionary<System.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
System.Type

The type of the item.

NewItemPlaceholderPosition

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

Declaration
public NewItemPlaceholderPosition NewItemPlaceholderPosition { get; set; }
Property Value
System.ComponentModel.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; }
Property Value
System.Int32

The zero-based index of the current page.

PageSize

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

Declaration
public int PageSize { get; set; }
Property Value
System.Int32

The number of items to display on a page.

SortDescriptions

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

Declaration
public SortDescriptionCollection SortDescriptions { get; }
Property Value
System.ComponentModel.SortDescriptionCollection

SortDescriptors

Gets the sort descriptors used for sorting operations.

Declaration
public SortDescriptorCollection SortDescriptors { get; }
Property Value
SortDescriptorCollection

The sort descriptors.

Implements
IQueryableCollectionView.SortDescriptors

SourceCollection

Returns the underlying collection.

Declaration
public IEnumerable SourceCollection { get; }
Property Value
System.Collections.IEnumerable

TotalItemCount

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

Declaration
public int TotalItemCount { get; }
Property Value
System.Int32

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

Methods

Add(Object)

Adds an item to the System.Collections.IList.

Declaration
public int Add(object value)
Parameters
System.Object value

The System.Object to add to the System.Collections.IList.

Returns
System.Int32

The position into which the new element was inserted.

Exceptions
System.NotSupportedException

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

AddNew()

Adds a new item to the collection.

Declaration
public object AddNew()
Returns
System.Object

The new item that is added to the collection.

Exceptions
System.InvalidOperationException

CanAddNew is false.

AddNewItem(Object)

Adds the specified object to the collection.

Declaration
public virtual object AddNewItem(object newItem)
Parameters
System.Object newItem

The object to add to the collection.

Returns
System.Object

Implements
IEditableCollectionViewAddNewItem.AddNewItem(Object)

CancelEdit()

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

Declaration
public void CancelEdit()
Exceptions
System.InvalidOperationException

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

CancelNew()

Ends the add transaction and discards the pending new item.

Declaration
public void CancelNew()

Clear()

Removes all items from the System.Collections.IList.

Declaration
public void Clear()
Exceptions
System.NotSupportedException

The System.Collections.IList is read-only.

CommitEdit()

Ends the edit transaction and saves the pending changes.

Declaration
public void CommitEdit()

CommitNew()

Ends the add transaction and saves the pending new item.

Declaration
public void CommitNew()

Contains(Object)

Determines whether the System.Collections.IList contains a specific value.

Declaration
public bool Contains(object value)
Parameters
System.Object value

The System.Object to locate in the System.Collections.IList.

Returns
System.Boolean

True if the System.Object is found in the System.Collections.IList; otherwise, false.

CopyTo(Array, Int32)

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

Declaration
public void CopyTo(Array array, int index)
Parameters
System.Array array

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

System.Int32 index

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

Exceptions
System.ArgumentNullException

array is null.

System.ArgumentOutOfRangeException

index is less than zero.

System.ArgumentException

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

System.ArgumentException

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

DeferRefresh()

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

Declaration
public IDisposable DeferRefresh()
Returns
System.IDisposable

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

EditItem(Object)

Begins an edit transaction of the specified item.

Declaration
public void EditItem(object item)
Parameters
System.Object item

The item to edit.

GetEnumerator()

Returns an enumerator that iterates through a collection.

Declaration
public IEnumerator GetEnumerator()
Returns
System.Collections.IEnumerator

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

IndexOf(Object)

Determines the index of a specific item in the System.Collections.IList.

Declaration
public int IndexOf(object value)
Parameters
System.Object value

The System.Object to locate in the System.Collections.IList.

Returns
System.Int32

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

Insert(Int32, Object)

Inserts an item to the System.Collections.IList at the specified index.

Declaration
public void Insert(int index, object value)
Parameters
System.Int32 index

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

System.Object value

The System.Object to insert into the System.Collections.IList.

Exceptions
System.ArgumentOutOfRangeException

index is not a valid index in the System.Collections.IList.

System.NotSupportedException

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

System.NullReferenceException

value is null reference in the System.Collections.IList.

MoveCurrentTo(Object)

Sets the specified item to be the System.ComponentModel.ICollectionView.CurrentItem in the view.

Declaration
public bool MoveCurrentTo(object item)
Parameters
System.Object item

The item to set as the System.ComponentModel.ICollectionView.CurrentItem.

Returns
System.Boolean

True if the resulting System.ComponentModel.ICollectionView.CurrentItem is within the view; otherwise, false.

MoveCurrentToFirst()

Sets the first item in the view as the System.ComponentModel.ICollectionView.CurrentItem.

Declaration
public bool MoveCurrentToFirst()
Returns
System.Boolean

True if the resulting System.ComponentModel.ICollectionView.CurrentItem is an item within the view; otherwise, false.

MoveCurrentToLast()

Sets the last item in the view as the System.ComponentModel.ICollectionView.CurrentItem.

Declaration
public bool MoveCurrentToLast()
Returns
System.Boolean

True if the resulting System.ComponentModel.ICollectionView.CurrentItem is an item within the view; otherwise, false.

MoveCurrentToNext()

Sets the item after the System.ComponentModel.ICollectionView.CurrentItem in the view as the System.ComponentModel.ICollectionView.CurrentItem.

Declaration
public bool MoveCurrentToNext()
Returns
System.Boolean

True if the resulting System.ComponentModel.ICollectionView.CurrentItem is an item within the view; otherwise, false.

MoveCurrentToPosition(Int32)

Sets the item at the specified index to be the System.ComponentModel.ICollectionView.CurrentItem in the view.

Declaration
public bool MoveCurrentToPosition(int position)
Parameters
System.Int32 position

The index to set the System.ComponentModel.ICollectionView.CurrentItem to.

Returns
System.Boolean

True if the resulting System.ComponentModel.ICollectionView.CurrentItem is an item within the view; otherwise, false.

MoveCurrentToPrevious()

Sets the item before the System.ComponentModel.ICollectionView.CurrentItem in the view as the System.ComponentModel.ICollectionView.CurrentItem.

Declaration
public bool MoveCurrentToPrevious()
Returns
System.Boolean

True if the resulting System.ComponentModel.ICollectionView.CurrentItem is an item within the view; otherwise, false.

MoveToFirstPage()

Sets the first page as the current page.

Declaration
public bool MoveToFirstPage()
Returns
System.Boolean

true if the operation was successful; otherwise, false.

MoveToLastPage()

Sets the last page as the current page.

Declaration
public bool MoveToLastPage()
Returns
System.Boolean

true if the operation was successful; otherwise, false.

MoveToNextPage()

Moves to the page after the current page.

Declaration
public bool MoveToNextPage()
Returns
System.Boolean

true if the operation was successful; otherwise, false.

MoveToPage(Int32)

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

Declaration
public bool MoveToPage(int pageIndex)
Parameters
System.Int32 pageIndex

The index of the page to move to.

Returns
System.Boolean

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

MoveToPreviousPage()

Moves to the page before the current page.

Declaration
public bool MoveToPreviousPage()
Returns
System.Boolean

true if the operation was successful; otherwise, false.

OnPropertyChanged(PropertyChangedEventArgs)

Raises the PropertyChanged event.

Declaration
protected virtual void OnPropertyChanged(PropertyChangedEventArgs e)
Parameters
System.ComponentModel.PropertyChangedEventArgs e

The System.ComponentModel.PropertyChangedEventArgs instance containing the event data.

Refresh()

Recreates the view.

Declaration
public void Refresh()

Remove(Object)

Removes the specified item from the collection.

Declaration
public void Remove(object item)
Parameters
System.Object item

The item to remove.

RemoveAt(Int32)

Removes the item at the specified position from the collection.

Declaration
public void RemoveAt(int index)
Parameters
System.Int32 index

The position of the item to remove.

Events

CollectionChanged

Occurs when the collection changes.

Declaration
public event NotifyCollectionChangedEventHandler CollectionChanged
Event Type
System.Collections.Specialized.NotifyCollectionChangedEventHandler

CurrentChanged

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

Declaration
public event EventHandler CurrentChanged
Event Type
System.EventHandler

CurrentChanging

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

Declaration
public event CurrentChangingEventHandler CurrentChanging
Event Type
System.ComponentModel.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 Type
System.EventHandler<NotifyGroupCollectionChangedEventArgs>

PageChanged

Occurs when the PageIndex has changed.

Declaration
public event EventHandler<EventArgs> PageChanged
Event Type
System.EventHandler<System.EventArgs>

PageChanging

Occurs when the PageIndex is changing.

Declaration
public event EventHandler<PageChangingEventArgs> PageChanging
Event Type
System.EventHandler<System.ComponentModel.PageChangingEventArgs>

PropertyChanged

Occurs when a property value changes.

Declaration
public event PropertyChangedEventHandler PropertyChanged
Event Type
System.ComponentModel.PropertyChangedEventHandler

Extension Methods

CollectionExtensions.ToEnumerable<T>(T)
EnumerableExtensions.ToEnumerable<T>(T)

Was this article helpful?

Tell us how we can improve this article

Skip
Getting Started
  • Install Now
  • Demos
  • SDK Samples Browser
  • Sample Applications
  • Themes Generator
Support Resources
  • Code Library
  • Knowledge Base
  • MVVM Support
  • Videos
  • GitHub SDK Repository
  • System Requirements
Community
  • Forums
  • Blogs
  • XAML Feedback Portal
  • Document Processing Feedback Portal

Copyright © 2018 Progress Software Corporation and/or its subsidiaries or affiliates.
All Rights Reserved.

Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks for appropriate markings.