diff --git a/Stylet/BindableCollection.cs b/Stylet/BindableCollection.cs
index b0923da..8f08f59 100644
--- a/Stylet/BindableCollection.cs
+++ b/Stylet/BindableCollection.cs
@@ -10,25 +10,39 @@ using System.Threading.Tasks;
namespace Stylet
{
+ ///
+ /// Represents a collection which is observasble
+ ///
+ ///
public interface IObservableCollection : IList, INotifyPropertyChanged, INotifyCollectionChanged
{
+ ///
+ /// Add a range of items
+ ///
+ /// Items to add
void AddRange(IEnumerable items);
+
+ ///
+ /// Remove a range of items
+ ///
+ /// Items to remove
void RemoveRange(IEnumerable items);
}
+ ///
+ /// ObservableCollection subclass which supports AddRange and RemoveRange
+ ///
+ ///
public class BindableCollection : ObservableCollection, IObservableCollection
{
+ ///
+ /// We have to disable notifications when adding individual elements in the AddRange and RemoveRange implementations
+ ///
private bool isNotifying = true;
public BindableCollection() : base() { }
public BindableCollection(IEnumerable collection) : base(collection) { }
- protected void NotifyOfPropertyChange([CallerMemberName] string propertyName = "")
- {
- if (this.isNotifying)
- this.OnPropertyChanged(new PropertyChangedEventArgs(propertyName));
- }
-
protected override void OnPropertyChanged(PropertyChangedEventArgs e)
{
if (this.isNotifying)
@@ -41,6 +55,10 @@ namespace Stylet
base.OnCollectionChanged(e);
}
+ ///
+ /// Add a range of items
+ ///
+ /// Items to add
public virtual void AddRange(IEnumerable items)
{
var previousNotificationSetting = this.isNotifying;
@@ -57,6 +75,10 @@ namespace Stylet
this.OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, items.ToList()));
}
+ ///
+ /// Remove a range of items
+ ///
+ /// Items to remove
public virtual void RemoveRange(IEnumerable items)
{
var previousNotificationSetting = this.isNotifying;
@@ -75,6 +97,9 @@ namespace Stylet
this.OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove, items.ToList()));
}
+ ///
+ /// Raise a change notification indicating that all bindings should be refreshed
+ ///
public void Refresh()
{
this.OnPropertyChanged(new PropertyChangedEventArgs("Count"));