Class
RadObservableCollection<T>

Represents an ObservableCollection<T> that has ability to suspend change notification events.

Definition

Namespace:Telerik.Windows.Data

Assembly:Telerik.Windows.Data.dll

Type Parameters:

T

The type of the items in the collection.

Syntax:

cs-api-definition
public class RadObservableCollection<T> : ObservableCollection<T>, IList<T>, ICollection<T>, IList, ICollection, IReadOnlyList<T>, IReadOnlyCollection<T>, IEnumerable<T>, IEnumerable, INotifyCollectionChanged, INotifyPropertyChanged, ISuspendNotifications

Inheritance: objectCollection<T>ObservableCollection<T>RadObservableCollection<T>

Derived Classes: IndicatorValueMappingCollectionAggregateResultCollectionObservableItemCollection<T>TableDefinitionCollection

Implements: ICollectionICollection<T>IEnumerableIEnumerable<T>IListIList<T>INotifyCollectionChangedINotifyPropertyChangedIReadOnlyCollection<T>IReadOnlyList<T>ISuspendNotifications

Inherited Members ObservableCollection<T>.Move(int, int)ObservableCollection<T>.SetItem(int, T)ObservableCollection<T>.MoveItem(int, int)ObservableCollection<T>.BlockReentrancy()ObservableCollection<T>.CheckReentrancy()ObservableCollection<T>.CollectionChangedCollection<T>.Add(T)Collection<T>.Clear()Collection<T>.CopyTo(T[], int)Collection<T>.Contains(T)Collection<T>.GetEnumerator()Collection<T>.IndexOf(T)Collection<T>.Insert(int, T)Collection<T>.Remove(T)Collection<T>.RemoveAt(int)Collection<T>.CountCollection<T>.ItemsCollection<T>.this[int]

Constructors

RadObservableCollection()

Initializes a new instance of the RadObservableCollection<T> class.

Declaration

cs-api-definition
public RadObservableCollection()

RadObservableCollection(IEnumerable<T>)

Initializes a new instance of the RadObservableCollection<T> class.

Declaration

cs-api-definition
public RadObservableCollection(IEnumerable<T> collection)

Parameters

collection

IEnumerable<T>

The collection from which the elements are copied.

Exceptions

ArgumentNullException

The collection parameter cannot be null.

Properties

AddedItems

Gets the added items between suspend and resume.

Declaration

cs-api-definition
protected virtual IList<T> AddedItems { get; }

Property Value

IList<T>

The added items.

IsDirty

Gets or sets a value indicating whether change to the collection is made when its notifications are suspended.

Declaration

cs-api-definition
protected bool IsDirty { get; set; }

Property Value

bool

true if this instance is has been changed while notifications are suspended; otherwise, false.

NotificationsSuspended

Gets a value indicating whether change notifications are suspended.

Declaration

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

Property Value

bool

True if notifications are suspended, otherwise, false.

Implements ISuspendNotifications.NotificationsSuspended

RemovedItems

Gets the removed items between suspend and resume.

Declaration

cs-api-definition
protected virtual IList<T> RemovedItems { get; }

Property Value

IList<T>

The removed items.

ShouldResetOnResumeNotifications

Get a value that indicates whether RadObservableCollection would raise CollectionChanged event with Reset action, when a bulk add/remove operation takes place.

Declaration

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

Property Value

bool

Methods

AddRange(IEnumerable<T>)

Adds the elements of the specified collection to the end of the ObservableCollection<T>.

Declaration

cs-api-definition
public virtual void AddRange(IEnumerable<T> items)

Parameters

items

IEnumerable<T>

The items that will be added.

Exceptions

ArgumentNullException

items is null.

ClearItems()

Declaration

cs-api-definition
protected override void ClearItems()

Overrides ObservableCollection<T>.ClearItems()

InsertItem(int, T)

Declaration

cs-api-definition
protected override void InsertItem(int index, T item)

Parameters

index

int

item

T

Overrides ObservableCollection<T>.InsertItem(int, T)

InsertRange(IEnumerable<T>, int)

Inserts the elements of the specified collection at the specified index.

Declaration

cs-api-definition
public virtual void InsertRange(IEnumerable<T> items, int index)

Parameters

items

IEnumerable<T>

The items that will be added.

index

int

The start index.

Exceptions

ArgumentNullException

items is null.

OnCollectionChanged(NotifyCollectionChangedEventArgs)

Declaration

cs-api-definition
protected override void OnCollectionChanged(NotifyCollectionChangedEventArgs e)

Parameters

e

NotifyCollectionChangedEventArgs

Overrides ObservableCollection<T>.OnCollectionChanged(NotifyCollectionChangedEventArgs)

Remarks

Raises the CollectionChanged event when notifications are not suspended.

OnCollectionChanging(CollectionChangingEventArgs)

Raises the event.

Declaration

cs-api-definition
protected virtual void OnCollectionChanging(CollectionChangingEventArgs e)

Parameters

e

CollectionChangingEventArgs

The CollectionChangingEventArgs instance containing the event data.

OnPropertyChanged(PropertyChangedEventArgs)

Declaration

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

Parameters

e

PropertyChangedEventArgs

Overrides ObservableCollection<T>.OnPropertyChanged(PropertyChangedEventArgs)

Remarks

Raises the PropertyChanged event when notifications are not suspended.

RaiseCollectionChangedOnResume()

Raises the CollectionChanged in accordance to the value of ShouldResetOnResumeNotifications and the presence of modified items.

Declaration

cs-api-definition
[SuppressMessage("Microsoft.Design", "CA1030:UseEventsWhereAppropriate")]
protected virtual void RaiseCollectionChangedOnResume()

RemoveItem(int)

Declaration

cs-api-definition
protected override void RemoveItem(int index)

Parameters

index

int

Overrides ObservableCollection<T>.RemoveItem(int)

RemoveRange(IEnumerable<T>)

Removes the elements from the specified collection.

Declaration

cs-api-definition
public virtual void RemoveRange(IEnumerable<T> items)

Parameters

items

IEnumerable<T>

The items that will be removed.

Exceptions

ArgumentNullException

items is null.

Reset()

Raises CollectionChanged with Reset changed action.

Declaration

cs-api-definition
public void Reset()

ResumeNotifications()

Resumes the notifications.

Declaration

cs-api-definition
public virtual void ResumeNotifications()

Implements ISuspendNotifications.ResumeNotifications()

SuspendNotifications()

Suspends the notifications.

Declaration

cs-api-definition
public virtual void SuspendNotifications()

Implements ISuspendNotifications.SuspendNotifications()

Events

CollectionChanging

Occurs when collection is changing.

Declaration

cs-api-definition
public event EventHandler<CollectionChangingEventArgs> CollectionChanging

Event Value

EventHandler<CollectionChangingEventArgs>

PropertyChanged

Occurs when a property value changes.

Declaration

cs-api-definition
public event PropertyChangedEventHandler PropertyChanged

Event Value

PropertyChangedEventHandler