コード例 #1
0
        private async void CityList_SelectionChanged_1(object sender, SelectionChangedEventArgs e)
        {
            int index = CityList.SelectedIndex;

            if (index == -1)
            {
                return;
            }
            ListBox listBox = sender as ListBox;
            City    city    = null;

            if (listBox.Tag is State)
            {
                State state = listBox.Tag as State;
                city = state._cities[index];
            }
            if (listBox.Tag is SubContinent)
            {
                SubContinent subContinent = listBox.Tag as SubContinent;
                city = subContinent._stateOrCityList[index] as City;
            }
            await SampleDataSource.ChangeCity(city._UrlToken);

            // Use the navigation frame to return to the previous page
            itemDetailPage.UpdateTitle();
            if (this.Frame != null && this.Frame.CanGoBack)
            {
                this.Frame.GoBack();
            }
        }