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…

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"

2) I also noticed that in the Page1Master.xaml.cs it is incorrectly referencing the MenuItems.
It says Page1MenuItems = new ObservableCollection...
Change that to be just
MenuItems = new ObservableCollection...

No you can go to your App.Xaml.xs and set the Page1 as the master page:
MainPage = new MyApp.Page1()




Also there are bugs in Bugzilla for both of these:



comments powered by Disqus


Recent Tweets

Maybe resolved itself, after resetting emulator and couple restarts - will let you know
@MillerMark A few weeks ago you tweeted that something huge/incredible was coming....what is/was it? (I am hoping s……
Oddly, it won't hit breakpoints in XF .net standard 2 project now either
@JamesMontemagno Updated to 15.7 preview 2 Visual Studio - now having lots of odd thread issues when starting debug……