A Microsoft framework for building cross-platform mobile apps using .NET and C# with native performance and user interfaces.
await Application.Current.MainPage.Navigation.PushAsync(new Pages.Page1());
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
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?
A Microsoft framework for building cross-platform mobile apps using .NET and C# with native performance and user interfaces.
Answer accepted by question author
await Application.Current.MainPage.Navigation.PushAsync(new Pages.Page1());