Take the 2-minute tour ×

When I try using a Name="id" and\or x:name="id" I get a compiler error:

The Type 'MyName' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built.

When I don't have this specified my control runs just fine. Any suggestions?

share|improve this question
Can you provide an example of the XAML causing the problem? –  Christopher Bennage Nov 17 '08 at 18:51
add comment

2 Answers

up vote 2 down vote accepted

Well, first of all the right syntax is x:Name, although Name by itself usually (but not always) works too.

Does the x:Class on your root-level element match the name (and namespace!) of your code-behind file? I know that some versions of Blend and VS didn't insert the default namespace correctly, and of course if you've changed it from the default you'll need to make sure you've changed the other file as well.

share|improve this answer
the issue is what namespace is active at the time the compiler is building the symbol list. If the "x:" namespace is not active (for instance if your xaml contains a custom control that was declared in a namespace with MyNameSpace:MyControlName) then the name is not found and the control is anonymous. You can work around this with x:name, or by fully importing MyNameSpace. –  AnotherParker Feb 6 '13 at 19:52
add comment

I've run into this before and believe it's a compiler bug. I ended up just sticking a named ContentControl in my XAML and sticking the user control in it from the code behind. Hopefully someone can share an actual fix for this.

share|improve this answer
add comment

Your Answer


