Dodsworth
asked on
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?
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?
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?
ASKER
<phone:PhoneApplicationPag e
x:Class="PT.MainPage"
-------------------------- ---------- ---------- ---------- -
Namespace PT
Partial Public Class MainPage
Inherits PhoneApplicationPage
' Constructor
Public Sub New()
InitializeComponent()
x:Class="PT.MainPage"
--------------------------
Namespace PT
Partial Public Class MainPage
Inherits PhoneApplicationPage
' Constructor
Public Sub New()
InitializeComponent()
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
hmm.. In Windows Phone the x:Class is
<AppName>.<PageName>
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
x:Class="PT.PT.MainPage"
Which I assume equates to
<AppName>.<NameSpaceName>. <PageName>
But the same pattern fails in the App.xaml
<AppName>.<PageName>
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
x:Class="PT.PT.MainPage"
Which I assume equates to
<AppName>.<NameSpaceName>.
But the same pattern fails in the App.xaml
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.
ASKER
I changed the NameSpace name and that made it clearer to see what was going on!