예제 #1
0
 /// <summary>
 ///     Sets the color of the placeholder text.
 /// </summary>
 /// <param name="view">The view.</param>
 private void SetPlaceholderTextColor(RestaurantEntry view)
 {
     if (view.PlaceholderTextColor != Color.Default)
     {
         Control.SetHintTextColor(view.PlaceholderTextColor.ToAndroid());
     }
 }
예제 #2
0
 private void SetMaxLength(RestaurantEntry view)
 {
     Control.SetFilters(new IInputFilter[]
     {
         new InputFilterLengthFilter(view.MaxLength)
     });
 }
예제 #3
0
 private void SetFont(RestaurantEntry view)
 {
     if (view.Font != Font.Default)
     {
         Control.TextSize = view.Font.ToScaledPixel();
     }
 }
예제 #4
0
 private void SetMaxLength(RestaurantEntry view)
 {
     Control.ShouldChangeCharacters = (textField, range, replacementString) =>
     {
         var newLength = textField.Text.Length + replacementString.Length - range.Length;
         return(newLength <= view.MaxLength);
     };
 }
예제 #5
0
        private void SetFontFamily(RestaurantEntry view)
        {
            UIFont uiFont;

            if (!string.IsNullOrWhiteSpace(view.FontFamily) && (uiFont = view.Font.ToUIFont()) != null)
            {
                var ui = UIFont.FromName(view.FontFamily, (nfloat)(view.Font != null ? view.Font.FontSize : 17f));
                Control.Font = uiFont;
            }
        }
예제 #6
0
        private void SetFont(RestaurantEntry 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);
            }
        }
 /// <summary>
 /// Sets the color of the placeholder text.
 /// </summary>
 /// <param name="view">The view.</param>
 void SetPlaceholderTextColor(RestaurantEntry 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;
     }
 }
예제 #8
0
        private void SetTextAlignment(RestaurantEntry 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;
            }
        }
예제 #9
0
        private void SetTextAlignment(RestaurantEntry 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;
            }
        }
예제 #10
0
 private void SetBorder(RestaurantEntry view)
 {
     Control.BorderStyle = view.HasBorder ? UITextBorderStyle.RoundedRect : UITextBorderStyle.None;
 }