The name "LayoutAwarePage" does not exist in the namespace

Answered The name "LayoutAwarePage" does not exist in the namespace

  • Tuesday, July 10, 2012 8:25 AM
     
      Has Code

    Hi,

    I have tired to add the LayoutAwarePage ,SuspensionManager to an existing windows 8 metro style application and i have got the error message in the title when i try to rewrite the pages to <common:LayoutAwarePage

    I have added these files to the Common directory with Add->Existing item

    The page new xaml layout starts with this:

    <common:LayoutAwarePage
        x:Class="AZX.MainPage"
        IsTabStop="false"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="using:AZX.Pages.Authentication"
        xmlns:common="using:AZX.Common"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        mc:Ignorable="d">

    Any idea what i do wrong ? I don't really want to create a new project from a template where all that stuff is there by default.

    Somebody can help me ?

    Thanks

All Replies

  • Tuesday, July 10, 2012 12:02 PM
     
     Proposed Has Code

    Check your layout page files and verify what namespace is used to declare LayoutAwarePage. You define common as

    xmlns:common="using:AZX.Common"

    but if the files are borrowed from a different project they may use another namespace.

  • Wednesday, July 11, 2012 5:44 AM
     
     
    I have put the files from the beginning to the Common folder and changed the namespace in the files to be" AZX.Common". I have tried many many times to rebuild, clear the project but nothing. The interesting part is when i want to use the files in other cs files i can import it without any problem, only with the xaml have problem. :(
  • Saturday, July 14, 2012 6:16 PM
     
     Proposed

    I also ran into the same problem..very irritating

    I closed all the tabs in the vs and reopened the xaml files again and that fixed this. Hope it helps.

    • Proposed As Answer by AtomBinary Saturday, August 25, 2012 12:29 AM
    •  
  • Sunday, July 15, 2012 2:14 PM
     
     Answered

    I'm not sure if you've already solved this or if my problem is the same, but here goes:

    I found the link below. In a nutshell the problem is not in the XAML but in the code page (in my case the MainPage.xaml.vb, for a VB app).

    I changed this:

    Public NotInheritable Class MainPage
        Inherits Page

    to this:

    Public NotInheritable Class MainPage

        Inherits LayoutAwarePage

    I don't really know C#, but the equivalent code seems to be:

    change:

    public sealed partial class BlankPage : Page

    to

    public sealed partial class BlankPage : LayoutAwarePage

    Link to the page I found that may have more detailed info:

    http://www.nogginbox.co.uk/blog/xaml-snapview

  • Thursday, July 19, 2012 7:58 AM
     
     

    After adding the files to the project a few times and refactoring the namespace helped. I guess the refactoring did the trick, but i'm not sure.

    Thanks for the ideas.

  • Sunday, July 29, 2012 6:10 PM
     
     
    I too ran into this problem and as Kamal said, by just closing all tabs and reopening the xaml files cleared the build error.
  • Wednesday, August 15, 2012 4:28 PM
     
     Proposed

    Hi,

    Try Rebuild solution (Ctrl + Alt + F7)

    • Proposed As Answer by IT_XIE Tuesday, December 04, 2012 7:49 AM
    •  
  • Saturday, August 25, 2012 12:29 AM
     
     
    Hahaha! Thanks!!! It worked
  • Friday, September 07, 2012 10:23 PM
     
     

    I have exactly the same problem. Tried everything, including several times total rebuild. No effect. Please help.

    Tried even procmon. It said that the <myrootnamespace>.winmd file is successfully opened.

    Tried to get clean code from source code control. No success.

  • Monday, September 24, 2012 3:17 AM
     
     
    i had the same problem...closed all tabs and rebuilt project...problem went away...sure wish the tool worked seamlessly so we did not have to waste time working around bugs in the dev environment...
  • Saturday, September 29, 2012 3:10 AM
     
     
    I removed the reference to the Bing Maps SDK and set the Platform Target back to Any CPU and it solved the problem for me.
  • Tuesday, October 02, 2012 2:23 PM
     
     
    Thanks Rick, this approach resolve the same problem I also encountered in the last few days.

    Abel

  • Friday, October 05, 2012 6:18 AM
     
     Proposed
    You have to rebuild the solution. I think this problem will be solved. 
    • Proposed As Answer by Saeed Siddik Friday, October 05, 2012 6:20 AM
    •  
  • Friday, October 05, 2012 9:08 AM
     
     

    In my case it didn't help.

    I did the following experiment:
    1. Create default project from Grid template (with default name App1);
    2. Add the following lines to the app.xaml.h right before the "namespace App1" line:
    namespace nnn
    {
    public ref class ccc sealed
    {
    };
    }
    3. Compile.
    4. Try to open the GroupedItemsPage.xaml file in the designer.
    Result:
    experienced that very failure.

    5. Commented these lines out, rebuilt and reopened the designer window.
    Result:
    the designer works.

    The text above is the fragment from my correspondence with Microsoft Technical Support.

    I had similar code in my project. Replacing the class header above with

    class ccc

    solved the problem.

    That is confirmed bug in the Visual Studio.

  • Tuesday, October 30, 2012 11:46 AM
     
     
    Yes, that worked for me.
    Thanks.
  • Tuesday, November 20, 2012 3:42 PM
     
     

    Rebuilding didn't work for me, I just closed the solution and reopened it, the error when away after that.

  • Tuesday, December 04, 2012 7:49 AM
     
     
    Thank U so much , it really works!!
  • Friday, December 21, 2012 5:07 AM
     
     

    Wow, this is a crazy issue that has been around for a long time.  Thank for everyone on this thread.  This is what worked for me:

    1.  Close all documents

    2.  Clean the solution

    3.  Close VS 2012

    4.  Open VS 2012

    5.  Rebuild the Solution

    6.  Open an .xaml file 

    (Update:  Just looked at my other monitor and the error is back after a minute or so.  What the heck?)



    Scott Lock, MVP C# Principal Consultant - Excella Consulting President, Capital Area .Net Users Group (Caparea.net)

  • Monday, December 24, 2012 2:58 AM
     
     
    I tried Scott's instructions and it worked for me also.  Thanks.
  • Monday, December 24, 2012 3:07 AM
     
     
    Nope, it came back.
  • Monday, April 22, 2013 6:02 AM
     
     

    I have the same problem too.

    I've tried to clean, rebuild, restart VS, restart OS.

    I've tried to check every class that I wrote or imported, put them into the ProjectRoot or ProjectRoot .Common namespace.

    I've tried to edit the MODIFIER of Class(SuspensionManager), "internal" to "public"。

    I've tried to close VS & delete the *.suo file related with the solution, then start VS & clean & rebuild.

    All of these gives me nothing!

    The only way I can do to see the design view is to create a new project with grid view, & then add my pages created before. But after a few operations(I don't know which step), It comes out again.

    P.S. In my solution, the page directly inherited from Class “Page ”working well.  Just the page inherited from LayoutAwarePage has the problem.

    <embed height="0" hidden="true" id="ciba_grabword_plugin" type="application/ciba-grabword-plugin" width="0" />