示例#1
0
		public QuestionChooseOne(QuestionBase question, Panel panel)
			: base(question, panel)
		{
			if (question.Hidden)
				return;

			StackPanel responsePanel = base.ResponsePanel;

			ComboBox comboBox = null;
			if (question.List)
			{
				comboBox = new ComboBox();
				responsePanel.Children.Add(comboBox);
				comboBox.ApplyStyle(panel, "SurveyComboBox");
			}

			foreach (string text in question.ResponseList)
			{
				if (question.List)
				{
					ComboBoxItem item = new ComboBoxItem();
					comboBox.Items.Add(item);
					item.ApplyStyle(panel, "SurveyComboBoxItem");
					item.Content = text;
					if (text.EqualsIgnoreCase(question.ResponseDefault))
						item.IsSelected = true;
				}
				else
				{
					RadioButton button = new RadioButton();
					responsePanel.Children.Add(button);
					button.ApplyStyle(panel, "SurveyRadioButton");
					button.Content = text;
					if (text.EqualsIgnoreCase(question.ResponseDefault))
						button.IsChecked = true;
				}
			}
		}