private void OnTagButtonsChanged(object sender, NotifyCollectionChangedEventArgs e) { if (TagButtons.Count == 0) { OmniSearchDataContext.AllValues = new ObservableCollection <Omni>(AllOmnis); } else { OmniSearchDataContext.AllValues = new ObservableCollection <Omni>( AllOmnis.Where(o => TagButtons.All(vm => o.Tags.Contains(vm.CurrentTag))).ToList() ); } }
private void AddTag() { Tag tag = TagSearchDataContext.SelectedValue; if (tag == null) { tag = TagSearchDataContext.FilteredTags.SingleOrDefault(t => t.Name == TagSearchDataContext.FullSearchText); if (tag == null) { return; } } if (TagButtons.All(tb => tb.CurrentTag.Name != tag.Name)) { TagButtons.Add(new TagButtonViewModel(tag)); } TagSearchDataContext.FullSearchText = String.Empty; TagSearchDataContext.SelectedValue = null; }