Loads of XAML errors

Dec 1, 2015 at 10:10 AM
I have downloaded and installed the latest version of CODE FW. I am admittedly new to WPF and XAML, but I have chosen this framework as it closely resembles my work with ASP.NET and Javascript. I am using VS 2012 Ultimate and no matter how I load the framework and it's components, I get loads of errors in the XAML. Some of the errors do not affect how the application runs, they are just more of an annoyance, but others will not allow the app to run. It should be noted that I have followed a couple of the tutorials on Codeplex in an effort to solve my issue myself.

Examples of the issues I'm experiencing:

This Line:
<mvvm:ApplicationEx x:Class="EzPayApp.App"
Produces this error:

The name "ApplicationEx" does not exist in the namespace "clr-namespace:CODE.Framework.Wpf.Mvvm;assembly=CODE.Framework.Wpf.Mvvm". C:\Users\Dan\AppData\Local\Temporary Projects\MyProject\App.xaml

When I tried to follow the theme modification tutorial:

This Line:
<mc:ShellTabControl HomeTitle="Start" Grid.Row="1"...>
Produces this error:

The tag 'ShellTabControl' does not exist in XML namespace 'clr-namespace:CODE.Framework.Wpf.Theme.Metro.Controls'. Line 65 Position 14. C:\Users\Dan\AppData\Local\Temporary Projects\MyProject\Themes\Metro\Metro-Shell.xaml


These issues may have been addressed in a previous post, or on another thread, but I have been unable to find a solution. I apologize if this has been solved before and I just can't find it. Any help will be greatly appreciated.

Dec 1, 2015 at 4:05 PM
Hi dajperry,

Pasting your XAML block into one of my apps builds and runs without issue so, poking around I found a number of reports of similar problems. Google "name does not exist in the namespace". Many reference VS2012 specifically and recommend simply restarting Visual Studio or checking the build configuration (x86, x64 etc.).
Dec 2, 2015 at 2:20 PM
Thanks Sparkamundo, I'm glad it's not just me. Strange that this issue hasn't been addressed though, I have no idea what my layout looks like without starting the app. Could be worse I guess.
Jan 19, 2016 at 2:35 PM
Whenever you see an error like this in a XAML app, it has to do with namespaces not available for some reason. For instance, if the mvvm namespace isn't recognized, then it won't find the ApplicationEx class (mvvm:ApplicationEx). There are several reasons why this might happen.

In the case of the mvvm namespace in App.xaml, the actual declaration of the namespace (xmlns:mvvm="clr-namespace:CODE.Framework.Wpf.Mvvm;assembly=CODE.Framework.Wpf.Mvvm") looks right to me. It basically says that the mvvm namespace points to the CODE.Framework.Wpf.Mvvm .NET namespace in the CODE.Framework.Wpf.Mvvm.dll file. So then the question becomes: Is that file part of your references? (Did you allow the wizard to download the files for you?). Or, could it maybe be a version that doesn't work with VS2012 (could be targeting a newer framework version). You should be able to tell when you expand your references node. If there are any problems in there, you should be able to see that immediately with the exclamation point icons.

For other XAML files, the problem could be that the relative reference changes. For instance, the mc namespace in the original framework source may point to the current assembly (in which case, the namespace declaration in the file doesn't include the DLL name). So you would have to change that.

Note: I like using ReSharper for a lot of this. It does an excellent job helping you find incorrect XAML namespace declarations and fix them up for you. (Among many many other features).