|
3 | 3 | // The .NET Foundation licenses this file to you under the MIT license. |
4 | 4 | // See the LICENSE file in the project root for full license information. |
5 | 5 |
|
| 6 | +using System.Collections.ObjectModel; |
6 | 7 | using System.Diagnostics.CodeAnalysis; |
7 | 8 | using System.Reactive; |
8 | 9 | using System.Reactive.Concurrency; |
|
11 | 12 | using System.Reactive.Subjects; |
12 | 13 | using System.Runtime.Serialization; |
13 | 14 | using System.Text.Json.Serialization; |
| 15 | +using DynamicData; |
14 | 16 | using ReactiveUI; |
15 | 17 | using ReactiveUI.SourceGenerators; |
16 | 18 |
|
@@ -66,6 +68,12 @@ public partial class TestViewModel : ReactiveObject, IActivatableViewModel, IDis |
66 | 68 | [Reactive(SetModifier = AccessModifier.Init, UseRequired = true)] |
67 | 69 | private string _mustBeSet; |
68 | 70 |
|
| 71 | + [Reactive] |
| 72 | + private IEnumerable<Person> _people = [new Person()]; |
| 73 | + |
| 74 | + [BindableDerivedList] |
| 75 | + private ReadOnlyObservableCollection<Person>? _visiblePeople; |
| 76 | + |
69 | 77 | /// <summary> |
70 | 78 | /// Initializes a new instance of the <see cref="TestViewModel"/> class. |
71 | 79 | /// </summary> |
@@ -186,6 +194,15 @@ public TestViewModel() |
186 | 194 | _observableAsPropertyFromPropertyHelper = _fromPartialTestSubject.ToProperty(this, x => x.ObservableAsPropertyFromProperty); |
187 | 195 | _fromPartialTestSubject.OnNext(11); |
188 | 196 | Console.Out.WriteLine($"Observable updated, value should be 11, value is : {ObservableAsPropertyFromProperty}"); |
| 197 | + |
| 198 | + this.WhenAnyValue(vm => vm.People) |
| 199 | + .Subscribe(people => people |
| 200 | + .AsObservableChangeSet() |
| 201 | + .AutoRefresh(x => x.Deleted) |
| 202 | + .Filter(x => !x.Deleted) |
| 203 | + .Bind(out _visiblePeople) |
| 204 | + .Subscribe()); |
| 205 | + |
189 | 206 | Console.ReadLine(); |
190 | 207 | } |
191 | 208 |
|
|
0 commit comments