locked
[Forms] Master Detail Page generation is broken RRS feed

  • Question

  • User275639 posted

    The MasterDetailPage doesn't seem to work at all in Visual Studio Community 2015 Version 14.0.25431.01 Update 3. Upon adding a MasterDetailPage and compiling I get the following error: "Severity Code Description Project File Line Suppression State Error CS0101 The namespace '' already contains a definition for 'Page1' dsBudgetMobile C:\Users\SonicD007\documents\visual studio 2015\Projects\\\\obj\Debug\.Page1.xaml.g.cs 17 Active "

    In this case I simply left the default name for the class which was Page1. Anyone know if this is a known bug or if there's a fix/workaround for this? I'm trying to use this page to have a side menu across all mobile platforms.

    Thanks.

    Thursday, February 23, 2017 3:31 PM

Answers

  • User120906 posted

    Also there are bugs in Bugzilla for both of these:

    https://bugzilla.xamarin.com/showbug.cgi?id=53020 https://bugzilla.xamarin.com/showbug.cgi?id=53021

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Wednesday, March 8, 2017 3:15 AM

All replies

  • User304987 posted

    Same issue here.

    Help please!

    Saturday, March 4, 2017 11:51 AM
  • User305194 posted

    Same here.. fix would be really appreciated!

    Sunday, March 5, 2017 12:28 PM
  • User120906 posted

    @SonicD007 Yes it would appear that the template is not quite right.

    Here is a workaround... that seems to work for me.

    Let's say I've created an app called MyApp.

    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: eg. MainPage = new MyApp.Page1()

    Wednesday, March 8, 2017 1:58 AM
  • User120906 posted

    Also there are bugs in Bugzilla for both of these:

    https://bugzilla.xamarin.com/showbug.cgi?id=53020 https://bugzilla.xamarin.com/showbug.cgi?id=53021

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Wednesday, March 8, 2017 3:15 AM
  • User278011 posted

    Thank you @KymPhillpotts.3866 Worked for me!!

    Wednesday, April 12, 2017 5:13 PM
  • User278011 posted

    @"KymPhillpotts.3866" In order to complement your information, I also needed to change the namespace in the "...g.cs" files. Maybe just happened with me.

    Wednesday, April 12, 2017 5:56 PM
  • User170628 posted

    I also faced to this issue and finally I found it happens because a namespace mismatching.

    Then I fixed the issue and I have wrote an article about it.. Please follow this link... to fix the issue...

    https://xamarinsharp.com/2017/05/06/error-adding-masterdeail-page-the-namespace-samplemasterpage-already-contains-a-definition-for-masterpage-in-xamarin-forms-how-to-fix-it/

    Thanks !

    Saturday, May 6, 2017 2:14 PM
  • User170628 posted

    But Visual Studio 2017 update 15.2 with Xamarin for Visual studio 4.5 has solved this issue. So please download the latest version of VS 2017. :)

    References: https://visualstudio.com/en-us/news/releasenotes/vs2017-relnotes#15.1.26430.04 https://developer.xamarin.com/releases/vs/xamarin.vs4/xamarin.vs4.5/

    Sunday, May 14, 2017 4:18 AM