Xamarin Forms Master Detail Template

Xamarin Forms Master Detail Template
The current Xamarin Forms master detail template is broken. You will get an error like Error CS0101 The namespace 'already contains a definition for. - March 14, 2017

Rest of the Story:

The current Xamarin Forms master detail template is broken. You will get an error like Error CS0101 The namespace 'already contains a definition for

The fix..(thank you Kym Phillpotts)

  1. It would appear, that the added pages have the wrong namespace. So change the namespace on the added pages
  • Page1.xaml.cs - change the Namespace to be just MyApp
  • Page1Detail.xaml.cs - Change the namespace to be just MyApp
  • Page1Master.xaml.cs - Change the namespace to be just MyApp
  • Page1MenuItem.cs - Change the namespace to "MyApp"
  1. I also noticed that in the Page1Master.xaml.cs it is incorrectly referencing the MenuItems. It says Page1MenuItems = new ObservableCollection...Change that to be justMenuItems = new ObservableCollection...

No you can go to your App.Xaml.xs and set the Page1 as the master page:

eg.MainPage = new MyApp.Page1()

image

Reference: https://forums.xamarin.com/discussion/89346/forms-master-detail-page-generation-is-broken

Also there are bugs in Bugzilla for both of these:
https://bugzilla.xamarin.com/show_bug.cgi?id=53020https://bugzilla.xamarin.com/show_bug.cgi?id=53021