<Window x:Class="WpfLibrary.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:WpfLibrary">
<Window.Resources>
<SolidColorBrush Color="AliceBlue"/>
</Window.Resources>
<TextBox/>
</Window>
The URLs have been setup to represent multiple CLR namespaces in the AssemblyInfo of the assembly in which they are defined. Notice that both the TextBox and SolidColorBrush classes are referenced using the default XML namespace even though the classes are actually defined in different CLR namespaces.
To find out which CLR namespaces are assigned to a particular URL then you can look at the assembly definition in Reflector.
Here's the syntax to set this up in the AssemblyInfo of your assembly:
[assembly:XmlnsDefinition("http://myorganization.com", "WpfLibrary")]
[assembly:XmlnsDefinition("http://myorganization.com", "WpfLibrary.Pens")]
[assembly:XmlnsDefinition("http://myorganization.com", "WpfLibrary.Brushes")]
Consumers of your assembly can then use the XML namespace to reference all of the associated CLR namespaces in one swoop:
<Window x:Class="WpfApplication1.Window1" xmlns:myorg="http://myorganization.com" </Window>
No comments:
Post a Comment