mirror of
https://github.com/bitwarden/android.git
synced 2024-12-28 03:48:31 +03:00
37 lines
1.1 KiB
C#
37 lines
1.1 KiB
C#
using System.Collections.Generic;
|
|
using System.Collections.ObjectModel;
|
|
using System.Collections.Specialized;
|
|
using System.ComponentModel;
|
|
|
|
namespace Bit.Core.Utilities
|
|
{
|
|
public class ExtendedObservableCollection<T> : ObservableCollection<T>
|
|
{
|
|
public ExtendedObservableCollection()
|
|
: base() { }
|
|
|
|
public ExtendedObservableCollection(IEnumerable<T> collection)
|
|
: base(collection) { }
|
|
|
|
public ExtendedObservableCollection(List<T> list)
|
|
: base(list) { }
|
|
|
|
public void AddRange(IEnumerable<T> range)
|
|
{
|
|
foreach(var item in range)
|
|
{
|
|
Items.Add(item);
|
|
}
|
|
|
|
OnPropertyChanged(new PropertyChangedEventArgs("Count"));
|
|
OnPropertyChanged(new PropertyChangedEventArgs("Item[]"));
|
|
OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
|
|
}
|
|
|
|
public void ResetWithRange(IEnumerable<T> range)
|
|
{
|
|
Items.Clear();
|
|
AddRange(range);
|
|
}
|
|
}
|
|
}
|