The type 'UserControl' does not support direct content

For anyone who having this problem on Visual Studio 2015, try to add (if it's not already added) System.Xaml reference to your project. Visual Studio simply fails to show reference error.


Add System.Xaml and UIAutomationProvider references to your project, after that clear solution and then build again


Add System.Xaml and UIAutomationProvider references, and then restart Visual Studio solve the problems.


In VS2017 (15.3.5) this problem occurs if the base UserControl/Window of the UserControl your are editing is in the same library/exe. After starting VS it is fine for a few minutes, then something in the background hiccoughs and the entire XAML file is blue-squiggled. Compile and it goes away, start typing and it's instantly back. Intellisense still works, but it makes the XAML editor almost unusable.

The only way to fix it is to move base classes into another library.