//List<string> Items = new List<string>(); //ObservableCollection<ListItem> CurrentItems = new ObservableCollection<ListItem>(); //List<string> Casillas = new List<string>(); //ObservableCollection<ListItem> CurrentCasillas = new ObservableCollection<ListItem>(); //ObservableCollection<ListItem> Respuestas = new ObservableCollection<ListItem>(); public EncuestaPage2() { InitializeComponent(); //TestLista(); var listaRelacionada = new ListaConRelacion(); listaRelacionada.SetItems("EL TITULO", new List <string>() { "PREGUNTA 1", "PREGUNTA 2", "PREGUNTA 3", "PREGUNTA 4", }, new List <string>() { "CASILLA 1", "CASILLA 2", "CASILLA 3", }); _stack.Children.Add(listaRelacionada); var listaRelacionada2 = new ListaConRelacion(); listaRelacionada2.SetItems("EL TITULO", new List <string>() { "PREGUNTA X", "PREGUNTA Y", "PREGUNTA Z", "PREGUNTA XY", }, new List <string>() { "CASILLA N", "CASILLA R", "CASILLA M", }); _stack.Children.Add(listaRelacionada2); var radioGroup = new RadioButtonGroup(new string[] { "P1", "P2", "P3" }); radioGroup.Label.Text = "RADIOS"; radioGroup.ItemSelected += (sender, e) => { System.Diagnostics.Debug.WriteLine("RADIO SELECTED: {0} ID: {1}", radioGroup.Values[0], radioGroup.SelectedIndex); }; _stack.Children.Add(radioGroup); var input = new OpcionInput(); input.Label.Text = "TEXT INPUT OPTION"; input.Entry.TextChanged += (sender, e) => { System.Diagnostics.Debug.WriteLine("INPUT CHANGED: {0}", e.NewTextValue); }; _stack.Children.Add(input); NavigationPage.SetHasNavigationBar(this, false); }
async void RenderEncuesta() { foreach (var opcion in listaOpciones) { switch (opcion.Tipo) { case EncuestaElemento.Label: var label = new Label(); label.Text = opcion.Label; label.HorizontalOptions = opcion.HorizontalOption; Container.Children.Add(label); break; case EncuestaElemento.TextBox: var input = new OpcionInput(); input.Label.Text = opcion.Label; if (opcion.Values != null && opcion.Values.Count > 0) { input.Entry.Text = opcion.Values[0]; } Container.Children.Add(input); break; case EncuestaElemento.CheckBox: if (opcion.Values != null) { var checkBoxGroup = new CheckBoxGroup(opcion.Values.ToArray()); checkBoxGroup.Label.Text = opcion.Label; Container.Children.Add(checkBoxGroup); } break; case EncuestaElemento.RadioButton: if (opcion.Values != null) { var radioGroup = new RadioButtonGroup(opcion.Values.ToArray()); radioGroup.Label.Text = opcion.Label; Container.Children.Add(radioGroup); } break; case EncuestaElemento.DropDown: if (opcion.Values != null) { var dropDown = new DropDown(); dropDown.Label.Text = opcion.Label; dropDown.Values = opcion.Values; Container.Children.Add(dropDown); } break; case EncuestaElemento.ListBox: //var listView = new ListView (); //listView.HeightRequest = opcion.Values.Count * 50; //listView.ItemsSource = opcion.Values; //listView.RowHeight = 50; var listBox = new ListBox(); listBox.Label.Text = opcion.Label; //listBox.Values = opcion.Values; Container.Children.Add(listBox); break; case EncuestaElemento.Separador: var boxView = new BoxView() { HeightRequest = 1, HorizontalOptions = LayoutOptions.FillAndExpand, BackgroundColor = Color.Gray, }; Container.Children.Add(boxView); break; } //await Task.Delay (300); } }