await Application.Current.MainPage.Navigation.PushAsync(new Pages.Page1());
Xamarin forms: How to open a ContentPage from a ContentView?

Sreejith Sree
1,251
Reputation points
I have a Xamarin.forms.Maps
in a ContentView and I am using that view in a listview. I need to open a new page when clicking the map.
I tried like below:
MapClicked="MapClicked"
private async void MapClicked(object sender, MapClickedEventArgs e)
{
var item = (History)((Map)sender).BindingContext;
await Navigation.PushModalAsync(new Pages.Page1());
}
When I tap the map these lines are triggering, but Page1 is not opening. So what is the exact way to open a ContentPage from a ContentView?
Developer technologies | .NET | Xamarin
5,381 questions
Accepted answer
-
Alessandro Caliaro 4,196 Reputation points
2021-01-11T09:54:54.99+00:00