在网上搜的不对,我就自己写了个。
使用combobox的SelectionChanged事件。
private void Combobox_change(object sender, SelectionChangedEventArgs e)
{
try
{
string ss = "";
ss = ((System.Windows.Controls.ComboBoxItem)e.AddedItems[0]).Content.ToString();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
throw;
}
}
倒是也挺简单的。