using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Collections.Specialized; using System.ComponentModel; namespace Bit.App.Utilities { public class ExtendedObservableCollection : ObservableCollection { public ExtendedObservableCollection() : base() { } public ExtendedObservableCollection(IEnumerable collection) : base(collection) { } public ExtendedObservableCollection(List list) : base(list) { } public void AddRange(IEnumerable range) { foreach(var item in range) { Items.Add(item); } OnPropertyChanged(new PropertyChangedEventArgs("Count")); OnPropertyChanged(new PropertyChangedEventArgs("Item[]")); OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset)); } public void Reset(IEnumerable range) { Items.Clear(); AddRange(range); } } }