xpaulbettsx/ReactiveUI — Issue #44: ObservableCollectionView does not remove items which do not match the filter
Author: DamianReeves
Created: 2012-01-30 18:02:24+00:00
State: open

I've been using the ObservableCollectionView's ability to filter items in the collection but I saw issues where items which were modified in order to no longer meet the filter criteria not being removed. It seems this issue is due to how the ObserveCollectionItemChanged() call is made:

```C#
source.ObserveCollectionItemChanged()
.Where(updateFilter)
.Select(x => x.Sender)
.Where(filter)
.ObserveOn(RxApp.DeferredScheduler)
.Subscribe(updateItem);
```

The above will never call updateItem to remove items which **don't** meet the filter criteria.
This can be fixed by adding the following code as well:

```C#
source.ObserveCollectionItemChanged()
.Where(updateFilter)
.Select(x => x.Sender)
.Where(x=> !filter(x))
.ObserveOn(RxApp.DeferredScheduler)
.Subscribe(removeItem);
```