This project is read-only.

Xaml Parse Exception

Jul 27, 2010 at 11:11 AM


I was using these themes in my application and they were working just fine, but I converted my project into VS 2010 and now I get an exception trying to apply any theme.  (XamlParseException: System.Windows.Baml2006.TypeConverterMarkupExtension)

Does anybody knows why is this happening or how to solve the problem?

Thanks in advance!



Jul 27, 2010 at 11:36 AM

Does it make a difference if you change the target framework in your project properties from 4 back to 3.5?

Jul 27, 2010 at 12:37 PM

I can't do that! I've changed "supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" for "supportedRuntime version="v3.5" sku=".NETFramework,Version=v3.5" in my app.config and I can't even run the project. I'll have to try something else...

But thanks anyway!

Jul 27, 2010 at 3:35 PM
I'm using these themes successfully through a vs2010 project with a target framework of 3.5. Can you explain why you can't?
Jul 28, 2010 at 10:25 AM
Edited Jul 28, 2010 at 10:26 AM

I don't know why I can't change the supportedRuntime version, but it doesn't matter. Nothing to do with the VS2010. It's not because I converted the project to 2010 but because I changed the way I'm calling to the function ApplyTheme.

The sample application always uses ApplyTheme(this ContentControl control, string theme) to apply the theme and never uses ApplyTheme(this Application app, string theme).

The problem is that I'm always using the ApplyTheme(Application,theme) because I'm not using the ComboboxSelectedItemChanged to apply the theme, I'm using a button with a command and a command parameter(theme) and because I need to apply the theme to all my application.


The button calls to a function like that:

    private void AplicaTheme(object theme)
        catch (Exception ex)




PS- Thanks again Nobster and excuse me for my broken english!

Jul 28, 2010 at 10:42 AM

Okay so you've created an extension method "ApplyTheme" to apply the styles globally. This shouldn't really make a difference, and the error "XamlParseException" would indicate its an issue in the raw xaml anyway. Have you made changes to the xaml? What is the body of the ApplyTheme method. I use the following code, where filename is the path to the theme file to load e.g "C:\ExpressionDark.xaml"

//Initialize Resource Directory.
ResourceDictionary skin = new ResourceDictionary();

 //Set new source.
skin.Source = new Uri(filename, UriKind.Absolute);


Jul 28, 2010 at 1:43 PM

Thank you very much!!!

Now Is working perfectly!!! Good job!!!

Thanks again!!!