Sagar Patil
Sagar Patil

Reputation: 469

What is the solution for pushasync is not supported globally in xamarin forms?

I am working on xamarin forms, Where I am getting an error like pushasync is not supported globally on xamarin forms. Please find my code

 public App()
 {
    InitializeComponent();
    MainPage = new MSLogin();
 }

I am setting My login page as the main page. Once the user logged in successfully based on the user role I need to navigate to different Dashboards. I am using MasterPage as my template and how I am navigating user based on the role is

Application.Current.MainPage = new MainPage(); 
 if(role=="a")
 {
   Navigation.PushAsync(new Dashboard1());
 }
 else
 {
    Navigation.PushAsync(new Dashboard2()) 
 }

Already so many people got this error and solutions are also available but not working in my scenario. How to solve this?

Upvotes: 0

Views: 188

Answers (1)

Nikhil
Nikhil

Reputation: 3387

You need to include your Page inside NavigationPage to Support navigation.

So your code change would be :-

public App()
 {
    InitializeComponent();
    MainPage = new NavigationPage(new MSLogin());
 }

Kindly change this and it should work.

Upvotes: 2

Related Questions