Skip to content

Commit

Permalink
feat: add SetIsModified when Collection change
Browse files Browse the repository at this point in the history
  • Loading branch information
sandre58 committed Jul 17, 2024
1 parent d75b67b commit 48ff0a7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/MyNet.UI/MyNet.UI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="MyNet.DynamicData.Extensions" Version="2.0.0" />
<PackageReference Include="MyNet.Observable" Version="5.0.1" />
<PackageReference Include="MyNet.Observable" Version="5.1.0" />
<PackageReference Include="MyNet.Observable.Collections" Version="4.0.0" />
<PackageReference Include="MyNet.Observable.Translatables" Version="3.0.0" />
<PackageReference Include="MyNet.Utilities" Version="3.2.0" />
<PackageReference Include="MyNet.Utilities" Version="3.5.0" />
</ItemGroup>

<ItemGroup>
Expand Down
8 changes: 7 additions & 1 deletion src/MyNet.UI/ViewModels/List/ListViewModelBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,13 @@ protected ListViewModelBase(
System.Reactive.Linq.Observable.FromEventPattern<GroupingChangedEventArgs>(x => Grouping.GroupingChanged += x, x => Grouping.GroupingChanged -= x).Subscribe(x => OnGroupChanged(x.EventArgs.GroupProperties)),
System.Reactive.Linq.Observable.FromEventPattern<PagingChangedEventArgs>(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,
]);

Expand Down

0 comments on commit 48ff0a7

Please sign in to comment.