private void addChild(object sender, RoutedEventArgs e) { BodyPart childBodyPart = new BodyPart(); AddBodyPartWindow addChildWindow = new AddBodyPartWindow(); addChildWindow.parent = bodyPart; addChildWindow.ShowDialog(); if (addChildWindow.createdPart == true) { MainWindow.bodyParts.Add(addChildWindow.bodyPart); BodyPartItem bodyPartItem = new BodyPartItem(MainWindow.bodyParts.Last().name, addChildWindow.bodyPart); MainWindow.bodyPartItems.Add(bodyPartItem); Core.mainWindow.addToStackPanel(bodyPartItem); } }
//------------------------------- //Physical Characteristics Tab private void Btn_NewPart_Click(object sender, RoutedEventArgs e) { AddBodyPartWindow addBodyPart = new AddBodyPartWindow(); addBodyPart.Owner = this; addBodyPart.ShowDialog(); if (addBodyPart.createdPart == true) { bodyParts.Add(addBodyPart.bodyPart); BodyPartItem bodyPartItem = new BodyPartItem(bodyParts.Last().name, addBodyPart.bodyPart); bodyPartItems.Add(bodyPartItem); addToStackPanel(bodyPartItem); } }
public void addToStackPanel(BodyPartItem item) { StckPanel_Characteristics.Children.Add(item.panel); }