Thursday, April 15, 2010

TemplateBinding and the Visual Studio 2010 WPF Designer

I upgraded to Visual Studio 2010. I was looking forward to the improved WPF designer. However, when I converted one of my projects I found that my WPF windows would not display properly. My windows that displayed properly in the VS2008 WPF designer were not displaying in the VS2010 WPF designer. Compiling and running worked fine in both. It was simply the designer complaining.

In VS2010, the designer complained about the window: "An error occurred while finding the resource dictionary."

In VS2010, the resource dictionary complained: "The type 'TemplateBinding' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built."

I found that my old resource dictionary had this default XML namespace for the XAML:
xmlns="http://schemas.microsoft.com/netfx/2007/xaml/presentation"

I found that a new resource dictionary created in VS2010 uses this default XML namespace:
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

Replacing the default namespace in my old resource dictionary solved the problem.

Hope this helps you!

No comments:

Post a Comment