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
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..
There you go, much better
0 comments:
Post a Comment