public YesNoSwitchView(Component c, string formData) { switchView = new SwitchView(c, formData); question = new LabelView(c.text); this.Padding = new Thickness(5, 20, 0, 0); Content = new ScrollView { Content = new StackLayout { Orientation = StackOrientation.Horizontal, Children = { question, switchView } } }; }
public FormGroupBoxView(string boxText) { LabelView boxLabel = new LabelView(boxText); Button btn = new Button(); btn.WidthRequest = 50; btn.HeightRequest = 50; btn.BackgroundColor = Color.Aqua; btn.Text = boxText; Content = new ScrollView { FlowDirection = FlowDirection.LeftToRight, Content = new StackLayout { Orientation = StackOrientation.Horizontal, Children = { btn } } }; }
public SwitchView(Component c, string formData) { path = c.path; bool switchValue = false; //read formData based on the c.path var switchValueFormData = Utilities.Utility.GetFormDataValue(formData, path); if (switchValueFormData.ToString().ToUpper().Equals("FALSE")) { switchValue = false; } else { switchValue = true; } sw = new Switch(); lblAnswer = new LabelView(); switchViewModel = new SwitchViewModel(switchValue); BindingContext = switchViewModel; sw.SetBinding(Switch.IsToggledProperty, "SwitchValue"); sw.BindingContext = switchViewModel; //Switch command sw.Toggled += sw_Toggled; Content = new ScrollView { Content = new StackLayout { Children = { sw, lblAnswer } } }; }
public LabelEditorView(Component c, string formData) { editorPath = c.path; var dataEntryValue = Utilities.Utility.GetFormDataValue(formData, editorPath); lblEditorModel = new LabelEditorViewModel(c.text, dataEntryValue.ToString()); BindingContext = lblEditorModel; dataEntry = new Editor(); dataEntry.BackgroundColor = Color.LightGray; dataEntry.WidthRequest = 200; dataEntry.HeightRequest = 200; dataEntry.SetBinding(Editor.TextProperty, "EditorText"); dataEntry.BindingContext = lblEditorModel; dataEntry.Completed += DataEntry_Completed; lblText = new LabelView(lblEditorModel.LabelText); var editorLayout = new StackLayout { Padding = new Thickness(5, 10), Children = { dataEntry } }; Content = new StackLayout { Children = { lblText, editorLayout } }; }