Hi all
I've built a custom renderer derived from the Button class, to basically make it easier for me to add custom styled buttons. I need a button with rounded borders, on IOS by default they don't have borders, which is fine. Ideally i'd like to change it so the font size is pre selected too. It just means I don't have to add a bunch of attributes each time.
Here's what I've got:
public class BorderedButtonRenderer : ButtonRenderer
{
UIButton btn;
public override void Draw(System.Drawing.RectangleF rect)
{
base.Draw(rect);
btn = (UIButton)Control;
btn.Layer.MasksToBounds = true;
btn.Layer.BorderColor = Styles.GetPrimaryColor().ToCGColor();
btn.Layer.BorderWidth = 1;
btn.SetTitleColor(Styles.GetPrimaryColor().ToUIColor(), UIControlState.Normal);
}
}
My question is, where or how do I go about explicitly stating the padding between the button text and it's border? By default the padding seems to be all over the place and doesn't look good at all. Also is there a way from here to explicitly set the font size to 14?
I may be going about it completely the wrong way?!
Cheers, Will