From 5dfa076c1071f09bf4a9d8f84b1da0b0a91cf4ed Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Fri, 12 Jun 2015 13:58:17 +0200 Subject: [PATCH] Implement PerspexReadOnlyListView.PropertyChanged. --- .../Collections/PerspexReadOnlyListView.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Perspex.Base/Collections/PerspexReadOnlyListView.cs b/Perspex.Base/Collections/PerspexReadOnlyListView.cs index b12e52efbb..be0e31beac 100644 --- a/Perspex.Base/Collections/PerspexReadOnlyListView.cs +++ b/Perspex.Base/Collections/PerspexReadOnlyListView.cs @@ -29,6 +29,7 @@ namespace Perspex.Collections if (source != null) { this.source.CollectionChanged += this.SourceCollectionChanged; + this.source.PropertyChanged += this.SourcePropertyChanged; } } @@ -53,6 +54,7 @@ namespace Perspex.Collections if (this.source != null) { this.source.CollectionChanged -= this.SourceCollectionChanged; + this.source.PropertyChanged -= this.SourcePropertyChanged; if (this.CollectionChanged != null) { @@ -69,6 +71,7 @@ namespace Perspex.Collections if (this.source != null) { this.source.CollectionChanged += this.SourceCollectionChanged; + this.source.PropertyChanged += this.SourcePropertyChanged; if (this.CollectionChanged != null) { @@ -90,6 +93,7 @@ namespace Perspex.Collections public void Dispose() { this.source.CollectionChanged -= this.SourceCollectionChanged; + this.source.PropertyChanged -= this.SourcePropertyChanged; } public IEnumerator GetEnumerator() @@ -139,6 +143,11 @@ namespace Perspex.Collections this.CollectionChanged(this, ev); } } + + private void SourcePropertyChanged(object sender, PropertyChangedEventArgs e) + { + this.PropertyChanged?.Invoke(this, e); + } } public class PerspexReadOnlyListView : IPerspexReadOnlyList, IDisposable @@ -160,6 +169,7 @@ namespace Perspex.Collections if (source != null) { this.source.CollectionChanged += this.SourceCollectionChanged; + this.source.PropertyChanged += this.SourcePropertyChanged; } } @@ -184,6 +194,7 @@ namespace Perspex.Collections if (this.source != null) { this.source.CollectionChanged -= this.SourceCollectionChanged; + this.source.PropertyChanged -= this.SourcePropertyChanged; if (this.CollectionChanged != null) { @@ -200,6 +211,7 @@ namespace Perspex.Collections if (this.source != null) { this.source.CollectionChanged += this.SourceCollectionChanged; + this.source.PropertyChanged += this.SourcePropertyChanged; if (this.CollectionChanged != null) { @@ -228,6 +240,7 @@ namespace Perspex.Collections if (this.source != null) { this.source.CollectionChanged -= this.SourceCollectionChanged; + this.source.PropertyChanged -= this.SourcePropertyChanged; } } @@ -288,5 +301,10 @@ namespace Perspex.Collections this.CollectionChanged(this, ev); } } + + private void SourcePropertyChanged(object sender, PropertyChangedEventArgs e) + { + this.PropertyChanged?.Invoke(this, e); + } } }