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
版权声明:本文为qrx2013原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。