The type 'Window' does not support direct content
I have a WPF solution built with VS 2015 composed of several projects. Suddenly I started receiving a warning in design mode stating the following:
The type 'Window' does not support direct content.
I understand how some controls do not support direct content, but System.Windows.Window
should. I get the same warning with UserControl
, and as far as I know, any other control that typically supports direct content.
Everything compiles and runs fine, but having the blue underlines through all of my XAML is bothersome. Has anyone else come across this?
Below is a screenshot:
Solution 1:
Make sure you reference System.Xaml. Clean and rebuild the project. Works on VS 2015 Update 1.
Solution 2:
At least in a WPF IronPython project, adding the System.Xaml
reference to the project solved the problem for me:
An important thing to note here is that adding seemingly any reference will make the problem go away temporarily -- until Visual Studio is restarted. System.Xaml
, on the other hand, appears to keep the problem at bay. I even tried removing the reference, whereafter the problem returned upon restarting Visual Studio.