Example #1
0
 //表名变化时,更新列名下拉框
 private void Table_SelectChange(object sender, SelectionChangedEventArgs e)
 {
     if (e.AddedItems.Count > 0)
     {
         SetEnabled(true, txtSysid, txtTopid, txtName);
         SetEnabled(false, btnExport, btnCompute);
         ClearItems(txtSysid, txtTopid, txtName, optColsPanel);
         string        tb      = e.AddedItems[0].ToString();
         List <string> colList = connDB.GetAllCol(tb);
         foreach (string col in colList)
         {
             ComboBoxItem item = new ComboBoxItem();
             item.Content = col;
             txtSysid.Items.Add(item);
             ComboBoxItem item2 = new ComboBoxItem();
             item2.Content = col;
             txtTopid.Items.Add(item2);
             ComboBoxItem item3 = new ComboBoxItem();
             item3.Content = col;
             txtName.Items.Add(item3);
             Button btn = new Button();
             btn.Content   = col;
             btn.Margin    = new Thickness(2);
             btn.Padding   = new Thickness(2);
             btn.IsEnabled = true;
             optColsPanel.Children.Add(btn);
         }
     }
 }