Each time a new SwiperControl instance is created, we need to wire up the events, as follows:
- Open MainPage.xaml.cs.
- Add the following code in bold to the InsertPhoto() method:
private void InsertPhoto()
{
var photo = new SwiperControl();
photo.OnDeny += Handle_OnDeny;
photo.OnLike += Handle_OnLike;
this.MainGrid.Children.Insert(0, photo);
}
The added code wires up the event handlers that we defined earlier. The events make it really easy to interact with our new control. Try it for yourself and have a play around with the app that you have created.