Example #1
0
        public static void ApplyTextAlign(this UILabel @this, XPlatTextAlignType textAlign)
        {
            if (@this == null)
            {
                return;
            }

            switch (textAlign)
            {
            case XPlatTextAlignType.Left:
                @this.TextAlignment = UITextAlignment.Left;
                break;

            case XPlatTextAlignType.Right:
                @this.TextAlignment = UITextAlignment.Right;
                break;

            case XPlatTextAlignType.Center:
                @this.TextAlignment = UITextAlignment.Center;
                break;

            default:
                @this.TextAlignment = UITextAlignment.Left;
                break;
            }
        }
Example #2
0
        public static void ApplyTextAlign(this UIButton @this, XPlatTextAlignType textAlign)
        {
            if (@this == null)
            {
                return;
            }

            switch (textAlign)
            {
            case XPlatTextAlignType.Left:
                @this.HorizontalAlignment = UIControlContentHorizontalAlignment.Left;
                break;

            case XPlatTextAlignType.Right:
                @this.HorizontalAlignment = UIControlContentHorizontalAlignment.Right;
                break;

            case XPlatTextAlignType.Center:
                @this.HorizontalAlignment = UIControlContentHorizontalAlignment.Center;
                break;

            default:
                @this.HorizontalAlignment = UIControlContentHorizontalAlignment.Center;
                break;
            }
        }
        public XPlatLabelStyle(XPlatStyle style, XPlatFont font = null, XPlatTextAlignType?textAlign = null)
            : base(style)
        {
            this.Font = font;

            if (textAlign.HasValue)
            {
                this.TextAlign = textAlign.Value;
            }
        }
 public XPlatLabelStyle(XPlatColor color = null, XPlatFont font = null, XPlatTextAlignType textAlign = XPlatTextAlignType.Default)
     : base(color)
 {
     this.Font      = font;
     this.TextAlign = textAlign;
 }