private void cmb_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
string str = "";
foreach (ComboBoxItem item in e.AddedItems)
{
str = item.Content.ToString();
}
if ((str != null) && (str.Length != 0))
{
MessageBox.Show(str);
}
}
用 (ComboBox)sender 获得Text属性只能获得SelectionChanged前的字符串,要获得改变后的要利用参数:
SelectionChangedEventArgs