Example #1
0
        public YesNoSwitchView(Component c, string formData)
        {
            lineSeparator = new BoxView();
            lineSeparator.HeightRequest = 1;
            lineSeparator.Color         = Color.FromHex("#EAEAEA");
            lineSeparator.Margin        = new Thickness(0, 25, 0, 0);
            switchView = new SwitchView(c, formData);

            question     = new LabelView(c.text);
            this.Padding = new Thickness(25, 20, 25, 0);

            Content = new ScrollView
            {
                Content = new StackLayout
                {
                    Orientation = StackOrientation.Vertical,
                    Children    =
                    {
                        question,
                        switchView,
                        lineSeparator
                    }
                }
            };
        }
Example #2
0
        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.WidthRequest = 200;
            dataEntry.HeightRequest   = 150;
            dataEntry.BackgroundColor = Color.White;
            dataEntry.Keyboard        = Keyboard.Default;

            dataEntry.SetBinding(Editor.TextProperty, "EditorText");
            dataEntry.BindingContext = lblEditorModel;
            dataEntry.Completed     += DataEntry_Completed;
            lblText = new LabelView(lblEditorModel.LabelText);

            lineSeparator = new BoxView();
            lineSeparator.HeightRequest = 1;
            lineSeparator.Color         = Color.FromHex("#EAEAEA");
            lineSeparator.Margin        = new Thickness(0, 25, 0, 0);


            var editorLayout = new StackLayout
            {
                BackgroundColor = Color.FromHex("#EAEAEA"),
                Padding         = 1,
                Children        =
                {
                    dataEntry
                }
            };

            Content = new StackLayout
            {
                Padding  = new Thickness(25, 10, 25, 0),
                Children =
                {
                    lblText,
                    editorLayout,
                    lineSeparator
                }
            };
        }
Example #3
0
        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.Vertical,

                    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"))
            if (switchValueFormData.ToString().ToUpper().Equals("NO") || 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
                    }
                }
            };
        }