private void executeFilter() { try { string text = SearchText; if (text == null) { Items.Clear(); if (FullList != null) { Items.AddRange(FullList); } return; } text = text.ToString().ToLower().Trim(); if (text == null || text.Trim().Length == 0) { Items.Clear(); if (FullList != null) { Items.AddRange(FullList); } } else { if (FullList != null && FullList.Count > 0) { IEnumerable <Repository> searchList = FullList .Where(r => (!string.IsNullOrEmpty(r.Name) && r.Name.ToLower().Trim().Contains(text)) || (r.Owner != null && !string.IsNullOrEmpty(r.Owner.Login) && r.Owner.Login.ToLower().Trim().Contains(text))); if (searchList != null) { Items.Clear(); Items.AddRange(searchList); } } } } catch (Exception ex) { DisplayAlert("Apologies", "Something went wrong"); } }
public void OnSearchTextChanged() { if (string.IsNullOrEmpty(SearchText)) { JobsList = new InfiniteScrollCollection <JobEmployerDataModel>(TempjobList); } else { JobsList = new InfiniteScrollCollection <JobEmployerDataModel>(TempjobList); List <JobEmployerDataModel> result = JobsList.Where(x => !string.IsNullOrEmpty(x.companyName) && x.companyName.ToLower().Contains(SearchText.ToLower())).ToList(); if (result.Count > 0) { JobsList = new InfiniteScrollCollection <JobEmployerDataModel>(result); } else { showlist = false; thereisnodata = true; } } }