Example #1
0
 private void SetPlaceholderTextColor(TxEntry view)
 {
     if (view.PlaceholderTextColor != Xamarin.Forms.Color.Default)
     {
         Control.SetHintTextColor(view.PlaceholderTextColor.ToAndroid());
     }
 }
Example #2
0
 private void SetMaxLength(TxEntry view)
 {
     if (_phoneTextBox != null)
     {
         _phoneTextBox.MaxLength = view.MaxLength;
     }
 }
Example #3
0
 private void SetFont(TxEntry view)
 {
     if (view.Font != Font.Default)
     {
         Control.TextSize = view.Font.ToScaledPixel();
         Control.Typeface = view.Font.ToExtendedTypeface(Context);
     }
 }
 private void SetMaxLength(TxEntry view)
 {
     Control.ShouldChangeCharacters = (textField, range, replacementString) =>
     {
         var newLength = textField.Text.Length + replacementString.Length - range.Length;
         return(newLength <= view.MaxLength);
     };
 }
Example #5
0
        public TextBox(List <string> parts, string[] lines) : this(1, parts[0] == "textentrylimited" ? int.Parse(parts[8]) : -1, 0, int.Parse(parts[3]), style : FontStyle.BlackBorder, hue : (Hue)(Hue.Parse(parts[5]) + 1))
        {
            X           = int.Parse(parts[1]);
            Y           = int.Parse(parts[2]);
            Width       = int.Parse(parts[3]);
            Height      = int.Parse(parts[4]);
            LocalSerial = Serial.Parse(parts[6]);
            TxEntry.SetHeight(Height);

            SetText(lines[int.Parse(parts[7])]);
        }
 private void SetPlaceholderTextColor(TxEntry view)
 {
     if (string.IsNullOrEmpty(view.Placeholder) == false && view.PlaceholderTextColor != Color.Default)
     {
         NSAttributedString placeholderString = new NSAttributedString(view.Placeholder, new UIStringAttributes()
         {
             ForegroundColor = view.PlaceholderTextColor.ToUIColor()
         });
         Control.AttributedPlaceholder = placeholderString;
     }
 }
        private void SetFont(TxEntry view)
        {
            UIFont uiFont;

            if (view.Font != Font.Default && (uiFont = view.Font.ToUIFont()) != null)
            {
                Control.Font = uiFont;
            }
            else if (view.Font == Font.Default)
            {
                Control.Font = UIFont.SystemFontOfSize(17f);
            }
        }
Example #8
0
        public TextBox(List <string> parts, string[] lines) : this(1, parts[0] == "textentrylimited" ? int.Parse(parts[8]) : byte.MaxValue, 0, int.Parse(parts[3]), style : FontStyle.BlackBorder | FontStyle.CropTexture, hue : (ushort)(UInt16Converter.Parse(parts[5]) + 1))
        {
            X           = int.Parse(parts[1]);
            Y           = int.Parse(parts[2]);
            Width       = int.Parse(parts[3]);
            Height      = int.Parse(parts[4]);
            LocalSerial = SerialHelper.Parse(parts[6]);
            TxEntry.SetHeight(Height);

            int index = int.Parse(parts[7]);

            if (index >= 0 && index < lines.Length)
            {
                SetText(lines[index]);
            }
        }
Example #9
0
 private void SetPlaceholderTextColor(TxEntry view)
 {
     if (!view.IsPassword)
     {
         if (view.PlaceholderTextColor != Color.Default && _phoneTextBox != null)
         {
             var hintStyle = new System.Windows.Style(typeof(System.Windows.Controls.ContentControl));
             hintStyle.Setters.Add(
                 new System.Windows.Setter(
                     System.Windows.Controls.Control.ForegroundProperty,
                     view.PlaceholderTextColor.ToBrush())
                 );
             _phoneTextBox.HintStyle = hintStyle;
         }
     }
 }
Example #10
0
        private void SetXAlign(TxEntry view)
        {
            switch (view.XAlign)
            {
            case Xamarin.Forms.TextAlignment.Center:
                Control.Gravity = GravityFlags.CenterHorizontal;
                break;

            case Xamarin.Forms.TextAlignment.End:
                Control.Gravity = GravityFlags.Right;
                break;

            case Xamarin.Forms.TextAlignment.Start:
                Control.Gravity = GravityFlags.Left;
                break;
            }
        }
        private void SetXAlign(TxEntry view)
        {
            switch (view.XAlign)
            {
            case TextAlignment.Center:
                Control.TextAlignment = UITextAlignment.Center;
                break;

            case TextAlignment.End:
                Control.TextAlignment = UITextAlignment.Right;
                break;

            case TextAlignment.Start:
                Control.TextAlignment = UITextAlignment.Left;
                break;
            }
        }
Example #12
0
        private void SetXAlign(TxEntry view)
        {
            if (!view.IsPassword && _phoneTextBox != null)
            {
                switch (view.XAlign)
                {
                case TextAlignment.Center:
                    _phoneTextBox.TextAlignment = System.Windows.TextAlignment.Center;
                    break;

                case TextAlignment.End:
                    _phoneTextBox.TextAlignment = System.Windows.TextAlignment.Right;
                    break;

                case TextAlignment.Start:
                    _phoneTextBox.TextAlignment = System.Windows.TextAlignment.Left;
                    break;
                }
            }
        }
Example #13
0
 private void SetFont(TxEntry view)
 {
     if (view.Font != Font.Default)
     {
         //Text Me
         view.Font = Font.OfSize(string.Format(@"\Assets\Fonts\{0}.ttf#{1}", view.Font.FontFamily, view.Font.FontFamily), view.Font.FontSize);
         if (view.IsPassword)
         {
             if (_passwordBox != null)
             {
                 _passwordBox.FontSize = view.Font.GetHeight();
             }
         }
         else
         {
             if (_phoneTextBox != null)
             {
                 _phoneTextBox.FontSize = view.Font.GetHeight();
             }
         }
     }
 }
Example #14
0
 private void SetMaxLength(TxEntry view)
 {
     Control.SetFilters(new IInputFilter[] { new global::Android.Text.InputFilterLengthFilter(view.MaxLength) });
 }