zoukankan      html  css  js  c++  java
  • wpf comboBox取值问题

    这是获取值后台代码    

    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);
           
            }

  • 相关阅读:
    78. Subsets java solutions
    77. Combinations java solutions
    236. Lowest Common Ancestor of a Binary Tree java solutions
    86. Partition List java solutions
    39. Combination Sum java solutions
    129. Sum Root to Leaf Numbers java solutions
    杭电1004
    杭电1003
    杭电1002
    杭电1001
  • 原文地址:https://www.cnblogs.com/tianyiwuying/p/3674808.html
Copyright © 2011-2022 走看看