In this tutorial we are going to to add Xamarin Forms Image Clicked Event [Tutorial 41].
Some time in our project we require some click events to be handled for images. In this tutorial we are going to make image clicked event inside xaml.
In Xaml we are going to add <Image.GestureRecognizers> tags in order to give image a clickable property and in code behind we will be handling inside TapGestureRecognizer_Tapped_1 methods.
Step1: Create A Xaml File let is be MainPage.xaml. Now we are going to give image a source as Image Source=“unnamed.jpg” and we have to place that image inside drawable folder of both android and IOS. Now for the same image we are going to give the the tap event using <Image.GestureRecognizers>. Our MainPage.Xaml will look like this.
Step2:
Inside Code behind we are going to add the clicked event logics. In this logic i simply have added the navigation to next “page Navigation.PushAsync(new Page2());” after a image is clicked.
Step2: Create a Clicked Event:
Inside Code behind we are going to add the clicked event logics. In this logic i simply have added the navigation to next “page Navigation.PushAsync(new Page2());” after a image is clicked.
Step2: Create a Clicked Event:
Download Working Project From Here : http://xamaringuyshow.com/imageclickedtut41-2/