Ron

Ron

  • NA
  • 44
  • 64.4k

Namespace can not be found

Apr 16 2012 11:07 AM
I'm new to WPF and I have what I believe to be a basic question:

I have the following code in the App.xaml file (simplified for clarity):

<Application x:Class="MyApp.App"
             ...
             xmlns:local="clr-namespace:OpMenu_Image_Convert">
   
    <Application.Resources>

        <Style...>
            <Setter Property="HeaderTemplate">
                <Setter.Value>
                    <DataTemplate>
                        <StackPanel ...>
                            <Image Source="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=     {x:Type TreeViewItem}}, Path=Header,
                               Converter={x:Static local:HeaderToImageConverter.Instance}}" />
       <Style />
<Application />

Also I have a file called OpMenu_Image_Convert.cs which contains this code:

using ...

namespace OpMenu_Image_Covert
{
    #region HeaderToImageConverter

    [ValueConversion(typeof(string), typeof(bool))]
    public class HeaderToImageConverter : IValueConverter
    {
        public static HeaderToImageConverter Instance = new HeaderToImageConverter();
        ...
   }
}

I know I've left out alot of code, but this was all tested and working until I changed the name of the namespace (and the file in which it's contained) to its new value of OpMenu_Image_Convert. Now when I attempt to run this app, I get an error: 

The type or namespace name 'OpMenu_Image_Convert' could not be found (are you missing a using directive or an assembly reference?)

Any insight would be appreciated.







Answers (4)