Monday, July 14, 2014

Resolving the error "The name xxx does not exist in the namespace "clr-namespace:XXX" in Visual Studio 2012 for Windows Phone

In Windows Phone 8 development, it is possible to use the local project's public classes in a XAML file. But the local project's namespace has to be included in the XAML file by typing in the following:
xmlns:local="clr-namespace:Binding".
Here Binding refers to the namespace used by the class in the local project I want to use.

Then to use the local namespace in the XAML file to declare a class, I should do the following:
<local:MyData x:Key="MyData"
AppTitle="Real Estate Explorer" />

Everything looks fine, but the Visual Studio Intellisense underlines the local:MyData reference with the following error message:
The name "MyData" does not exist in the namespace "clr-namespace:Binding"

An example is shown below:

I could not figure out how to resolve the error; I did everything as described in the documentation. Eventually, I did a Build Solution (F7) on the project. After that, Visual Studio did not complain about the namespace anymore, as shown in the screenshot below.
 

No comments:

Related Posts with Thumbnails