/// <summary> /// On selected an other nanny /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnSelectedNannyChanged() { NannyControl nanny_c = null; if (SelectedComponent != 2) { return; } nanny_c = new NannyControl(); nanny_c.OnDeletingItem += this.RefreshDataGrid; ItemDetails.Content = nanny_c; nanny_c.Margin = new Thickness(20); nanny_c.UserTitle.Content = "Update the Nanny"; nanny_c.ButtonContent.Content = "Update"; nanny_c.IdTextBox.IsEnabled = false; nanny_c.DeleteButton.Visibility = Visibility.Visible; nanny_c.OnUpdatingItem += this.RefreshDataGrid; nanny_c.OnDeletingItem += this.RefreshDataGrid; // binding nanny_c.nanny = new Nanny((Nanny)PersonDetails.SelectedItem); nanny_c.DoDataContext(); }
/// <summary> /// On click add nanny button /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void AddNannyButton_click(object sender, RoutedEventArgs e) { AddWindow add_w = new AddWindow(); NannyControl nanny_c = new NannyControl(); nanny_c.Margin = new Thickness(10); add_w.myGrid.Children.Add(nanny_c); Grid.SetRow(nanny_c, 0); add_w.ShowDialog(); }