Just recently we had some problems compiling XAML files in our Silverlight project. The files had been copied from one project to another class library and after renaming and refactoring the namespaces we still got compilation errors. The error we got was something like this:
The name ‘xxxxx’ does not exist in the current context
Visual Studio was complaining about code in our codebehind file. Apparently it could not find the controls that we had in our XAML although we were absolutely sure that they were there…
It turned out to be quite simple to solve. When we copied the files between projects Visual Studio changed the build action to “ApplicationDefinition”. This is clearly not right (may be a bug in VS2010). User controls should have a build action set to “Page” like this:
I hope this helps!
Comments on: "Problems with compiling XAML in Silverlight" (2)
Thanks for the info. I was wondering why XAML files are aren’t compiling when transferred to another project.