ClassObservableCollection<T>
Represents a dynamic data collection that provides notifications when items are added, removed, or when the list is refreshed.
Definition
Namespace:Telerik.WinControls.Data
Assembly:Telerik.WinControls.dll
Type Parameters:
T
The type of elements in the collection.
Syntax:
public class ObservableCollection<T> : Collection<T>, IList, ICollection, IEnumerable, INotifyCollectionChanged, INotifyCollectionChanging, INotifyPropertyChanged, INotifyPropertyChangingEx
Inheritance: objectCollection<T>ObservableCollection<T>
Derived Classes:
Implements:
Inherited Members
Constructors
ObservableCollection()
Initializes a new instance of the ObservableCollection<T> class.
Declaration
public ObservableCollection()
ObservableCollection(IEnumerable<T>)
Initializes a new instance of the ObservableCollection<T> class that contains elements copied from the specified enumerable.
Declaration
public ObservableCollection(IEnumerable<T> list)
Parameters
list
IEnumerable<T>
The enumerable from which the elements are copied.
ObservableCollection(IList<T>)
Initializes a new instance of the ObservableCollection<T> class that contains elements copied from the specified list.
Declaration
public ObservableCollection(IList<T> list)
Parameters
list
IList<T>
The list from which the elements are copied.
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
list
Fields
Properties
Methods
AddRange(IEnumerable<T>)
Declaration
public virtual void AddRange(IEnumerable<T> items)
Parameters
items
IEnumerable<T>
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
sender
e
CallCollectionChanging(object, NotifyCollectionChangingEventArgs)
Declaration
protected void CallCollectionChanging(object sender, NotifyCollectionChangingEventArgs e)
Parameters
sender
e
ClearItems()
Overridden. Removes all items from the collection.
Declaration
protected override void ClearItems()
Overrides
EndItemUpdate()
Declaration
public void EndItemUpdate()
EndItemUpdate(bool)
Resumes event notification.
Declaration
public virtual void EndItemUpdate(bool notifyUpdates)
Parameters
notifyUpdates
EndUpdate()
Declaration
public void EndUpdate()
EndUpdate(bool)
Resumes event notification.
Declaration
public virtual void EndUpdate(bool notifyUpdates)
Parameters
notifyUpdates
InsertItem(int, T)
Overridden. Inserts an item into the collection at the specified index.
Declaration
protected override void InsertItem(int index, T item)
Parameters
index
item
T
Overrides
Move(int, int)
Moves the item at the specified index to a new location in the collection.
MoveItem(int, int)
Moves the item at the specified index to a new location in the collection.
NotifyListenersCollectionChanged(NotifyCollectionChangedEventArgs)
Raises the CollectionChanged event with the provided arguments.
Declaration
protected virtual void NotifyListenersCollectionChanged(NotifyCollectionChangedEventArgs e)
Parameters
e
NotifyListenersCollectionChanging(NotifyCollectionChangingEventArgs)
Raises the CollectionChanging event with the provided arguments.
Declaration
protected virtual void NotifyListenersCollectionChanging(NotifyCollectionChangingEventArgs e)
Parameters
e
OnCollectionChanged(NotifyCollectionChangedAction, object, int)
Declaration
protected void OnCollectionChanged(NotifyCollectionChangedAction action, object item, int index)
Parameters
action
item
index
OnCollectionChanged(NotifyCollectionChangedAction, object, int, int)
Declaration
protected void OnCollectionChanged(NotifyCollectionChangedAction action, object item, int index, int oldIndex)
Parameters
action
item
index
oldIndex
OnCollectionChanged(NotifyCollectionChangedAction, object, object, int)
Declaration
protected void OnCollectionChanged(NotifyCollectionChangedAction action, object oldItem, object newItem, int index)
Parameters
action
oldItem
newItem
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
e
OnCollectionChanging(NotifyCollectionChangedAction, object, int)
Declaration
protected bool OnCollectionChanging(NotifyCollectionChangedAction action, object item, int index)
Parameters
action
item
index
Returns
OnCollectionChanging(NotifyCollectionChangedAction, object, int, int)
Declaration
protected bool OnCollectionChanging(NotifyCollectionChangedAction action, object item, int index, int oldIndex)
Parameters
action
item
index
oldIndex
Returns
OnCollectionChanging(NotifyCollectionChangedAction, object, object, int)
Declaration
protected bool OnCollectionChanging(NotifyCollectionChangedAction action, object oldItem, object newItem, int index)
Parameters
action
oldItem
newItem
index
Returns
OnCollectionChanging(NotifyCollectionChangingEventArgs)
Calls the NotifyListenersCollectionChanging method with the provided arguments if not in a batch update.
Declaration
protected virtual bool OnCollectionChanging(NotifyCollectionChangingEventArgs e)
Parameters
e
Returns
OnCollectionReset(IList)
Declaration
protected void OnCollectionReset(IList oldItems)
Parameters
oldItems
OnNotifyPropertyChanged(PropertyChangedEventArgs)
Raises the NotifyPropertyChanged event
Declaration
protected virtual void OnNotifyPropertyChanged(PropertyChangedEventArgs e)
Parameters
e
A PropertyChangedEventArgs instance containing event data.
OnNotifyPropertyChanged(string)
Raises the PropertyChanged event
Declaration
protected virtual void OnNotifyPropertyChanged(string propertyName)
Parameters
propertyName
The name of the property
OnNotifyPropertyChanging(PropertyChangingEventArgsEx)
Raises the NotifyPropertyChanging event
Declaration
protected virtual void OnNotifyPropertyChanging(PropertyChangingEventArgsEx e)
Parameters
e
A PropertyChangingEventArgs instance containing event data.
OnNotifyPropertyChanging(string)
Raises the PropertyChanging event
Declaration
protected virtual void OnNotifyPropertyChanging(string propertyName)
Parameters
propertyName
The name of the property
RemoveItem(int)
Overridden. Removes the item at the specified index of the collection.
Declaration
protected override void RemoveItem(int index)
Parameters
index
Overrides
RemoveRange(IEnumerable<T>)
Declaration
public virtual void RemoveRange(IEnumerable<T> items)
Parameters
items
IEnumerable<T>
SetItem(int, T)
Overridden. Replaces the element at the specified index.
Declaration
protected override void SetItem(int index, T item)
Parameters
index
item
T
Overrides
Events
CollectionChanged
Occurs when an item is added, removed, changed, moved, or the entire list is refreshed.
Declaration
public event NotifyCollectionChangedEventHandler CollectionChanged
Event Value
Implements
CollectionChanging
Occurs before an item is added, removed, changed, moved, or the entire list is refreshed.
Declaration
public event NotifyCollectionChangingEventHandler CollectionChanging
Event Value
Implements
PropertyChanged
Occurs when a property of an object changes. Calling the event is developer's responsibility.
Declaration
[Browsable(false)]
public event PropertyChangedEventHandler PropertyChanged
Event Value
Implements
PropertyChanging
Occurs before a property of an object changes.
Declaration
public event PropertyChangingEventHandlerEx PropertyChanging
Event Value
Implements