tags:

views:

242

answers:

1

In my project, I have an assembly that defines a set of WPF controls. I want to be able to use them without referencing explicitly the assembly in the XAML code. That's why I'm using custom XmlnsDefinition:

[assembly: XmlnsDefinition(
    "http://schemas.microsoft.com/winfx/2006/xaml/presentation",
    "MyProject.Common.WpfLibrary.Markup")]
[assembly: XmlnsDefinition(
    "http://schemas.microsoft.com/winfx/2007/xaml/presentation",
    "MyProject.Common.WpfLibrary.Markup")]
[assembly: XmlnsDefinition(
    "http://schemas.microsoft.com/winfx/2008/xaml/presentation",
    "MyProject.Common.WpfLibrary.Markup")]

It works like a charm in VS2008. I can use controls defined in the Markup namespace directly. However Blend doesn't seem to like it, and give my an "Invalid XAML" error wherever I try to use a control.

Do you have a workaround ?

A: 

You should use XmlnsDefinitionAttribute only one time for each CLR-Namespace in an assembly. Use XmlnsCompatibleWithAttribute for the 2nd and 3rd assignment.

Matthias Auswöger