Example #1
0
		public QuestionChooseAny(QuestionBase question, Panel panel)
			: base(question, panel)
		{
			if (question.Hidden)
				return;

			StackPanel responsePanel = base.ResponsePanel;

			ListBox listBox = null;
			if (question.List)
			{
				listBox = new ListBox();
				responsePanel.Children.Add(listBox);
				listBox.ApplyStyle(panel, "SurveyListBox");
			}

			foreach (string text in question.ResponseList)
			{
				if (question.List)
				{
					ListBoxItem item = new ListBoxItem();
					listBox.Items.Add(item);
					item.ApplyStyle(panel, "SurveyListBoxItem");
					item.Content = text;
					if (text.EqualsIgnoreCase(question.ResponseDefault))
						item.IsSelected = true;
				}
				else
				{
					CheckBox checkBox = new CheckBox();
					responsePanel.Children.Add(checkBox);
					checkBox.ApplyStyle(panel, "SurveyCheckBox");
					checkBox.Content = text;
					if (text.EqualsIgnoreCase(question.ResponseDefault))
						checkBox.IsChecked = true;
				}
			}
		}