title: How to handle derived lists using Reactive Extensions
body: <p>Given a simple item with soft delete capabilities</p>
  
  <pre class="lang-cs prettyprint-override"><code>public class Person : ReactiveObject
  {
      [Reactive] public string Name { get; set; }
      [Reactive] public bool IsDeleted { get; set; }
  }
  </code></pre>
  
  <p>I need to handle the deleted updates and remove the items on the UI (while keeping them in the list).</p>
  
  <p>When I attempt this, the deleted item is not filtered out of the derived list.</p>
  
  <pre class="lang-cs prettyprint-override"><code>public class PeopleViewModel : ReactiveObject
  {
      public PeopleViewModel()
      {
          DeleteCommand = ReactiveCommand.Create(DeletePerson);
          this.WhenAnyValue(vm =&gt; vm.People)
              .Subscribe(people =&gt; people
                  .ToObservableChangeSet()
                  .Filter(x =&gt; !x.IsDeleted)
                  .ToCollection()
                  .Select(x =&gt; new ObservableCollection&lt;Person&gt;(x))
                  .ToPropertyEx(this, x =&gt; x.VisiblePerson));
      }
  
      private void DeletePerson(Person person)
      {
          person.IsDeleted = true;
      }
  
      ICommand DeleteCommand { get; }
      [Reactive] public ObservableCollection&lt;Person&gt; People { get; set;}
      public ObservableCollection&lt;Person&gt; VisiblePeople { [ObservableAsProperty] get;}
  }
  </code></pre>
  
  <p>What is the correct way to create a derived list whereby when a property within the list changes, it triggers the ObservableChangeSet to update?</p>
  
  <pre><code>------------------------------------------
  |  John Smith                   [delete] |
  ------------------------------------------
  |  Jane Doe                     [delete] |
  ------------------------------------------
  </code></pre>
  
  <h1>Edit</h1>
  
  <p>I did get it working with the following, but this feels really dirty</p>
  
  <pre class="lang-cs prettyprint-override"><code>this.WhenAnyValue(vm =&gt; vm.People)
              .Subscribe(people =&gt; people
                  .ToObservableChangeSet()
                  .AsObservableList()
                  .Connect()
                  .WhenPropertyChanged(x =&gt; x.Deleted)
                  .Subscribe(_ =&gt; people
                      .ToObservableChangeSet()
                      .Filter(x =&gt; !x.Deleted)
                      .ToCollection()
                      .Select(x =&gt; x.ToList().AsReadOnly())
                      .DistinctUntilChanged()
                      .ToPropertyEx(this, x =&gt; x.VisiblePeople))
  </code></pre>