I have an issue when I create a new Custom Control in VS2015. Indeed, it generates a Themes/Generic.xaml file containing the error
"The name CustomControl does not exist in the namespace MyNamespace".
Of course, the custom control is located in the namespace MyNamespace
and in the xaml file the local variable is well defined :
xmlns:local="clr-namespace:MyNamespace"
After some investigation, it appears it's a well-known bug with IntelliSense, and a simple restart should fix the problem, but it doesn't.
I tried
- Comment and uncomment code
- Close / Reopen the file
- Restart Visual Studio
- Delete all folders in
%LOCALAPPDATA%\Microsoft\VisualStudio\14.0\Designer\ShadowCache
- Switch between Debug/Release Configurations...
The error still there.
I didn't touch any line code generated by the IDE for the CustomControl, so maybe I missed something ?
using System.Windows;
using System.Windows.Controls;
namespace MyNamespace
{
public class CustomControl : Control
{
static CustomControl()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(CustomControl), new FrameworkPropertyMetadata(typeof(CustomControl)));
}
}
}
Thank you.