private void SearchTextChangedHandler(object sender, TextChangedEventArgs args) { var searchedWords = TextSearchHelper.GetSearchedWords(SearchPhraseTextBox.Text); _collectionView.Filter = searchedWords.Length == 0 ? (Predicate <object>)null : e => { var entry = (StatementExecutionHistoryEntry)e; var textToSearch = $"{entry.StatementText.ToUpperInvariant()} {CellValueConverter.FormatDateTime(entry.ExecutedAt).ToUpperInvariant()} {entry.Tags?.ToUpperInvariant()}"; return(searchedWords.All(textToSearch.Contains)); }; ListHistoryEntries.UpdateLayout(); HighlightText(searchedWords); }
private void HighlightText(IEnumerable <string> searchedWords) { Dispatcher.BeginInvoke(DispatcherPriority.Render, new Action(() => ListHistoryEntries.HighlightTextItems(TextSearchHelper.GetRegexPattern(searchedWords)))); }