public async Task GetCompanyList() { CompanyData cData = new CompanyData(); try { list = await cData.GetCompanyList(); CompanyList = new ObservableCollection <Company> (await cData.GetCompanyList()); } catch (Exception e) { Debug.WriteLine(e.Message); } }
private async Task SearchBar_TextChanged(object sender, TextChangedEventArgs e) { // SearchViewModel vm = new SearchViewModel(); CompanyData cData = new CompanyData(); // var c = SuggestionsListView.ItemsSource; if (string.IsNullOrWhiteSpace(e.NewTextValue)) { SuggestionsListView.ItemsSource = ""; } else { ObservableCollection <Company> companies = new ObservableCollection <Company>(); companies = new ObservableCollection <Company> (await cData.GetCompanyList()); //companies = new ObservableCollection<Company> // ((SuggestionsListView.ItemsSource).ToList(); var a = SuggestionsListView.ItemsSource as ObservableCollection <Company>; SuggestionsListView.ItemsSource = companies.Where(c => c.CompanyName .ToLower().Contains(e.NewTextValue.ToLower()) || (c.Symbol.ToLower().Contains(e.NewTextValue.ToLower()))); } }