Silverlight 2 error: "The type or namespace Page could not be found"
Last post 05-06-2008 2:41 PM by peterdungan. 7 replies.
Sort Posts:
05-02-2008 9:28 AM
Silverlight 2 error: "The type or namespace Page could not be found"

This bit of code in app.xaml.cs causes the error: 

private void Application_Startup(object sender, StartupEventArgs e)

{ // Load the main control

this.RootVisual = new Page(); }

Which is strange because I think that is part of the template - so maybe I have set things up incorrectly. I have using System.Windows.Browser; I thought it was because there was no reference to System.Web at first, but that can't be used in a Silverlight app I discovered.

Any help appreciated.

Thanks

peterdungan

Joined on 10-12-2006
Dublin, Ireland
Posts 7
05-02-2008 10:49 AM
Re: Silverlight 2 error: "The type or namespace Page could not be found"

If it's a runtime exception, I think it's a xml namespace declaration in a xaml file that raise the exception. Maybe you forgot to add the assembly part.
Ex:

<UserControl xmlns="http://schemas.microsoft.com/client/2007"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:ucaya="clr-namespace:Ucaya.Silverlight.Controls;assembly=Ucaya.Silverlight"   

Thierry Bouquain
Ucaya
http://www.ucaya.com

thierry.bouquain

Joined on 05-06-2007
Nantes, France
Posts 224
05-02-2008 12:57 PM
Re: Silverlight 2 error: "The type or namespace Page could not be found"

Thanks for your reply. 

It's a compile-time error.

I don't think there is an assembly reference. Do you always need one? This is my first time looking at silverlight and this is just copied and pasted code from an example.

 

peterdungan

Joined on 10-12-2006
Dublin, Ireland
Posts 7
05-02-2008 7:45 PM
Re: Silverlight 2 error: "The type or namespace Page could not be found"

The code is looking for a UserControl names Page. Do you have a Page.xaml and/or Page.xaml.cs in your project?  It should have been created for you when you ran the Silverlight Application wizard.

timothybinkley

Joined on 03-06-2008
Colorado Springs, CO
Posts 3
05-03-2008 5:11 AM
Re: Silverlight 2 error: "The type or namespace Page could not be found"

The two files are there yes.

 

peterdungan

Joined on 10-12-2006
Dublin, Ireland
Posts 7
05-05-2008 1:20 AM
Re: Silverlight 2 error: "The type or namespace Page could not be found"

Hi:

peterdungan:

Thanks for your reply. 

It's a compile-time error.

I don't think there is an assembly reference. Do you always need one? This is my first time looking at silverlight and this is just copied and pasted code from an example.

  Could you tell us how do you create new Silverlight projects? If you're using wizard to do so you don't have to copy and paste any code.

Regards

Sincerely,
Allen Chen
Microsoft Online Community Support

Please remember to mark the replies as answers if they help and unmark them if they provide no help.

Allen Chen – MSFT

Joined on 03-16-2007
Posts 717
05-06-2008 2:11 PM
Re: Re: Silverlight 2 error: &quot;The type or namespace Page could not be found&quot;

I just select new project and then silverlight in VS 2008.

I'm getting this same error on another small project on the same machine. Got a couple of other things working fine in the meantime.

peterdungan

Joined on 10-12-2006
Dublin, Ireland
Posts 7
05-06-2008 2:41 PM
Marked as Answer
Re: Re: Re: Silverlight 2 error: &amp;quot;The type or namespace Page could not be found&amp;quot;

Fixed now. It's happening when the namespace is specified incorrectly I think. Thanks for the replies

 

peterdungan

Joined on 10-12-2006
Dublin, Ireland
Posts 7