From d8b0d8f117b9a2fa5c95b2e559acea1316fb6e7e Mon Sep 17 00:00:00 2001 From: zero Date: Mon, 26 Aug 2024 18:28:11 +0900 Subject: [PATCH] Add INotifyCollectionChangedSynchronizedView.Refresh() --- src/ObservableCollections/IObservableCollection.cs | 1 + .../Internal/NotifyCollectionChangedSynchronizedView.cs | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/src/ObservableCollections/IObservableCollection.cs b/src/ObservableCollections/IObservableCollection.cs index 474bb8e..eab69ff 100644 --- a/src/ObservableCollections/IObservableCollection.cs +++ b/src/ObservableCollections/IObservableCollection.cs @@ -59,6 +59,7 @@ namespace ObservableCollections public interface INotifyCollectionChangedSynchronizedView : IReadOnlyCollection, INotifyCollectionChanged, INotifyPropertyChanged, IDisposable { + void Refresh(); } public static class ObservableCollectionsExtensions diff --git a/src/ObservableCollections/Internal/NotifyCollectionChangedSynchronizedView.cs b/src/ObservableCollections/Internal/NotifyCollectionChangedSynchronizedView.cs index d28aea7..38b8e3e 100644 --- a/src/ObservableCollections/Internal/NotifyCollectionChangedSynchronizedView.cs +++ b/src/ObservableCollections/Internal/NotifyCollectionChangedSynchronizedView.cs @@ -131,6 +131,11 @@ namespace ObservableCollections.Internal self.PropertyChanged?.Invoke(self, CountPropertyChangedEventArgs); } } + + public void Refresh() + { + OnCollectionChanged(new SynchronizedViewChangedEventArgs(NotifyCollectionChangedAction.Reset)); + } } internal class ListNotifyCollectionChangedSynchronizedView