This is an occasional, recurring problem for me. I will make an arbitrary change to my project and in turn VisualStudio will give me 96 namespace errors. They're almost always errors with my XAML namespace declarations, but I know those classes exist in the namespace.
I have cleaned & built, and rebuilt many times, as well as restarting VS with no success.
Examples:
In this case, it is the class ExpandedConverter which "does not exist" in the namespace clr-namespace:NineGridViewer. One possible issue could be that I have organized my project into folders, for example the converters are all in IValueConverters folder and MainWindow is in Views folder. But the namespaces have not changed
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:nineGridViewer="clr-namespace:NineGridViewer"
Title="NineGridViewer" Height="900" Width="900">
<Window.Resources>
<nineGridViewer:ExpandedConverter x:Key="ExpandedConverter"/>
<nineGridViewer:StringToBrushConverter x:Key="StringToBrushConverter"/>
</Window.Resources>
namespace NineGridViewer {
/// <summary>
/// Binds the isExpanded property of the UI Expanders to the ViewModel's CurrentExpanded property
/// </summary>
public class ExpandedConverter : IValueConverter
{
public object Convert(object value, System.Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
string input = value as string;
string param = parameter as string;
if (String.IsNullOrEmpty(input) || String.IsNullOrEmpty(param))
{
throw new ArgumentNullException();
}
return Equals(input, param);
}
public object ConvertBack(object value, System.Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
return parameter;
}
}
}