public CollectiblesViewModel(CollectiblesList list, TagsList tags) { SearchText = new ReactiveProperty <string>(""); AllItems = list.Collectibles.Select(item => new CollectibleViewModel(item, SearchText, tags.Tags)).ToReactiveCollection(); Func <CollectibleViewModel, CollectibleViewModel, int> sortByTitle = (a, b) => String.Compare(a.OriginalTitle, b.OriginalTitle); Func <CollectibleViewModel, bool> filter = vm => { if (string.IsNullOrEmpty(SearchText.Value)) { return(true); } if (SearchText.Value.StartsWith("t:")) { var tag = SearchText.Value.Substring(2).ToLower(); return(vm.Tags.Any(t => t.Name.ToLower().Contains(tag))); } if (vm.OriginalTitle.ToLower().Contains(SearchText.Value.ToLower())) { return(true); } return(false); }; Items = AllItems.WhereMany(filter, t => t.Tags.ObserveCountChanged().AsUnitObservable(), SearchText.AsUnitObservable()).Sort(sortByTitle, null); SelectedItems = Items.WhereMany(vm => vm.IsSelected.Value, vm => vm.IsSelected.AsUnitObservable()).Sort(sortByTitle, null); }