Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create Image Button in Xamarin.Forms?

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

Environment : Xamarin Studio on Mac

like image 897
user1027076 Avatar asked Dec 24 '22 19:12

user1027076


1 Answers

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"
like image 70
Mario Galván Avatar answered Jan 12 '23 16:01

Mario Galván