Why is it that there are two kinds of references in xaml.
One looks like this:
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
But mine look like this:
xmlns:WPFToolKit="clr-namespace:Microsoft.Windows.Controls;assembly=WPFToolkit"
Why can't I do this:
xmlns:local="http://myschema.mydomain.com/MyControlNamespace
Thanks to ixlettervariables for the answer. Here's a detailed explanation here
The second instance is basically an unmapped, but explicit reference to a namespace in an assembly. The first instance is a mapped reference to a namespace in some assembly referenced by your project. XAML Namespaces and Namespace Mapping, over at MSDN explains this in more detail:
WPF defines a CLR attribute that is consumed by XAML processors in order to map multiple CLR namespaces to a single XML namespace. This attribute, XmlnsDefinitionAttribute, is placed at the assembly level in the source code that produces the assembly. The WPF assembly source code uses this attribute to map the various common namespaces, such as System.Windows and System.Windows.Controls, to the http://schemas.microsoft.com/winfx/2006/xaml/presentation namespace.
Therefore, by adding the following to your assembly you could do just that:
[assembly:XmlnsDefinition("http://myschema.mydomain.com/MyControlNamespace", "My.Control.Namespace")]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With