private void addChoices(SurveyQuestion p_targetQuestion)
 {
     switch (p_targetQuestion.Type)
     {
         case "radio":
             foreach (var choice in p_targetQuestion.Choices)
             {
                 RadioButton rb = new RadioButton();
                 rb.Content = choice.Text;
                 rb.Margin = new Thickness(20);
                 rb.Foreground = new SolidColorBrush(Color.FromArgb(0, 3, 22, 52));
                 this.ChoiceArea.Children.Add(rb);
             }
             break;
         case "check":
             foreach (var choice in p_targetQuestion.Choices)
             {
                 CheckBox cb = new CheckBox();
                 cb.Content = choice.Text;
                 cb.Margin = new Thickness(20);
                 cb.Foreground = new SolidColorBrush(Color.FromArgb(255, 3, 22, 52));
                 cb.Width = 350;
                 this.ChoiceArea.Children.Add(cb);
             }
             break;
         default:
             break;
     }
 }
        private void addChoices(SurveyQuestion p_targetQuestion)
        {
            switch (p_targetQuestion.Type)
            {
            case "radio":
                foreach (var choice in p_targetQuestion.Choices)
                {
                    RadioButton rb = new RadioButton();
                    rb.Content    = choice.Text;
                    rb.Margin     = new Thickness(20);
                    rb.Foreground = new SolidColorBrush(Color.FromArgb(0, 3, 22, 52));
                    this.ChoiceArea.Children.Add(rb);
                }
                break;

            case "check":
                foreach (var choice in p_targetQuestion.Choices)
                {
                    CheckBox cb = new CheckBox();
                    cb.Content    = choice.Text;
                    cb.Margin     = new Thickness(20);
                    cb.Foreground = new SolidColorBrush(Color.FromArgb(255, 3, 22, 52));
                    cb.Width      = 350;
                    this.ChoiceArea.Children.Add(cb);
                }
                break;

            default:
                break;
            }
        }
示例#3
0
 private void generateTestData()
 {
     for (int i = 0; i < 10; i++)
     {
         SurveyQuestion newQuestion = new SurveyQuestion();
         newQuestion.Id = i;
         newQuestion.Type = "check";
         newQuestion.Text = String.Format("This is a question: #{0}", i);
         newQuestion.Choices = new List<SurveyChoice>();
         for (int j = 0; j < 20; j++)
         {
             Random ran = new Random();
             int random = ran.Next(0, 100);
             SurveyChoice newChoice = new SurveyChoice();
             newChoice.Id = j;
             newChoice.Text = String.Format("This is a choice:#{0}", j);
             newChoice.QuestionId = i;
             newChoice.Value = random;
             newQuestion.Choices.Add(newChoice);
         }
         Questions.Add(newQuestion);
     }
 }
示例#4
0
 private void generateTestData()
 {
     for (int i = 0; i < 10; i++)
     {
         SurveyQuestion newQuestion = new SurveyQuestion();
         newQuestion.Id      = i;
         newQuestion.Type    = "check";
         newQuestion.Text    = String.Format("This is a question: #{0}", i);
         newQuestion.Choices = new List <SurveyChoice>();
         for (int j = 0; j < 20; j++)
         {
             Random       ran       = new Random();
             int          random    = ran.Next(0, 100);
             SurveyChoice newChoice = new SurveyChoice();
             newChoice.Id         = j;
             newChoice.Text       = String.Format("This is a choice:#{0}", j);
             newChoice.QuestionId = i;
             newChoice.Value      = random;
             newQuestion.Choices.Add(newChoice);
         }
         Questions.Add(newQuestion);
     }
 }
 public QuestionContainer(SurveyQuestion p_targetQuestion)
 {
     this.InitializeComponent();
     QuestionText.Text = p_targetQuestion.Text;
     addChoices(p_targetQuestion);
 }
 public QuestionContainer(SurveyQuestion p_targetQuestion)
 {
     this.InitializeComponent();
     QuestionText.Text = p_targetQuestion.Text;
     addChoices(p_targetQuestion);
 }