Partilhar via


We Don't Need No Stinking Mapping PI!

I'm blogging to:

The Yeah Yeah Yeahs
Show Your Bones

I just wanted to make sure eveyone was aware of this little fact.  First of all, in more recent builds (at leas the Feb CTP and beyond) you no longer use Mapping PIs to reference external assemblies.  Instead, you simply use the xmlns attribute by itself.  So using "old school" syntax you would have something like:

<?

Mapping XmlNamespace="wf" ClrNamespace=System.Windows.Forms" Assembly="System.Windows.Forms" ?>
<Window x:Class="MappingPIChange.Window1"
xmlns=https://schemas.microsoft.com/winfx/2006/xaml/presentation
xmlns:x=https://schemas.microsoft.com/winfx/2006/xaml
xmlns:wf="wf" >

Now you would loose the Mapping PI altogether and just use the xmlns attribute in the following manner:

<

Window x:Class="MappingPIChange.Window1"
xmlns="https://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="https://schemas.microsoft.com/winfx/2006/xaml"
xmlns:wf="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms">

Furthermore, you do not need to do this at all for the things in WindowsFormsIntegration such as WindowsFormsHost.  These are now part of the standard schema and no longer need to be prefixed.