ComboBoxで選択項目が変更されたことを知るには SelectionChanged イベントを使用します。
たとえば、下記は選択項目が変更された時に処理をする例です。
選択項目が変更されると、新しく選択された項目のテキストを表示します。
C#の例
private async void comboBox1_SelectionChanged(object sender, SelectionChangedEventArgs e) { var selectedItem = (ComboBoxItem)comboBox1.SelectedItem; if (selectedItem == null) return; string contentString = (string)selectedItem.Content; var messageDialog = new MessageDialog(contentString); await messageDialog.ShowAsync(); }
Please follow and like us:
コメント