Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The tag 'XXX' does not exist in XML namespace 'clr-namespace:YYY'

Tags:

wpf

xaml

I have implemented a converter to convert Int32 to String to be able to binding a property to a textBox.

I implement this converter in the namespace MyApp.Converters and it is called Int32ToStringConverter.

Then, in my axml I add the reference to my converter as follow:

<Window x:Class="MusicaDB.Views.PrincipalView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:i="namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
        **xmlns:converter="clr-namesapce:MyApp.Converters, aseembly=MyApp**">

Later, in windows.Resources I have:

<Window.Resources>
        <**converter:Int32ToStringConverter** x:Key="Int32ToStringConverter" />
</Window.Resources>

I get the error that the tag Int32ToString converter does not exist in the namespace MyApp.Converters,assembly=MyApp.

I have the project in the local hard drive, in the project properties, the destination .NET is framework 4.0, not framework 4.0 client profile and I try to clear the solution and recompile but the problem persists.

Mainly, this is the two solutions that I always find, but don't resolve my problem.

like image 478
Álvaro García Avatar asked Feb 05 '12 17:02

Álvaro García


3 Answers

Another possible solution to this problem is that you're not using the same version of .Net in your project and your library.

like image 88
Dan Balthaser Avatar answered Oct 03 '22 06:10

Dan Balthaser


Three fixes to make here:

  1. No spaces -> xmlns:converter="clr-namesapce:MyApp.Converters,aseembly=MyApp"
  2. No misspellings -> xmlns:converter="clr-namespace:MyApp.Converters,assembly=MyApp"
  3. Right delimiters -> xmlns:converter="clr-namespace:MyApp.Converters;assembly=MyApp"

From the the documentation:

Note that the character separating the clr-namespace token from its value is a colon (:) whereas the character separating the assembly token from its value is an equals sign (=). The character to use between these two tokens is a semicolon. Also, do not include any whitespace anywhere in the declaration.

like image 30
H.B. Avatar answered Oct 03 '22 04:10

H.B.


I am exploring as to why this is happening, but if your converter is in the main assembly, removing the assembly= from your xmlns:converters tag should remove that build error.

like image 31
eppdog Avatar answered Oct 03 '22 04:10

eppdog