[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Initialize Component not declared

Posted on 2014-08-12
6
Medium Priority
?
273 Views
Last Modified: 2014-11-12
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?
0
Comment
Question by:Dodsworth
  • 3
  • 3
6 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 40257104
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?
0
 
LVL 1

Author Comment

by:Dodsworth
ID: 40257900
<phone:PhoneApplicationPage
    x:Class="PT.MainPage"

---------------------------------------------------------
Namespace PT

    Partial Public Class MainPage
        Inherits PhoneApplicationPage

        ' Constructor
        Public Sub New()
            InitializeComponent()
0
 
LVL 96

Accepted Solution

by:
Bob Learned earned 2000 total points
ID: 40258420
Gotcha: VB.NET classes and namespaces in XAML
http://paulstovell.com/blog/wpf-vbnet-xaml

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

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

 
LVL 1

Author Comment

by:Dodsworth
ID: 40258531
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
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 40258801
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.
0
 
LVL 1

Author Comment

by:Dodsworth
ID: 40268145
I changed the NameSpace name and that made it clearer to see what was going on!
0

Featured Post

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
In real business world data are crucial and sometimes data are shared among different information systems. Hence, an agreeable file transfer protocol need to be established.
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question