public void Load() { Classes.Clear(); if (SelectedTeacher != null) { foreach (ClassViewModel _class in MainViewModel.Instance.Parameters.Classes.Where(c => c.Teachers.Contains(SelectedTeacher))) { EntryClassViewModel entryClass = new EntryClassViewModel() { Class = _class }; foreach (StudentViewModel student in _class.Students) { EntryStudentViewModel entryStudent = new EntryStudentViewModel() { Student = student }; entryStudent.LoadEntryTrimesterSubjectComments(SelectedTeacher); entryClass.Students.Add(entryStudent); } Classes.Add(entryClass); } SelectedClass = Classes.FirstOrDefault(); if (SelectedClass != null) { SelectedClass.SelectedStudent = SelectedClass.Students.FirstOrDefault(); if (SelectedClass.SelectedStudent != null) { SelectedClass.SelectedStudent.SelectedTrimesterSubjectCommentsSubject = SelectedClass.SelectedStudent.TrimesterSubjectCommentsSubjects.FirstOrDefault(); } } } }
public void Load() { Classes.Clear(); foreach (ClassViewModel _class in MainViewModel.Instance.Parameters.Classes) { EntryClassViewModel entryClass = new EntryClassViewModel() { Class = _class }; foreach (StudentViewModel student in _class.Students) { EntryStudentViewModel entryStudent = new EntryStudentViewModel() { Student = student }; entryClass.Students.Add(entryStudent); } Classes.Add(entryClass); } SelectedClass = Classes.FirstOrDefault(); if (SelectedClass != null) { SelectedClass.SelectedStudent = SelectedClass.Students.FirstOrDefault(); } }
private static void SelectedStudentChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { EntryClassViewModel entryClass = (EntryClassViewModel)d; entryClass.SelectedStudentChangedEvent?.Invoke(); }