Initialize Component not declared

I have a XAML page with code behind that works fine... Until I wrap the code behind in a Namespace.  Then I get Initialize Component not declared.

I've encountered this before when copying in code from another project, but it's usually fixed by ensuring the XAML x:Class matched the Private Partial Sub name in code behind.

Any ideas?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bob LearnedCommented:
That error does mean that it can't find the other part of the partial class.  Can you show just the beginning of the XAML declaration, and the top of the code-behind?
DodsworthAuthor Commented:

Namespace PT

    Partial Public Class MainPage
        Inherits PhoneApplicationPage

        ' Constructor
        Public Sub New()
Bob LearnedCommented:
Gotcha: VB.NET classes and namespaces in XAML

One difference between XAML in a C# project and VB.NET projects is in specifying the x:Class of your XAML root element

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

DodsworthAuthor Commented:
hmm.. In Windows Phone the x:Class is


and in my example the PT Namespace is the same as the AppName.

I've managed to get rid of one 'Not Declared' error on the MainPage by specifying


Which I assume equates to


But the same pattern fails in the App.xaml
Bob LearnedCommented:
I generally don't like for namespaces names to conflict with class or application names.  As a C# developer, I am not used to these oddities with WPF.
DodsworthAuthor Commented:
I changed the NameSpace name and that made it clearer to see what was going on!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.