C/C+/C#問題レコード(二)ComboBoxのSelectedItemの値を取得

600 ワード

二つの方法を用いたことがある.
方法1:
((ComboBoxItem)combo.SelectedItem).Content.ToString();

方法2:
int index = combo.SelectedIndex;
string label = combo.Items.GetItemAt(index).ToString();