title: How to Change MainPage in xamarin forms at runtime?
body: <p>In xamarin forms,RootPage with master detail Layout.  My task is to  show that page after user successful login. I am using azure mobile service for login. I spend more time to get result.I saw some other solutions but those solution does not render master detail as expected.Finally i got  the solution.</p>
  
  <p>Here is the code in app.cs </p>
  
  <pre><code>public App()
      {
  
       Client = new MobileServiceClient("your azure url", "your master key");
          LoadMainPage();
  
      } public void LoadMainPage()
      {
          if (Client.CurrentUser == null)
          {
              MainPage=new NavigationPage(new SplashPage());
          }
          else
          {
              MainPage = new RootView();;
          }
  
  
      }
  </code></pre>
  
  <p>In Login page </p>
  
  <pre><code> async void  OnLoginClicked(object sender, EventArgs args)
      {
          MobileServiceUser user;
  
          try
          {
              user = await DependencyService.Get&lt;IMobileClient&gt;().LoginAsync(MobileServiceAuthenticationProvider.Facebook);
              Application.Current.MainPage=new RootView();
              await Navigation.PopToRootAsync();
  
          }
          catch (InvalidOperationException ex)
          {
              if (ex.Message.Contains("Authentication was cancelled"))
              {
                  //messageLabel.Text = "Authentication cancelled by the user";
              }
          }
          catch (Exception ex)
          {
            //  messageLabel.Text = "Authentication failed";
          }
  
      }
  </code></pre>