In This Article

DeferrableObservableCollection<T> Class

Provides an ObservableCollection<T> that is capable of suspending its property change notifications until a bulk update is complete.

public class DeferrableObservableCollection<T> : ObservableCollection<T>
Type Parameters:
T -

The type of items.

Inheritance:
object Collection<T> ObservableCollection<T> object
Derived:
DeferrableObservableItemCollection<T> DockingWindowCollectionBase<T> XmlAutoHideTabStripCollection XmlDockingObjectCollection XmlDocumentWindowCollection XmlRaftingHostCollection XmlToolWindowCollection XmlToolWindowContainerCollection ToolWindowContainerCollection MicroQualitativeRangeCollection MicroXYRangeCollection MicroXYSeriesCollection XmlNavigationPaneCollection GroupVariantCollection RibbonControlCollection<T> DocumentReferenceCollection LogicalChildrenCollection<T> TintGroupCollection

Constructors

DeferrableObservableCollection()

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

public DeferrableObservableCollection()

DeferrableObservableCollection(IComparer<T>)

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

public DeferrableObservableCollection(IComparer<T> sortComparer)
Parameter Type Description
sortComparer IComparer<T>

A comparer used to sort items; otherwise null.

DeferrableObservableCollection(IComparer<T>, bool)

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

public DeferrableObservableCollection(IComparer<T> sortComparer, bool useStableSort)
Parameter Type Description
sortComparer IComparer<T>

A comparer used to sort items; otherwise null.

useStableSort bool

if set to true then equivalent items will be maintained in the order they are added.

Properties

IsDirty

Gets whether there are any suspended property changes.

public bool IsDirty { get; }

Property Value

bool:

true if there are any suspended property changes; otherwise, false.

IsPropertyChangeSuspended

Gets whether property change notifications are currently suspended.

public bool IsPropertyChangeSuspended { get; }

Property Value

bool:

true if property change notifications are currently suspended; otherwise, false.

Methods

AddRange(IEnumerable<T>)

Adds multiple items to the collection.

public void AddRange(IEnumerable<T> items)
Parameter Type Description
items IEnumerable<T>

The collection of items to add.

BeginUpdate()

Flags that a bulk update is about to begin.

public void BeginUpdate()

EndUpdate()

Flags that a bulk update has ended.

public void EndUpdate()

InsertItem(int, T)

Inserts an item into the collection at the specified index.

protected override void InsertItem(int index, T item)
Parameter Type Description
index int

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

item T

The object to insert.

OnCollectionChanged(NotifyCollectionChangedEventArgs)

Raises the CollectionChanged event with the provided arguments.

protected override void OnCollectionChanged(NotifyCollectionChangedEventArgs e)
Parameter Type Description
e NotifyCollectionChangedEventArgs

A NotifyCollectionChangedEventArgs that contains the event data.

OnPropertyChanged(PropertyChangedEventArgs)

Raises the PropertyChanged event with the provided arguments.

protected override void OnPropertyChanged(PropertyChangedEventArgs e)
Parameter Type Description
e PropertyChangedEventArgs

A PropertyChangedEventArgs that contains the event data.

SetItem(int, T)

Replaces the element at the specified index.

protected override void SetItem(int index, T item)
Parameter Type Description
index int

The zero-based index of the element to replace.

item T

The new value for the element at the specified index.

ToArray()

Returns a strongly-typed array containing the items in this collection.

public T[] ToArray()

Returns

T[]:

A strongly-typed array containing the items in this collection.

Inherited Members

Extension Methods