private void lbUsers_SelectionChanged(object sender, SelectionChangedEventArgs e) { matchen.Clear(); vragen.Clear(); User user = (User)lbUsers.SelectedItem; // Matchen foreach (var group in user.SpeelSchema.Groups) { foreach (var match in group.Matchen) { matchen.Add(match); } } dgMatches.ItemsSource = matchen; dgMatches.Items.Refresh(); // Vragen foreach (var question in user.Questions) { if (question is Question4Answers) { question.Antwoord1String = ""; Question4Answers question4 = (Question4Answers)question; foreach (var antwoord in question4.Antwoorden) { if (antwoord != "") { question.Antwoord1String += (question4.Antwoorden.IndexOf(antwoord) + 1) + "e: " + antwoord + ", "; } } } else if (question is QuestionSingleAnswer) { question.Antwoord1String = ((QuestionSingleAnswer)question).Antwoord; } vragen.Add(question); } dgQuestions.ItemsSource = vragen; dgQuestions.Items.Refresh(); }
private void Window_Loaded_1(object sender, RoutedEventArgs e) { matchen.Clear(); vragen.Clear(); // Matchen foreach (var group in Data.SpeelSchema.Groups) { foreach (var match in group.Matchen) { matchen.Add(match); } } dgMatches.ItemsSource = matchen; dgMatches.Items.Refresh(); // Vragen foreach (var question in Data.Questions) { if (question is Question4Answers) { question.Antwoord1String = ""; Question4Answers question4 = (Question4Answers)question; foreach (var antwoord in question4.Antwoorden) { if (antwoord != "") { question.Antwoord1String += (question4.Antwoorden.IndexOf(antwoord) + 1) + "e: " + antwoord + ", "; } } } else if (question is QuestionSingleAnswer) { question.Antwoord1String = ((QuestionSingleAnswer)question).Antwoord; } vragen.Add(question); } dgQuestions.ItemsSource = vragen; dgQuestions.Items.Refresh(); }