WPF XML namespaces are those fancy little cryptic strings at the top of every WPF application that you use (generally prefixed with xmlns=”..”, meaning that they are the ‘default’ namespace [i.e. no prefix required]).
But what do they mean?
Simply put, they are ‘short cuts’ to import a whole plethora of .NET WPF assemblies and make their contents available for use in your XAML file.
The most commonly used namespace is http://schemas.microsoft.com/winfx/2006/xaml/presentation, and it imports the following .NET namespaces
- System.Windows
- System.Windows.Automation
- System.Windows.Controls
- System.Windows.Controls.Primitives
- System.Windows.Data
- System.Windows.Documents
- System.Windows.Forms.Integration
- System.Windows.Ink
- System.Windows.Input
- System.Windows.Media
- System.Windows.Media.Animation
- System.Windows.Media.Effects
- System.Windows.Media.Imaging
- System.Windows.Media.Media3D
- System.Windows.Media.TextFormatting
- System.Windows.Navigation
- System.Windows.Shapes
- System.Windows.Shell
As you might (or might not) know, there are other XML namespaces that you can use, each represents a particular version of WPF as follows (to date):
- WPF 3.0 -> http://schemas.microsoft.com/winfx/2006/xaml/presentation (also supported by Silverlight)
- WPF 3.5 -> http://schemas.microsoft.com/netfx/2007/xaml/presentation
- WPF 4.0 -> http://schemas.microsoft.com/netfx/2009/xaml/presentation
- Silverlight -> http://schemas.microsoft.com/client/2007 (not supported by WPF)
Note that these are all mapped to the same WPF assemblies, though they implicitly define which version of WPF you are targeting.
Also, a note about winfx vs netfx: winfx was the original name that was used to refer to the W*F technologies (WCF,WPF,WF)… this was later ditched by Microsoft.
Tagged: .NET Framework, Extensible Application Markup Language, Microsoft, Windows Presentation Foundation, WPF
