Пример #1
0
        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;
            }
        }
Пример #2
0
        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);
                }
            }
        }