private void ButtonAdd_Click(object sender, RoutedEventArgs e) { CollegeSubjectDialog collegeSubjectDialog = new CollegeSubjectDialog() { Title = "Adicionar Curso" }; if (collegeSubjectDialog.ShowDialog() == true) { subjects.Add(DbContextHelper.AddCollegeSubject(_db, collegeSubjectDialog.CollegeSubject)); subjectGrd.SelectedIndex = subjectGrd.Items.Count - 1; } }