private void AutoSuggestTextInput(object o) { var input = o as string; if (!String.IsNullOrWhiteSpace(input)) { var fitleredVideosSuggestions = Videos.Where(x => x.Artist.Name.ToLower().Contains(input.ToLower())).Select(x => x.Artist.Name); fitleredVideosSuggestions.Concat(Videos.Where(x => x.Name.ToLower().Contains(input.ToLower())).Select(x => x.Name)); fitleredVideosSuggestions = fitleredVideosSuggestions.Distinct(); AutoSuggestValues.Clear(); foreach (var suggestion in fitleredVideosSuggestions) { AutoSuggestValues.Add(suggestion); } } else { AutoSuggestValues.Clear(); AutoSuggestValues.Add("No results found."); } }
private void FilterVideos(object o) { var str = AutoSuggestBoxInput; bool filterAfterText = !string.IsNullOrWhiteSpace(str); if (filterAfterText) { FilteredVideos = Videos.Where(x => x.Artist.Name.ToLower().Contains(str) || x.Name.ToLower().Contains(str)).ToList(); AutoSuggestValues.Clear(); } if (FavoriteFilterOn) { FilteredVideos = FilteredVideos.Where(x => x.IsFavorite).ToList(); } if (!filterAfterText && !FavoriteFilterOn) { FilteredVideos = Videos.ToList(); } ApplySortOrder(); }