ComboBoxで選択項目が変更されたことを知るには SelectionChanged イベントを使用します。
下記は選択項目が変更された時に処理をする例です。
新しく選択された項目のテキストを取得します。
private void comboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
var selectedItem = (ComboBoxItem)comboBox.SelectedItem;
if (selectedItem == null) return;
string contentString = (string)selectedItem.Content;
}
Please follow and like us:

コメント