When you use a XAML element like <Button> in your Silverlight application you get an instance of the System.Windows.Controls.Button class. Namespace mapping is what links the XAML namespace “xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation” in your XAML file with the real .NET namespaces that contain the .NET types. This mapping is accomplished via the XmlnsDefinitionAttribute class. At some point in the Silverlight development cycle a programmer at Microsoft decorated the System.Windows assembly with the XmlnsDefinitionAttribute. Because of that mapping you have access to over a dozen .NET namepaces in your XAML file.
Mapping
Here’s an example from System.Windows.dll
[assembly: XmlnsDefinition("http://schemas.microsoft.com/winfx/2006/xaml/presentation", "System.Windows.Data")]
Setting this mapping allows all the public classes in the System.Windows.Data namespace within the System.Windows.dll to be access in XAML.
System.Windows.Data is not the only mapping however. .NET Reflector is a handy tool to learn which .NET assemblies use the XmlnsDefinition attribute and to learn more about mapping details.
Exploring with Reflector
Start by opening .NET Reflector and loading the Silverlight assemblies.
Click the Add button to create a new list of assemblies. I’ve named mine ‘Silverlight’.
The next screen is where you choose from the installed frameworks. Here, I picked Silverlight 3.0.xxx.xxx.
That’s all, now you are ready to start exploring the Silverlight assemblies.
Search for XmlnsDefinition
Pressing F3 brings up search window. Type in XmlnsDefinition and the class will appear in the results window.
Double click the XmlnsDefinition result to see the class in the main treeview.
Next, with XmlnsDefinition selected in the treeview press Ctrl-R to bring up the Analyzer window. The Analyzer can determine which assemblies are using this attribute. Expand the Used By node. As you can see there is only one assembly that has the XmlnsDefinition attribute applied.
Just for contrast, and to show that WPF and Silverlight are different, here is a screenshot of the WPF assemblies that are using the XmlnsDefinition attribute.
Examine the details
It’s time to inspect the metadata inside the System.Windows.dll. With System.Windows selected in the Analyzer, press the Spacebar. This will select the System.Windows node in the treeview. Press the Spacebar a second time to show the Disassember details. Choose your preferred language in the dropdown. I’m using C# for the next screenshots.
The Disassember window shows all the attributes applied to the System.Windows assembly. There are two batches of XmlnsDefinition attributes. The first batch is using the “http://schemas.microsoft.com/client/2007" URI. This URI is a holdover from the Siverlight 1 days. It’s still there, for legacy reasons. The next batch, is using the “http://schemas.microsoft.com/winfx/2006/xaml/presentation" URI. This is the default URI you see in all Silverlight 3 applications.
I count 14 namespaces that are affiliated with the “http://schemas.microsoft.com/winfx/2006/xaml/presentation" and one that’s affiliated with “http://schemas.microsoft.com/winfx/2006/xaml”

















