/// <summary> /// On selected an other child /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnSelectedChildChanged() { ChildControl child_c = null; if (SelectedComponent != 1) { return; } child_c = new ChildControl(); child_c.OnDeletingItem += this.RefreshDataGrid; ItemDetails.Children.Add(child_c); child_c.Margin = new Thickness(20); child_c.UserTitle.Content = "Update the child"; child_c.ButtonContent.Content = "Update"; child_c.IdTextBox.IsEnabled = false; child_c.DeleteButton.Visibility = Visibility.Visible; child_c.child = (Child)PersonDetails.SelectedItem; child_c.DataContext = child_c.child; //new Child(child_c.child); if (child_c.MotherComboBox.SelectedItem != null) { child_c.MotherComboBox.SelectedItem = App.bl.GetAllMother().Where(x => x.ID == child_c.child.MotherID).First(); } child_c.MotherComboBox.IsEnabled = false; }
/// <summary> /// On click add child button /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void AddChildButton_click(object sender, RoutedEventArgs e) { AddWindow add_w = new AddWindow(); ChildControl child_c = new ChildControl(); child_c.Margin = new Thickness(10); add_w.myGrid.Children.Add(child_c); Grid.SetRow(child_c, 0); add_w.ShowDialog(); //(new AddChildWindow()).ShowDialog(); }
/// <summary> /// On selected an other child /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnSelectedChildChanged() { ChildControl child_c = null; if (SelectedComponent != 1) { return; } child_c = new ChildControl(); child_c.OnDeletingItem += this.RefreshDataGrid; child_c.OnUpdatingItem += this.RefreshDataGrid; ItemDetails.Content = child_c; child_c.child = new Child((Child)PersonDetails.SelectedItem); child_c.AdaptToUpdateMode(); }