这是获取值后台代码
PRivate void button1_Click(object sender, RoutedEventArgs e)
{
combBox = this.comboBox1.SelectedItem as ComboBoxItem;
combBox1 = this.comboBox2.SelectedItem as ComboBoxItem;
string type = combBox.Content.ToString();
string type1 = combBox1.Content.ToString();
MessageBox.Show(type+type1);
}
ComboBoxItem combBox;
ComboBoxItem combBox1;
string value = "";
private void comboBox1_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
ComboBoxItem cbItem = (ComboBoxItem)(sender as ComboBox).SelectedItem;
value = cbItem.Content.ToString();
MessageBox.Show(value);
// string v = (sender as ComboBox).SelectedValue.ToString();
// string bx= v as string;
// MessageBox.Show(bx);
}
新闻热点
疑难解答