/// <summary> /// On selected an other mother /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnSelectedMotherChanged() { MotherControl mother_c = null; if (SelectedComponent != 0) { return; } mother_c = new MotherControl(); //create user control without binding ItemDetails.Content = mother_c; mother_c.Margin = new Thickness(20); mother_c.UserTitle.Content = "Update the mother"; mother_c.ButtonContent.Content = "Update"; mother_c.IdTextBox.IsEnabled = false; mother_c.FamilyNameTextBox.IsEnabled = false; mother_c.FirstNameTextBox.IsEnabled = false; mother_c.DeleteButton.Visibility = Visibility.Visible; mother_c.OnDeletingItem += this.RefreshDataGrid; mother_c.OnUpdatingItem += this.RefreshDataGrid; // binding mother_c.mother = new Mother((Mother)PersonDetails.SelectedItem); mother_c.DoDataContext(); }
/// <summary> /// On click add mother button /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void AddMotherButton_click(object sender, RoutedEventArgs e) { AddWindow add_w = new AddWindow(); MotherControl mother_c = new MotherControl(); mother_c.Margin = new Thickness(10); add_w.myGrid.Children.Add(mother_c); Grid.SetRow(mother_c, 0); add_w.ShowDialog(); }
/// <summary> /// On selected an other mother /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnSelectedMotherChanged() { MotherControl mother_c = null; if (SelectedComponent != 0) { return; } mother_c = new MotherControl(); ItemDetails.Children.Add(mother_c); mother_c.Margin = new Thickness(20); mother_c.UserTitle.Content = "Update the mother"; mother_c.ButtonContent.Content = "Update"; mother_c.IdTextBox.IsEnabled = false; mother_c.DeleteButton.Visibility = Visibility.Visible; mother_c.OnDeletingItem += this.RefreshDataGrid; mother_c.mother = (Mother)PersonDetails.SelectedItem; mother_c.DataContext = mother_c.mother; //new Child(child_c.child); }