skip navigation
  • 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 Tools
    ThemeBuilder
    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
    • Roadmap
    • 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 ObservableCollection<T>

Represents a dynamic data collection that provides notifications when items get added, removed, or when the whole list is refreshed.

Inheritance
System.Object
System.Collections.ObjectModel.Collection<T>
ObservableCollection<T>
FilterParameterDictionary
FilterPredicateCollection
CellDefinitionsCollection
ColumnCollection
ColumnGroupCollection
ColumnNameCollection
GanttViewTextViewColumnCollection
GridViewColumnCollection
GridViewSummaryRowItem
GridViewSummaryRowItemCollection
GridViewTemplateCollection
GroupsCollection
ItemObservableCollection<T>
LegendItemCollection
ListViewColumnCollection
RadListDataItemSelectedCollection
RowDefinitionsCollection
SchedulerBackgroundCollection
SchedulerObservableCollection
SchedulerReminderCollection
SchedulerResourceCollection
SchedulerStatusCollection
SchedulerTimeZoneCollection
WaitingBarIndicatorCollection
WaitingIndicatorCollection
WizardPageCollection
PropertySerializationMetadataCollection
Inherited Members
System.Collections.ObjectModel.Collection<T>.Add(T)
System.Collections.ObjectModel.Collection<T>.Clear()
System.Collections.ObjectModel.Collection<T>.CopyTo(T[], System.Int32)
System.Collections.ObjectModel.Collection<T>.Contains(T)
System.Collections.ObjectModel.Collection<T>.GetEnumerator()
System.Collections.ObjectModel.Collection<T>.IndexOf(T)
System.Collections.ObjectModel.Collection<T>.Insert(System.Int32, T)
System.Collections.ObjectModel.Collection<T>.Remove(T)
System.Collections.ObjectModel.Collection<T>.RemoveAt(System.Int32)
System.Collections.ObjectModel.Collection<T>.Count
System.Collections.ObjectModel.Collection<T>.Items
System.Collections.ObjectModel.Collection<T>.Item[System.Int32]
System.Collections.ObjectModel.Collection<T>.System.Collections.Generic.ICollection<T>.IsReadOnly
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Telerik.WinControls.Data
Assembly: Telerik.WinControls.dll

Syntax

public class ObservableCollection<T> : Collection<T>, IList<T>, ICollection<T>, IReadOnlyList<T>, IReadOnlyCollection<T>, IEnumerable<T>, IList, ICollection, IEnumerable, INotifyCollectionChanged, INotifyCollectionChanging, INotifyPropertyChanged, INotifyPropertyChangingEx
Type Parameters
T

Constructors

ObservableCollection()

Initializes a new instance of the ObservableCollection class.

Declaration
public ObservableCollection()

ObservableCollection(IEnumerable<T>)

Initializes a new instance of the ObservableCollection class that contains elements copied from the specified list.

Declaration
public ObservableCollection(IEnumerable<T> list)
Parameters
System.Collections.Generic.IEnumerable<T> list

ObservableCollection(IList<T>)

Initializes a new instance of the ObservableCollection class that contains elements copied from the specified list.

Declaration
public ObservableCollection(IList<T> list)
Parameters
System.Collections.Generic.IList<T> list

ObservableCollection(ObservableCollection<T>)

Initializes a new instance of the ObservableCollection class that contains elements copied from the specified list.

Declaration
public ObservableCollection(ObservableCollection<T> list)
Parameters
ObservableCollection<T> list

Fields

CountString

Declaration
protected const string CountString = "Count"
Field Value
System.String

ItemArrayString

Declaration
protected const string ItemArrayString = "Item[]"
Field Value
System.String

Properties

IsUpdated

true to indicate the collection has completed update; otherwise false.

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

Methods

AddRange(IEnumerable<T>)

Declaration
public virtual void AddRange(IEnumerable<T> items)
Parameters
System.Collections.Generic.IEnumerable<T> items

BeginItemUpdate()

Declaration
public virtual void BeginItemUpdate()

BeginUpdate()

Suspends event notification.

Declaration
public virtual void BeginUpdate()

CallCollectionChanged(Object, NotifyCollectionChangedEventArgs)

Declaration
protected void CallCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
Parameters
System.Object sender

NotifyCollectionChangedEventArgs e

CallCollectionChanging(Object, NotifyCollectionChangingEventArgs)

Declaration
protected void CallCollectionChanging(object sender, NotifyCollectionChangingEventArgs e)
Parameters
System.Object sender

NotifyCollectionChangingEventArgs e

ClearItems()

Overridden. Removes all items from the collection.

Declaration
protected override void ClearItems()
Overrides
System.Collections.ObjectModel.Collection<T>.ClearItems()

EndItemUpdate()

Declaration
public void EndItemUpdate()

EndItemUpdate(Boolean)

Resumes event notification.

Declaration
public virtual void EndItemUpdate(bool notifyUpdates)
Parameters
System.Boolean notifyUpdates

EndUpdate()

Declaration
public void EndUpdate()

EndUpdate(Boolean)

Resumes event notification.

Declaration
public virtual void EndUpdate(bool notifyUpdates)
Parameters
System.Boolean notifyUpdates

InsertItem(Int32, T)

Overridden. Inserts an item into the collection at the specified index.

Declaration
protected override void InsertItem(int index, T item)
Parameters
System.Int32 index

T item

Overrides
System.Collections.ObjectModel.Collection<T>.InsertItem(System.Int32, T)

InsertItem(Int32, T, Action<T>)

Declaration
protected virtual void InsertItem(int index, T item, Action<T> approvedAction)
Parameters
System.Int32 index

T item

System.Action<T> approvedAction

Move(Int32, Int32)

Moves the item at the specified index to a new location in the collection.

Declaration
public void Move(int oldIndex, int newIndex)
Parameters
System.Int32 oldIndex

System.Int32 newIndex

MoveItem(Int32, Int32)

Moves the item at the specified index to a new location in the collection.

Declaration
protected virtual void MoveItem(int oldIndex, int newIndex)
Parameters
System.Int32 oldIndex

System.Int32 newIndex

NotifyListenersCollectionChanged(NotifyCollectionChangedEventArgs)

Raises the CollectionChanged event with the provided arguments.

Declaration
protected virtual void NotifyListenersCollectionChanged(NotifyCollectionChangedEventArgs e)
Parameters
NotifyCollectionChangedEventArgs e

NotifyListenersCollectionChanging(NotifyCollectionChangingEventArgs)

Raises the CollectionChanging event with the provided arguments.

Declaration
protected virtual void NotifyListenersCollectionChanging(NotifyCollectionChangingEventArgs e)
Parameters
NotifyCollectionChangingEventArgs e

OnCollectionChanged(NotifyCollectionChangedAction, Object, Int32)

Declaration
protected void OnCollectionChanged(NotifyCollectionChangedAction action, object item, int index)
Parameters
NotifyCollectionChangedAction action

System.Object item

System.Int32 index

OnCollectionChanged(NotifyCollectionChangedAction, Object, Int32, Int32)

Declaration
protected void OnCollectionChanged(NotifyCollectionChangedAction action, object item, int index, int oldIndex)
Parameters
NotifyCollectionChangedAction action

System.Object item

System.Int32 index

System.Int32 oldIndex

OnCollectionChanged(NotifyCollectionChangedAction, Object, Object, Int32)

Declaration
protected void OnCollectionChanged(NotifyCollectionChangedAction action, object oldItem, object newItem, int index)
Parameters
NotifyCollectionChangedAction action

System.Object oldItem

System.Object newItem

System.Int32 index

OnCollectionChanged(NotifyCollectionChangedEventArgs)

Calls the NotifyListenersCollectionChanged method with the provided arguments if not in a batch update.

Declaration
protected virtual void OnCollectionChanged(NotifyCollectionChangedEventArgs e)
Parameters
NotifyCollectionChangedEventArgs e

OnCollectionChanging(NotifyCollectionChangedAction, Object, Int32)

Declaration
protected bool OnCollectionChanging(NotifyCollectionChangedAction action, object item, int index)
Parameters
NotifyCollectionChangedAction action

System.Object item

System.Int32 index

Returns
System.Boolean

OnCollectionChanging(NotifyCollectionChangedAction, Object, Int32, Int32)

Declaration
protected bool OnCollectionChanging(NotifyCollectionChangedAction action, object item, int index, int oldIndex)
Parameters
NotifyCollectionChangedAction action

System.Object item

System.Int32 index

System.Int32 oldIndex

Returns
System.Boolean

OnCollectionChanging(NotifyCollectionChangedAction, Object, Object, Int32)

Declaration
protected bool OnCollectionChanging(NotifyCollectionChangedAction action, object oldItem, object newItem, int index)
Parameters
NotifyCollectionChangedAction action

System.Object oldItem

System.Object newItem

System.Int32 index

Returns
System.Boolean

OnCollectionChanging(NotifyCollectionChangingEventArgs)

Calls the NotifyListenersCollectionChanging method with the provided arguments if not in a batch update.

Declaration
protected virtual bool OnCollectionChanging(NotifyCollectionChangingEventArgs e)
Parameters
NotifyCollectionChangingEventArgs e

Returns
System.Boolean

OnCollectionReset(IList)

Declaration
protected void OnCollectionReset(IList oldItems)
Parameters
System.Collections.IList oldItems

OnCollectionReseting()

Declaration
protected bool OnCollectionReseting()
Returns
System.Boolean

OnNotifyPropertyChanged(PropertyChangedEventArgs)

Raises the NotifyPropertyChanged event

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

A System.ComponentModel.PropertyChangedEventArgs instance containing event data.

OnNotifyPropertyChanged(String)

Raises the PropertyChanged event

Declaration
protected virtual void OnNotifyPropertyChanged(string propertyName)
Parameters
System.String propertyName

The name of the property

OnNotifyPropertyChanging(String)

Raises the PropertyChanging event

Declaration
protected virtual void OnNotifyPropertyChanging(string propertyName)
Parameters
System.String propertyName

The name of the property

OnNotifyPropertyChanging(PropertyChangingEventArgsEx)

Raises the NotifyPropertyChanging event

Declaration
protected virtual void OnNotifyPropertyChanging(PropertyChangingEventArgsEx e)
Parameters
PropertyChangingEventArgsEx e

A System.ComponentModel.PropertyChangingEventArgs instance containing event data.

RemoveItem(Int32)

Overridden. Removes the item at the specified index of the collection.

Declaration
protected override void RemoveItem(int index)
Parameters
System.Int32 index

Overrides
System.Collections.ObjectModel.Collection<T>.RemoveItem(System.Int32)

RemoveRange(IEnumerable<T>)

Declaration
public virtual void RemoveRange(IEnumerable<T> items)
Parameters
System.Collections.Generic.IEnumerable<T> items

SetItem(Int32, T)

Overridden. Replaces the element at the specified index.

Declaration
protected override void SetItem(int index, T item)
Parameters
System.Int32 index

T item

Overrides
System.Collections.ObjectModel.Collection<T>.SetItem(System.Int32, T)

Events

CollectionChanged

Occurs when an item is added, removed, changed, moved, or the entire list is refreshed.

Declaration
public event NotifyCollectionChangedEventHandler CollectionChanged
Event Type
NotifyCollectionChangedEventHandler

Implements
INotifyCollectionChanged.CollectionChanged

CollectionChanging

Occurs before an item is added, removed, changed, moved, or the entire list is refreshed.

Declaration
public event NotifyCollectionChangingEventHandler CollectionChanging
Event Type
NotifyCollectionChangingEventHandler

Implements
INotifyCollectionChanging.CollectionChanging

PropertyChanged

Occurs when a property of an object changes. Calling the event is developer's responsibility.

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

PropertyChanging

Occurs before a property of an object changes.

Declaration
public event PropertyChangingEventHandlerEx PropertyChanging
Event Type
PropertyChangingEventHandlerEx

Implements
INotifyPropertyChangingEx.PropertyChanging

Explicit Interface Implementations

ICollection.CopyTo(Array, Int32)

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

System.Int32 index

Implements
System.Collections.ICollection.CopyTo(System.Array, System.Int32)

ICollection.Count

Declaration
int ICollection.Count { get; }
Returns
System.Int32

Implements
System.Collections.ICollection.Count

ICollection.IsSynchronized

Declaration
bool ICollection.IsSynchronized { get; }
Returns
System.Boolean

Implements
System.Collections.ICollection.IsSynchronized

ICollection.SyncRoot

Declaration
object ICollection.SyncRoot { get; }
Returns
System.Object

Implements
System.Collections.ICollection.SyncRoot

IEnumerable.GetEnumerator()

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

Implements
System.Collections.IEnumerable.GetEnumerator()

IList.Add(Object)

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

Returns
System.Int32

Implements
System.Collections.IList.Add(System.Object)

IList.Clear()

Declaration
void IList.Clear()
Implements
System.Collections.IList.Clear()

IList.Contains(Object)

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

Returns
System.Boolean

Implements
System.Collections.IList.Contains(System.Object)

IList.get_Item(Int32)

Declaration
object IList.get_Item(int index)
Parameters
System.Int32 index

Returns
System.Object

Implements
System.Collections.IList.get_Item(System.Int32)

IList.IndexOf(Object)

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

Returns
System.Int32

Implements
System.Collections.IList.IndexOf(System.Object)

IList.Insert(Int32, Object)

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

System.Object value

Implements
System.Collections.IList.Insert(System.Int32, System.Object)

IList.IsFixedSize

Declaration
bool IList.IsFixedSize { get; }
Returns
System.Boolean

Implements
System.Collections.IList.IsFixedSize

IList.IsReadOnly

Declaration
bool IList.IsReadOnly { get; }
Returns
System.Boolean

Implements
System.Collections.IList.IsReadOnly

IList.Item[Int32]

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

Returns
System.Object

Implements
System.Collections.IList.Item[System.Int32]

IList.Remove(Object)

Declaration
void IList.Remove(object value)
Parameters
System.Object value

Implements
System.Collections.IList.Remove(System.Object)

IList.RemoveAt(Int32)

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

Implements
System.Collections.IList.RemoveAt(System.Int32)

IList.set_Item(Int32, Object)

Declaration
void IList.set_Item(int index, object value)
Parameters
System.Int32 index

System.Object value

Implements
System.Collections.IList.set_Item(System.Int32, System.Object)

Extension Methods

SvgExtentions.Traverse<T>(T, Func<T, IEnumerable<T>>)
SvgExtentions.TraverseDepthFirst<T>(T, Func<T, IEnumerable<T>>)

Was this article helpful?

Tell us how we can improve this article

Skip
Getting Started
  • Install Now
  • Demos
  • Step-by-Step Tutorial
  • Sample Applications
  • SDK Samples
  • Visual Studio Extensions
Support Resources
  • Code Library
  • Knowledge Base
  • Videos
Community
  • Forums
  • Blogs
  • 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.