public DetailedBox(string st, Student s, IManageStudent l) { InitializeComponent(); _link = l; _student = s; _mode = st; boxName.Content = st + " student"; comboBox.ItemsSource = EntityDb.LoadStudies(); comboBox.DisplayMemberPath = "Name"; listBox.ItemsSource = EntityDb.LoadSubjects(); listBox.DisplayMemberPath = "Name"; if (_student != null) { fBox.Text = _student.FirstName; lBox.Text = _student.LastName; iBox.Text = _student.IndexNumber; foreach (Study study in EntityDb.LoadStudies()) { if (study.IdStudies == _student.IdStudies) { comboBox.SelectedItem = study; } } foreach (Student_Subject sb in EntityDb.LoadStudents_Subj()) { if (sb.IdStudent == _student.IdStudent) { listBox.SelectedItem = EntityDb.FindSubject(sb.IdSubject); } } } }