private void shortcut_Click(object sender, RoutedEventArgs e) { AddTeacher addTeacher = new AddTeacher(); (this.Parent as Grid).Children.Add(addTeacher); (this.Parent as Grid).Children.Remove(this); }
private void teacher_list_MouseDoubleClick(object sender, MouseButtonEventArgs e) { try { var selt = (teacher_list.SelectedItem as DataRowView)["teacher_code"].ToString(); AddTeacher adteach = new AddTeacher(); adteach.stringandmode(selt); (this.Parent as Grid).Children.Add(adteach); (this.Parent as Grid).Children.Remove(this); } catch (Exception) { } }