Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

Custom button style - how?

$
0
0

Hi,

I'm new to Xamarin.Forms but I've worked with native Android/iOS development before. I'm wondering how I would create a custom button style. I want to achieve a button that is transparent except for a border and optionally with an image. See this image for an example of two buttons, one with an image and one without: http://i65.tinypic.com/25jjtoi.png

How would I achieve this in Xamarin.Forms? I see some options, there may be more alternatives:
1) Create the border as an image, create a layout and position three elements on top of each other: ImageView(border) + Label(text) + ImageView(facebook icon). Would this be a RelativeLayout or AbsoluteLayout?

2) Create a custom component in my PCL that renders the three elements from alternative 1) but packages it as a custom control.

3) Create Custom Renderers for Android/iOS. I found this example https://github.com/XLabs/Xamarin-Forms-Labs/wiki/ImageButton but the example files does not seem to work with the latest Xamarin.Forms release. Some errors (such as "GetHandler" and "GetWidth" are note defined in the Droid project) and alot of warnings (e.g. BindingBehavior.Create is deprecated).

Would native embedding be a fourth option or is that the same as custom renderers? What alternative is to recommend with focus on performance?

Any tips, examples, snippets etc are appreciated.


Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>