I have a Xamarin.Forms project, and I have a custom control that should open a new page when tapped. Unfortunately, nothing happens when I call Navigation.PushAsync(...);. I've read countless StackOverflow questions (such as this one) and Xamarin Forums threads and done several Google searches, but none of the solutions seem to solve my issue.
- My control inherits from
ContentView, as all Xamarin.Forms views do. srcis a custom class that contains some data points that are used by this control andEventDetailsPage.- I can confirm that the gesture does work itself, but the call to
PushAsync()does nothing. - I have tried manipulating the statement in ways so that a
NavigationPageis used (such that it becomesmyNavigationPage.Navigation.PushAsync(new EventDetailsPage(src));). - I have also tried creating a constructor that takes a
Pageand uses it in away similar to the above point.
My control's constructor:
public EventControl() {
InitializeComponent();
GestureRecognizers.Add(new TapGestureRecognizer() {
Command = new Command(() => Navigation.PushAsync(new EventDetailsPage(src)))
});
}
Typically, asking a new question on StackOverflow is my last resort when nothing else that I've tried solved my problem. Any help is appreciated.