I want to set border color to button in Xamarin Forms but with this code doesn't work:
<Button Text="Test"
BorderWidth="5"
BorderRadius="2"
BorderColor="Red">
</Button>
Using this code the border doesn't appear.
I've also tried this but doen't work.
I've tried it in Android 4.4 (Phisical Device) and in Android 6.0 (Virtual Device) but doesn't work too.
SOLVED FOLLOWING THIS
There are two BottonRenderers in Xamarin Android.
ButtonRenderer under Xamarin.Forms.Platform.Android.AppCompat
namespace.
ButtonRenderer under Xamarin.Forms.Platform.Android
namespace.
The BottonRenderer did not achieve drawing button border where under Xamarin.Forms.Platform.Android.AppCompat
namesapce.
The MainActivity is inherited FormsAppCompatActivity
rather than FormsApplicationActivity
where is used in android project by default. So the renderer is under Xamarin.Forms.Platform.Android.AppCompat
namesapce. But it did not achieve drawing button border.
If you want draw button border, you can custom render by using Xamarin.Forms.Platform.Android
namesapce.
By default the border width is zero, so setting its color makes no difference. You need to set both of them:
<Button Text="Jenson" BorderColor="Red" BorderWidth="1" />
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