コード例 #1
0
 /// <summary>
 /// Sets the color of the placeholder text.
 /// </summary>
 /// <param name="view">The view.</param>
 private void SetPlaceholderTextColor(xEntry view)
 {
     if (view.PlaceholderTextColor != Color.Default)
     {
         Control.SetHintTextColor(view.PlaceholderTextColor.ToAndroid());
     }
 }
コード例 #2
0
 /// <summary>
 /// Sets the font.
 /// </summary>
 /// <param name="view">The view.</param>
 private void SetFont(xEntry view)
 {
     if (view.Font != Font.Default)
     {
         Control.TextSize = view.Font.ToScaledPixel();
     }
 }
コード例 #3
0
 /// <summary>
 /// Sets the maxLength.
 /// </summary>
 /// <param name="view">The view.</param>
 private void SetMaxLength(xEntry view)
 {
     Control.ShouldChangeCharacters = (textField, range, replacementString) =>
     {
         var newLength = textField.Text.Length + replacementString.Length - range.Length;
         return(newLength <= view.MaxLength);
     };
 }
コード例 #4
0
        private void SetFont(xEntry 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);
            }
        }
コード例 #5
0
 ///// <summary>
 ///// Sets the border.
 ///// </summary>
 ///// <param name="view">The view.</param>
 private void SetBorder(xEntry view)
 {
     if (view.HasBorder == false)
     {
         var shape = new ShapeDrawable(new RectShape());
         shape.Paint.Alpha = 0;
         shape.Paint.SetStyle(Paint.Style.Stroke);
         Control.SetBackgroundDrawable(shape);
     }
     else
     {
         Control.SetBackground(originalBackground);
     }
 }
コード例 #6
0
 /// <summary>
 /// Sets the color of the placeholder text.
 /// </summary>
 /// <param name="view">The view.</param>
 void SetPlaceholderTextColor(xEntry view)
 {
     /*
      * UIColor *color = [UIColor lightTextColor];
      * YOURTEXTFIELD.attributedPlaceholder = [[NSAttributedString alloc] initWithString:@"PlaceHolder Text" attributes:@{NSForegroundColorAttributeName: color}];
      */
     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;
     }
 }
コード例 #7
0
        private void SetTextAlignment(xEntry 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;
            }
        }
コード例 #8
0
        /// <summary>
        /// Sets the text alignment.
        /// </summary>
        /// <param name="view">The view.</param>
        private void SetTextAlignment(xEntry view)
        {
            switch (view.XAlign)
            {
            case Xamarin.Forms.TextAlignment.Center:
                Control.Gravity = GravityFlags.CenterHorizontal;
                break;

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

            case Xamarin.Forms.TextAlignment.Start:
                Control.Gravity = GravityFlags.Start;
                break;
            }
        }
コード例 #9
0
 /// <summary>
 /// Sets the border.
 /// </summary>
 /// <param name="view">The view.</param>
 private void SetBorder(xEntry view)
 {
     Control.BorderStyle = view.HasBorder ? UITextBorderStyle.RoundedRect : UITextBorderStyle.None;
 }
コード例 #10
0
 /// <summary>
 /// Sets the MaxLength characteres.
 /// </summary>
 /// <param name="view">The view.</param>
 private void SetMaxLength(xEntry view)
 {
     Control.SetFilters(new IInputFilter[] { new InputFilterLengthFilter(view.MaxLength) });
 }