Custom XmlnsDefinition with Blend

In my project, I have an assembly that defines a set of WPF controls. I want to be able to use them without specifying the assembly directly in the XAML code. This is why I am using a 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 directly use the controls defined in the Markup namespace. However, Blend doesn't seem to like it and gives an "Invalid XAML" error everywhere I try to use the control.

Do you have a workaround?

+2


source to share


1 answer


You must use the XmlnsDefinitionAttribute only once for each CLR namespace in an assembly. Use XmlnsCompatibleWithAttribute for 2nd and 3rd assignments.



+1


source







All Articles