Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xamarin.Forms XAML Rounded Button

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.

like image 489
Biellx Avatar asked Aug 24 '16 00:08

Biellx


People also ask

How to create round button in Xamarin forms?

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.

How do you make 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.


2 Answers

You can use the BorderRadius property to create rounded corners on a Button

<Button Text="BlueButton"
        BorderColor="Blue"
        BorderRadius="5"
        BorderWidth="2"/>
like image 115
Jason Avatar answered Oct 12 '22 01:10

Jason


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;

like image 43
Mohamad Mahmoud Avatar answered Oct 12 '22 00:10

Mohamad Mahmoud