WPF Has Accumulated Multiple WPF XML Namespaces over Time It’s practically a
given that real-world WPF XAML will choose to use the WPF XML namespace as the
default namespace, but it turns out that more than one XML namespace is mapped
to the main WPF types in the various System.Windows namespaces. WPF 3.0 shipped
with support for http://schemas.microsoft.com/winfx/2006/xaml/presentation, but
WPF 3.5 defined a new XML namespace— http://schemas.microsoft.com/netfx/2007/xaml/presentation—mapped to the same
WPF types. (WinFX was the original name for a set of technologies introduced in
the .NET Framework 3.0, including WPF,WCF, and WF. That term was abandoned,
hence the change in namespace.) WPF 4 has once again defined a new XML
namespace that is mapped to the same WPF types:http://schemas.microsoft.com/netfx/2009/xaml/presentation.Despite all these
options, it is best to stick with the original http://schemas.microsoft.com/winfx/2006/xaml/presentation namespace because it
works in all versions of WPF.(Whether your content works with all versions of
WPF is another story, as to do so it must stick to features present only in WPF
3.0.) Note that Silverlight also supports the http://schemas.microsoft.com/winfx/2006/xaml/presentation namespace to make it easier
to use XAML meant for WPF inside a Silverlight project, although it also
defines its own alternative namespace, http://schemas.microsoft.com/client/2007, which is not supported
by WPF. The XML namespaces are confusing. They are not schemas. They do not
represent a closed set of types that were available when the namespace was
introduced. Instead, each version of WPF retrofits all previous namespaces with
any new assembly/namespace pairs introduced in the new version. Therefore, the winfx/2006 namespace effectively
means “version 3.0 or later,” the netfx/2007 namespace means
“version 3.5 or later,” and so on. However,WPF 4 accidentally excludes some
namespace/assembly pairs from the netfx/2009 namespace,which makes
using omitted types (like TextOptions) pretty challenging! When loose XAML is
loaded into Internet Explorer, it is loaded by PresentationHost.exe, which
decides which version of the .NET Framework to load based on the XML namespaces
on the root element. If the netfx/2009 namespace is present it will load
version 4.0, otherwise it will load whichever 3.x version is present.
at Page.28