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:
- DockingWindowCollection DocumentWindowCollection ToolWindowCollection ToolWindowContainerCollection
Constructors
DeferrableObservableCollection(IComparer<T>?, bool)
Initializes a new instance of the class.
public DeferrableObservableCollection(IComparer<T>? sortComparer = null, bool useStableSort = false)
Parameter | Type | Description |
---|---|---|
sortComparer | IComparer<T> | A comparer used to sort items; otherwise |
useStableSort | bool | if set to |
Properties
IsDirty
Indicates 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
Indicates 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 IDisposable BeginUpdate()
Returns
- IDisposable:
Returns an object that, when disposed, will call EndUpdate() to complete the bulk update.
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 | 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. |
Inherited Members
- object.GetType()
- object.MemberwiseClone()
- object.ToString()
- object.Equals(object)
- object.Equals(object, object)
- object.ReferenceEquals(object, object)
- object.GetHashCode()