title: Show "Back to Menu" Button in iOS NavigationBar with Xamarin.Forms
body: <p>I'm trying to build a cross-platform app using C# and Xamarin.Forms. It contains a slide-out menu implemented in form of a <code>MasterDetailPage</code>. While on Android there is a button with the app icon in the top left corner, which toggles the slide-out page, there is no such navigation bar item on iOS.</p>
  
  <p>I broke it down to the following minimum example derived from the Xamarin solution template "Blank App (Xamarin.Forms Shared)" and replacing the implementation of the <code>App</code>-class:</p>
  
  <pre class="lang-cs prettyprint-override"><code>public class App
  {
      static MasterDetailPage MDPage;
  
      public static Page GetMainPage()
      {
          return new NavigationPage(
              MDPage = new MasterDetailPage {
                  Master = new ContentPage {
                      Title = "Master",
                      Content = new StackLayout {
                          Children = { Link("A"), Link("B"), Link("C") }
                      },
                  },
                  Detail = new ContentPage { Content = new Label { Text = "A" } },
              });
      }
  
      static Button Link(string name)
      {
          var button = new Button { Text = name };
          button.Clicked += delegate {
              MDPage.Detail = new ContentPage { Content = new Label { Text = name } };
              MDPage.IsPresented = false;
          };
          return button;
      }
  }
  </code></pre>
  
  <p>The solution as well as resulting screenshots can be found at <a href="https://github.com/perpetual-mobile/FormsMenuIcon" rel="nofollow noreferrer">GitHub</a>.</p>
  
  <p>My idea was to add such a "menu" or "back" button in the iOS-specific code modifying the <code>window.RootViewController.NavigationController.NavigationBar</code> within the <code>AppDelegate</code> class. But <code>window.RootViewController.NavigationController</code> is <code>null</code>.</p>
  
  <p>Replacing the return type of <code>GetMainPage()</code> by <code>NavigationPage</code> instead of <code>Page</code> does not help.</p>
  
  <p>I could add toolbar items via <code>MDPage.ToolbarItems.Add(...)</code>, but they appear in the top <em>right</em> corner.</p>