ComboBox的SelectionChanged获取不到当前文本的问题

来源:互联网 发布:安卓手机怎么重置网络 编辑:程序博客网 时间:2024/05/16 04:35
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
                                             
0 0
原创粉丝点击