开发者

WPF XAML Namespace import

开发者 https://www.devze.com 2022-12-23 17:03 出处:网络
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\"

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 intelli开发者_如何学编程sence knows in which assembly it should search this component? Thanks!


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号