/// <summary> /// Adds all question in category to ListBox on pivot page. /// </summary> /// <param name="listOfQuestions">ListBox element name on pivot page to which questions should be added.</param> public void AddQuestionsToListBox(ListBox listOfQuestions) { foreach (Question question in _category.Questions) { Type type = question.GetType(); UserControl questionControl = null; if (question is DateQuestion) { questionControl = new DateQuestionControl(); ((DateQuestionControl)questionControl).QuestionData.DataContext = question; } else if (question is DescriptiveQuestion) { questionControl = new DescriptiveQuestionControl(); ((DescriptiveQuestionControl)questionControl).QuestionData.DataContext = question; } else if (question is TimeQuestion) { questionControl = new TimeQuestionControl(); ((TimeQuestionControl)questionControl).QuestionData.DataContext = question; } else if (question is NumericQuestion) { questionControl = new NumericQuestionControl(); ((NumericQuestionControl)questionControl).QuestionData.DataContext = question; } else if (question is MultipleChoiceQuestion) { questionControl = new MultipleChoiceQuestionControl(); ((MultipleChoiceQuestionControl)questionControl).QuestionData.DataContext = question; } else if (question is ExclusiveChoiceQuestion) { questionControl = new ExclusiveChoiceQuestionControl(); ((ExclusiveChoiceQuestionControl)questionControl).QuestionData.DataContext = question; } else if (question is ImageQuestion) { questionControl = new ImageQuestionControl(); ((ImageQuestionControl)questionControl).QuestionData.DataContext = question; } if (questionControl != null) { listOfQuestions.Items.Add(questionControl); } } }
/// <summary> /// Adds all question in category to ListBox on pivot page. /// </summary> /// <param name="listOfQuestions">ListBox element name on pivot page to which questions should be added.</param> public void AddQuestionsToListBox(ListBox listOfQuestions) { foreach (Question question in _category.Questions) { Type type = question.GetType(); UserControl questionControl = null; if ( question is DateQuestion) { questionControl = new DateQuestionControl(); ((DateQuestionControl)questionControl).QuestionData.DataContext = question; } else if ( question is DescriptiveQuestion) { questionControl = new DescriptiveQuestionControl(); ((DescriptiveQuestionControl)questionControl).QuestionData.DataContext = question; } else if ( question is TimeQuestion) { questionControl = new TimeQuestionControl(); ((TimeQuestionControl)questionControl).QuestionData.DataContext = question; } else if ( question is NumericQuestion) { questionControl = new NumericQuestionControl(); ((NumericQuestionControl)questionControl).QuestionData.DataContext =question; } else if ( question is MultipleChoiceQuestion) { questionControl = new MultipleChoiceQuestionControl(); ((MultipleChoiceQuestionControl)questionControl).QuestionData.DataContext = question; } else if ( question is ExclusiveChoiceQuestion) { questionControl = new ExclusiveChoiceQuestionControl(); ((ExclusiveChoiceQuestionControl)questionControl).QuestionData.DataContext = question; } else if ( question is ImageQuestion) { questionControl = new ImageQuestionControl(); ((ImageQuestionControl)questionControl).QuestionData.DataContext = question; } if (questionControl != null) listOfQuestions.Items.Add(questionControl); } }