private void WeatherCityList_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args) { var autoSuggestBox = (AutoSuggestBox)sender; if (autoSuggestBox.Text != "") { var filtered = CitySuggestion.Where(p => p.cityZh.StartsWith(autoSuggestBox.Text)).ToArray(); autoSuggestBox.ItemsSource = filtered; } else { autoSuggestBox.ItemsSource = NoCitySuggestion; } }
public async void StructCitySuggestion() { var SuggestionFromNet = await GetCityList(); if (SuggestionFromNet.root != null) { var SuggestionArray = SuggestionFromNet.root; CitySuggestion.Clear(); foreach (var item in SuggestionArray) { CitySuggestion.Add(item); } } }