Reputation: 2882
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?
Upvotes: 5
Views: 2415
Reputation: 13095
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.
Upvotes: 3
Reputation: 178810
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.
Upvotes: 0