In Xamarin.Forms the views does not have default click event. In my project I wanted images that can be clickable, so I used gesture recognizers. This little helper class saved my time.
Thats all you need, now how to use it.
In Xamarin.Forms the Button control does not have much control on image drawing on the Button itself. There comes the XLabs solution, but it still didn't feel right for me. I needed a button with an icon in the middle of it, and also didn't like the way it resized my image.
So I needed a custom control for it. Instead of writing a control I decided to fork and modify <XLabs.Forms controls.
Below is my modifications to XLabs ImageButton control.
In the XLabs.Core project I modified the Enums/ImageOrientation.cs
At the end of the Enum I appended the above code.
And then the real stuff..
Add the following code below
And then this method
And then the following code to the method SetImageSourceAsync
Almost finished, one last touch: change this line
to:
And remove the trailing close bracket }
In the code you use the ImageButton like the following..