How to create Image Button in Xamarin.Forms?

user1027076 picture user1027076 · May 7, 2015 · Viewed 8.2k times · Source

Please let us know how to create Image Button in Xamarin.Forms, we aren't using the story board.

Environment : Xamarin Studio on Mac

Answer

Mario Galván picture Mario Galván · May 7, 2015

A lot of ways, like this one:

var button = new Image { ... }; // make your image your button should be
button.GestureRecognizers.Add (new TapGestureRecognizer (sender => {
  // Do whatever you want to do when its tapped
  button.Opacity = 0.6;
  button.FadeTo (1);
}));

Or you can even use Xamarin forms labs:

https://github.com/XLabs/Xamarin-Forms-Labs

Or like @Gerald Versluis say:

With image property of the button.

Image="logo.jpg"