/// <summary> /// コンボボックス初期設定 /// </summary> private void Init() { List <string> list = logic.setArea(); // 都道府県リスト設定 WeatherReportsListData item = new WeatherReportsListData(list); this.cmbArea.ItemsSource = item.List; this.cmbPref.ItemsSource = null; this.cmbCity.ItemsSource = null; }
/// <summary> /// エリアコンボボックス選択 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void cmbArea_SelectionChanged(object sender, SelectionChangedEventArgs e) { String val = logic.getSelectItem((List <ListItemData>) this.cmbArea.ItemsSource, this.cmbArea.SelectedIndex); List <string> list = logic.setPref(val); this.cmbCity.ItemsSource = null; // 地域リスト設定 WeatherReportsListData item = new WeatherReportsListData(list); this.cmbPref.ItemsSource = item.List; }
/// <summary> /// 地域コンボボックス選択 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void cmbPref_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (this.cmbPref.SelectedIndex == -1) { return; } String val = logic.getSelectItem((List <ListItemData>) this.cmbPref.ItemsSource, this.cmbPref.SelectedIndex); List <string> list = logic.setCity(val); // 都市リスト設定 WeatherReportsListData item = new WeatherReportsListData(list); this.cmbCity.ItemsSource = item.List; }