iam trying to navigate in xamarin using Navigation.PushModalAsync. but it is not navigating.
CodePudding user response:
async private void OnLoginClicked(object obj) {
NavigationPage p1 = new NavigationPage(new LoginPage());
p1.Navigation.InsertPageBefore(new LoginPage(), p1.Navigation.NavigationStack[0]);
await p1.Navigation.PushModalAsync(new FoodMenu());
}
CodePudding user response:
Please try use the Navigation.PushModalAsync
like below:
private async void Button_Clicked(object sender, EventArgs e)
{
Application.Current.MainPage = new NavigationPage(new FoodMenu());
NavigationPage p1 = new NavigationPage(new LoginPage());
p1.Navigation.InsertPageBefore(new LoginPage(), p1.Navigation.NavigationStack[0]);
await p1.Navigation.PushModalAsync(new FoodMenu());
}