private void ApplyFilter(string filter) { DisplayedBoardGames.Clear(); foreach (var boardGame in BoardGames.Select(x => x).Where(x => x.Name.IndexOf(filter, StringComparison.InvariantCultureIgnoreCase) >= 0)) { DisplayedBoardGames.Add(boardGame); } }
public void FilterBoardGames(string filter, bool showAll) { CurrentFilter = showAll ? "" : filter; if (showAll) { DisplayedBoardGames.Clear(); foreach (var boardGame in BoardGames) { DisplayedBoardGames.Add(boardGame); } return; } ApplyFilter(filter); }