I have the following XAML Xamarin.Forms.Button
<Button Text="Cancel" BackgroundColor="#3079a8" TextColor="White" />
I tried to add padding to it via the Padding property but that didn't work. After checking the forums and the docs, I realised there is no padding property in the documentation for Xamarin.Forms.Button (link to the docs) , is there some other type of quick fix to add just a little bit more padding to a button? A code example would be greatly appreciated.
It doesn't work for me in android. Looking at SetPadding function, I see that the Control has a minimum height of 132 and a minimum width of 242. I changed the SetPadding function in:
In iOS, you can use a simple custom renderer to add a bit of padding to the button:
you can wrap your button in a StackLayout and add padding to the StackLayout
usage:
advantages:
ios:
android:
pcl:
Solution using effects instead of renderers, to allow easy usage for more than one control:
XAML:
PCL:
Android:
The simplest you can do is
[such a big headache working with xamarin forms :'(]
Update:
Padding has been added to the XF Button control in Xamarin.Forms v3.2+
Old:
The best way to do it would be to increase the size of the button.
Then align the text as you see fit. Unfortunately it is about the best you can do. It works well if you have your text center aligned. Not so much if its left or right aligned.