Why are there XAML namespaces that are URLS?

As far as I know they are URLs only out of convention, any unique identifier would do.

If you check HTML doctypes they are exactly the same, as in not actually loading :) For example: http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd or http://www.w3.org/TR/html4/strict.dtd

It makes no sense why isn't anything on these URLs though, would be nice to have some actual references...


There's an attribute you can use in the code of your referenced assembly that maps a Uri to your code namespaces:

[XmlnsDefinitionAttribute("http://yournamespace/", "Your.Assembly.Namespace")]

You can include multiple of these attributes, typically in your AssemblyInfo.cs, allowing multiple code namespaces to be referenced by a single Uri namespace in Xaml.

This makes your namespace declarations more compact (since you can omit the assembly name). It also allows you some flexibility in reorganizing namespaces in the referenced assembly without breaking your markup.

EDIT: for example, if you point Reflector at the PresentationCore assembly, you can see attributes such as this at the assembly level:

[assembly: 
    XmlnsDefinition( "http://schemas.microsoft.com/netfx/2007/xaml/presentation"
                   , "System.Windows.Ink") ]

This is how the Uri import gets mapped to code namespaces.