日期:2014-05-20  浏览次数:21117 次

在wpf中怎样获得Combox的文本值
     在wpf中,Combox的值不是绑定数据源,我要在Combox的SelectionChanged事件中怎样获得它的文本显示值啊
------解决方案--------------------
帮顶下
------解决方案--------------------
http://www.oschina.net/code/snippet_146385_10226
------解决方案--------------------
不好意思,那个好像不对,类型转换有问题。
private void Combobox_change(object sender, SelectionChangedEventArgs e)
        {
            try
            {
                string ss = "";
                ss = ((System.Windows.Controls.ComboBoxItem)e.AddedItems[0]).Content.ToString();
                (this.DataContext as ReportTheLossViewModel).SetEnable(ss);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                throw;
            }
        }
你试试这个。。。。