public void View() { OptionView.InitLabelCircle(); double questionIdxHeight = 3 * Padding; double questionWidth = BackgroundWidth - Padding - Padding; int idxInQuestSheet = 1; foreach (MultiChoiceItem model in Model.Questions) { MultiChoiceItemView question = MultiChoiceItemView.NewWith(model, idxInQuestSheet++, questionIdxHeight, questionWidth, UI_Container); question.Render(); OptionsGroupedByQuestion.Add(question.Options); } }
void RenderOptions() { ListBox Options = new ListBox(); Options.SelectionMode = SelectionMode.Single; Options.Width = QuestionWidth; Options.Name = "_" + Idx; //Options.SelectionChanged += Controller.Options_SelectionChanged;TODO Options.BorderBrush = Theme.Singleton.DefinedColors[(int)BrushId.Ans_TopLine]; Options.BorderThickness = new Thickness(0, 4, 0, 0); int optionIdx = 0; foreach (NonnullRichText richText in Model.Options) { Options.Items.Add(OptionView.NewWith(richText, optionIdx++, QuestionWidth)); } UI_Container.Children.Add(Options); }
//TODO: MVC remove public static OptionView NewWith(NonnullRichText richText, int idx, double questionWidth) { OptionView option = new OptionView(); questionWidth -= 10;//alignment StackPanel sp = new StackPanel(); sp.Orientation = Orientation.Horizontal; option.LabelBorder = new Border(); option.LabelBorder.Width = 30; option.LabelBorder.Height = 30; option.LabelBorder.CornerRadius = LabelCornerRadius; option.LabelBorder.Background = Theme.Singleton.DefinedColors[(int)BrushId.Q_BG]; TextBlock tb = new TextBlock(); tb.Text = "" + (char)('A' + idx); tb.Foreground = Theme.Singleton.DefinedColors[(int)BrushId.QID_BG]; tb.VerticalAlignment = VerticalAlignment.Center; tb.HorizontalAlignment = HorizontalAlignment.Center; option.LabelBorder.Child = tb; sp.Children.Add(option.LabelBorder); //TextBlock ansTxt = new TextBlock(); //ansTxt.Text = text; //ansTxt.TextWrapping = TextWrapping.Wrap; //ansTxt.Width = questionWidth - LabelBorder.Width; //ansTxt.VerticalAlignment = VerticalAlignment.Center; //sp.Children.Add(ansTxt); sp.Children.Add(NonnullRichTextView.Render(richText)); option.Content = sp; option.Padding = new Thickness(0); option.Name = "_" + idx.ToString(); //AnsCellLabel = new Label();TODO: MVC remove return(option); }