예제 #1
0
        protected override void OnElementChanged(ElementChangedEventArgs <Editor> e)
        {
            base.OnElementChanged(e);

            if (Control != null)
            {
                var ctrl = e.NewElement as IEbCustomControl;

                drawable.SetShape(ShapeType.Rectangle);
                drawable.SetCornerRadius(ctrl.BorderRadius);

                if (ctrl.BorderColor != null)
                {
                    drawable.SetStroke(ctrl.BorderThickness, ctrl.BorderColor.ToAndroid());
                }

                if (ctrl.XBackgroundColor != null)
                {
                    drawable.SetColor(ctrl.XBackgroundColor.ToAndroid());
                }

                Control.SetBackground(drawable);

                EbXTextArea textbox = e.NewElement as EbXTextArea;

                if (textbox.EnableFocus)
                {
                    textbox.Focused   += Textbox_Focused;
                    textbox.Unfocused += Textbox_Unfocused;
                }
            }
        }
        public override View Draw(FormMode Mode, NetworkMode Network)
        {
            if (TextMode == TextMode.MultiLine)
            {
                var textarea = new EbXTextArea()
                {
                    IsReadOnly       = this.ReadOnly,
                    XBackgroundColor = this.XBackground,
                    EnableFocus      = true,
                    BorderOnFocus    = App.Settings.Vendor.GetPrimaryColor()
                };
                textarea.Unfocused += TextChanged;
                XControl            = textarea;
            }
            else
            {
                var textbox = new EbXTextBox
                {
                    IsReadOnly       = this.ReadOnly,
                    XBackgroundColor = this.XBackground,
                    EnableFocus      = true,
                    BorderOnFocus    = App.Settings.Vendor.GetPrimaryColor(),
                };
                textbox.Unfocused += TextChanged;
                XControl           = textbox;
            }

            return(base.Draw(Mode, Network));;
        }