Exemple #1
0
        public Questionnaire_View(List <tmp_questionnaire> tmp_Questionnaire)
        {
            InitializeComponent();
            tmp_question = tmp_Questionnaire;
            int rownumber = 0;

            foreach (var questionnaire in tmp_Questionnaire)
            {
                var questionlabel = new Label
                {
                    Text              = questionnaire.question,
                    TextColor         = Color.Black,
                    FontSize          = 17,
                    FontFamily        = "VarelaRound-Regular.ttf#Open Sans",
                    VerticalOptions   = LayoutOptions.CenterAndExpand,
                    HorizontalOptions = LayoutOptions.StartAndExpand,
                };

                var combobox = new SfComboBox
                {
                    DataSource        = questionnaire.answers,
                    Text              = questionnaire.answer,
                    TextColor         = Color.Black,
                    TextSize          = 17,
                    FontFamily        = "VarelaRound-Regular.ttf#Open Sans",
                    VerticalOptions   = LayoutOptions.CenterAndExpand,
                    HorizontalOptions = LayoutOptions.StartAndExpand,
                    ShowBorder        = false,
                    ClassId           = questionnaire.id_question
                };
                Questionnaire_Grid.RowDefinitions.Add(new RowDefinition
                {
                    Height = 70
                });
                questionlabel.SetValue(Grid.RowProperty, rownumber);
                questionlabel.SetValue(Grid.ColumnProperty, 0);
                combobox.SetValue(Grid.RowProperty, rownumber);
                combobox.SetValue(Grid.ColumnProperty, 1);
                Questionnaire_Grid.Children.Add(questionlabel);
                Questionnaire_Grid.Children.Add(combobox);
                rownumber += 1;
            }
            Add_Button.SetValue(Grid.RowProperty, rownumber + 1);
        }
 public MainWindow()
 {
     InitializeComponent();
     //this.Title = "App";
     records                = api.getRecords();
     cloneRecords           = records.ConvertAll(record => (Record)record.Clone()).ToList();
     lbTodoList.ItemsSource = records;
     if (cloneRecords.Count > 0)
     {
         this.DataContext   = cloneRecords[0];
         this.currentRecord = cloneRecords[0];
         Add_Button.Focus();
         lbTodoList.SelectedItem = records[0];
     }
     else
     {
         this.modify      = false;
         this.DataContext = null;
         fName.Focus();
     }
 }