Xamarin.Forms - Display MasterPage first when using MasterDetailPage

Xamarin.Forms library is providing a MasterDetailPage which can be used to present both general information about data (which is called Master) and detailed information about any data item called Detail.


You can easily set both views by using the following code.

[gist id="6f4b735983ce16573883" file="RegularApproach.cs"]

Within your platform specific project you've of course to use the MainView in order to define the stat view. See this sample for iOS

[gist id="6f4b735983ce16573883" file="AppDelegate.cs"]

But with this solution the App will always display the detail view as default which may be a little confusing for users. Starting to the master view can easily be achieved by changing the code to the following

[gist id="6f4b735983ce16573883" file="MasterViewFirstApproach.cs"]

As you can see it's pretty easy to ensure that MasterView is presented instead of DetailView.


comments powered by Disqus