void OnTapped() { //checks that the database has elements before proceeding if (QueryList.Count() > 0) { //adds first category HistoricalStandingsDataList.Add(new HistoricalStandingTitleModel { Title = QueryList.First().TournamentName }); //checks for each element if there already exists a matching category, adds it if not for (int i = 1; i < QueryList.Count(); i++) { if (QueryList.ElementAt(i).TournamentName != QueryList.ElementAt(i - 1).TournamentName) { bool add = true; foreach (var item in HistoricalStandingsDataList) { if (item.Title.ToUpper() == QueryList.ElementAt(i).TournamentName.ToUpper()) { add = false; } } if (add) { HistoricalStandingsDataList.Add(new HistoricalStandingTitleModel { Title = QueryList.ElementAt(i).TournamentName }); } } } ShowListView = !_showListView; if (_showListView) { ArrowImage = "up_arrow.png"; } else { ArrowImage = "down_arrow.png"; } } }