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

Dinner time?
Retweeted by @dyardy These 10 companies control everything you buy
Retweeted by @dyardy LED bulbs contributed to a reduction of 570 million tons of carbon dioxide emissions in 2017—equivalent to closing……
I would like to update my profile/email address on Xamarin University. Where can I do this?