From 48ff0a74c5b7911f314c56d3352b4305bb669c69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20ANDRE?= Date: Wed, 17 Jul 2024 09:32:09 +0200 Subject: [PATCH] feat: add SetIsModified when Collection change --- src/MyNet.UI/MyNet.UI.csproj | 4 ++-- src/MyNet.UI/ViewModels/List/ListViewModelBase.cs | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/MyNet.UI/MyNet.UI.csproj b/src/MyNet.UI/MyNet.UI.csproj index 4c88879..7f42973 100644 --- a/src/MyNet.UI/MyNet.UI.csproj +++ b/src/MyNet.UI/MyNet.UI.csproj @@ -23,10 +23,10 @@ all - + - + diff --git a/src/MyNet.UI/ViewModels/List/ListViewModelBase.cs b/src/MyNet.UI/ViewModels/List/ListViewModelBase.cs index 5773c14..4bd7c72 100644 --- a/src/MyNet.UI/ViewModels/List/ListViewModelBase.cs +++ b/src/MyNet.UI/ViewModels/List/ListViewModelBase.cs @@ -75,7 +75,13 @@ protected ListViewModelBase( System.Reactive.Linq.Observable.FromEventPattern(x => Grouping.GroupingChanged += x, x => Grouping.GroupingChanged -= x).Subscribe(x => OnGroupChanged(x.EventArgs.GroupProperties)), System.Reactive.Linq.Observable.FromEventPattern(x => Paging.PagingChanged += x, x => Paging.PagingChanged -= x).Subscribe(x => OnPagingChanged(x.EventArgs.Page, x.EventArgs.PageSize)), Collection.WhenPropertyChanged(x => x.Count).Subscribe(_ => RaisePropertyChanged(nameof(Count))), - Collection.WhenPropertyChanged(x => x.Count).Subscribe(_ => RaisePropertyChanged(nameof(SourceCount))), + Collection.WhenPropertyChanged(x => x.SourceCount).Subscribe(_ => + { + RaisePropertyChanged(nameof(SourceCount)); + + if(!IsModifiedSuspender.IsSuspended) + SetIsModified(); + }), Collection, ]);