I'm trying to place a rounded Button in my Xamarin.Forms application, but I can't do it.
I read something about a custom controller to the button, but I didn't find any docs about rounded buttons in Xamarin.Forms.
Does anyone know how to do it? I'm just building an Android
and iOS
application.
On all three of the supported Xamarin Forms platforms (iOS, Android, UWP), the Button and ImageButton components allow you to set the corner radius of the button. If you set each of the height and the width of the button to exactly twice that of the radius of the corners, you will end up with a round button.
To create a rounded button you have to make use of the border-radius CSS property. The higher the value for that property the more rounder the corners will be. You can use any CSS unit for the boorder-radius property. It can be pixels, ems, rems, percentages etc.
You can use the BorderRadius property to create rounded corners on a Button
<Button Text="BlueButton"
BorderColor="Blue"
BorderRadius="5"
BorderWidth="2"/>
You need to use CornerRadius
instead of BorderRadius
because:
'Button.BorderRadius' is obsolete: 'BorderRadius is obsolete as of 2.5.0. Please use CornerRadius instead.'
Example: XButton.CornerRadius = 5;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With