示例#1
0
        private void button2_Click(object sender, RoutedEventArgs e)
        {
            Label itemname = new Label();

            itemname.Width   = wrapPanel1.Width * (0.2f);
            itemname.Content = "Item Name";
            TextBox itemval = new TextBox();

            itemval.Width = wrapPanel1.Width * (0.2f);

            Label itemnamet = new Label();

            itemnamet.Width   = wrapPanel1.Width * (0.2f);
            itemnamet.Content = "Type";
            TextBox itemvalt = new TextBox();

            itemvalt.Width = wrapPanel1.Width * (0.2f);



            ComponentItem citem = new ComponentItem();

            citem.lb = itemname;
            citem.tb = itemval;

            citem.lbtype = itemnamet;
            citem.tbtype = itemvalt;

            items.Add(citem);

            wrapPanel1.Children.Add(itemname);
            wrapPanel1.Children.Add(itemval);
            wrapPanel1.Children.Add(itemnamet);
            wrapPanel1.Children.Add(itemvalt);
        }
示例#2
0
 private void removeItem(ComponentItem it)
 {
     wrapPanel1.Children.Remove(it.lb);
     wrapPanel1.Children.Remove(it.tb);
     wrapPanel1.Children.Remove(it.lbtype);
     wrapPanel1.Children.Remove(it.tbtype);
     items.Remove(it);
 }