“The property ‘_UnknownContent’ does not exist…” What?


I was working on a custom Control the other day and that had its own XAML file.  I had it all coded up, but when I went to build it, it gave me the following two errors:

Error    6    The property '_UnknownContent' does not exist on the type 'ResourceDictionary' in the XML namespace 'http://schemas.microsoft.com/winfx/2006/xaml/presentation'.    C:\Source\Controls\MyControl.xaml

Error    7    The type 'List`1' is inside a ResourceDictionary and does not have a key.    C:\Source\Controls\MyControl.xaml

Unfortunately this in not a very helpful error message.  I’m embarrassed to say how long it took me to figure out the problem, so I’m not going to tell you.  But I will tell you how to solve this if you run into it.  Its surprisingly simple:

1. Right-click the file in “Solution Explorer”.

2. Change the “Build Action” to “Resource”.

3. Save the project and rebuild.

So there you have it, an easy solution to an obnoxious, uninformative error.

Comments (2)
  1. uberdemo says:

    Thank you for posting this Casey!

  2. Jamison says:

    My custom control was working until I added a service reference to the app project, which somehow changed the setting in question.  Thanks for posting this, otherwise I would have been all day trying to figure this out.

Comments are closed.

Skip to main content