title: How to add two pages in xamarin.forms shell in code behind
body: <p>I want to add dynamically two pages (ShellContents) into my LoginShell, but <code>LoginShell.Current</code> is always null?</p>
  
  <pre><code>    {
          public LoginShell(string page = null)
          {
              InitializeComponent();
  
  
              ShellItem si = new ShellItem();
  
  
              LoginShell.Current.Items.FirstOrDefault().Items.Add(new ShellContent {ContentTemplate = new DataTemplate(typeof(SignUpPage))});
  
          }
      }
  </code></pre>
  
  <p>LoginShell.Current is a read-only property.</p>
  
  <p><strong>Update</strong></p>
  
  <p>I implemented following code for my StartUpShell class:</p>
  
  <pre><code>    public partial class StartUpShell : Shell
      {
          public StartUpShell(string page)
          {
              InitializeComponent();
  
              ShellContent content;
  
              if(page == nameof(SignUpPage))
              {
                 content = new SignUpPage();
              }
              else if(page == nameof(LoginPinPage))
              {
                  content = new LoginPinPage();
              }
              else
              {
                  content = new SignUpPage();
              }
  
              ShellSection shellSection = new ShellSection();
              shellSection.Items.Add(new ShellContent() { Content = content });
  
              CurrentItem = shellSection;
          }
  </code></pre>
  
  <p>but on when I set content variable it crashes with a message: 
  <code>ShellContent Content should be of type Page. Title , Route D_FAULT_ShellContent4</code> </p>