protected void DisplayMyPhrases(int myCategoryId, UISearchBar searchBar) { myPhrases = new List<Phrase> (); foreach (var phrase in PhraseManager.GetPhrases(myCategoryId)) { myPhrases.Add (phrase); } // Bind to search display controller UISearchDisplayController searchDisplayController = new UISearchDisplayController (searchBar, this); MyphraseTableSource source = new MyphraseTableSource (myPhrases, filteredMyPhrases, this); table.Source = source; searchDisplayController.SearchResultsSource = source; searchDisplayController.SearchBar.TextChanged += (sender, e) => { string text = e.SearchText.Trim(); filteredMyPhrases = (from phrase in myPhrases where phrase.sourcePhrase.ToUpper().Contains(text.ToUpper()) select phrase).ToList(); source.filteredItems = filteredMyPhrases; }; }
protected void ReloadMyPhrases() { myPhrases = PhraseManager.GetPhrases(myPhraseCategoryId).ToList (); MyphraseTableSource source = new MyphraseTableSource (myPhrases, filteredMyPhrases, this); table.Source = source; table.ReloadData (); }