Andrey Khataev
Andrey Khataev

Reputation: 1343

WPF XAML Namespace import

I've found that in order to use PRISM's classes in XAML you need to import namespace in that way: xmlns:cal="http://www.codeplex.com/CompositeWPF" this way is new to me, so I wanted to know, how hyperlink could be alias of usual notation of namespace import? so the intellisence knows in which assembly it should search this component? Thanks!

Upvotes: 2

Views: 1057

Answers (1)

Anderson Imes
Anderson Imes

Reputation: 25650

If you look in the AssemblyInfo.cs file for an assembly you are interested in, there is typically an assembly attribute that maps a URI to a CLR namespace. Here's an example:

[assembly: XmlnsDefinition("http://www.dummy.com/Stuff",
                           "Dummy.Common.UI")]

You can combine multiple mappings to the same URI as well:

[assembly: XmlnsDefinition("http://www.dummy.com/Stuff",
                           "Dummy.Common.UI")]
[assembly: XmlnsDefinition("http://www.dummy.com/Stuff",
                           "Dummy.Common.UI.Controls")]

These can even cross assemblies... you can use the same URI to map namespaces from multiple assemblies.

It's helpful to use this yourself as well! It's pretty convenient.

Upvotes: 3

Related Questions