最後放棄了XmlnsDefinition和XmlnsPrefix,因爲我無法正常工作......在WPF應用程序中,有趣的是設計器窗口可以解決引用,但編譯器無法......去圖。
我使用cpp預處理從博客解決... http://blogs.msdn.com/b/blemmon/archive/2009/04/29/using-the-preprocessor-to-share-incompatible-xaml-between-sl-and-wpf-part-1.aspx
我修改PreprocessXaml只修改generic.xaml。
<Target Name="PreprocessXaml">
<ItemGroup>
<!-- Convert the DefineConstants property into an ItemGroup -->
<XamlConstants Include="$(DefineConstants)" />
</ItemGroup>
<PropertyGroup>
<!-- Convert the XamlConstants ItemGroup into a list command line switches for CL.exe -->
<CommandLineDefineConstants>@(XamlConstants->'/D%(Identity)',' ')</CommandLineDefineConstants>
</PropertyGroup>
<!-- Run the preprocessor -->
<Exec Command="CL.exe /nologo /EP $(CommandLineDefineConstants) "Themes/generic.i.xaml" > Themes/generic.xaml" />
<!-- Replace the pages with the preprocessed pages so that subsequent targets will use the preprocessed files -->
在這裏討論的同樣的問題:http://stackoverflow.com/questions/6645368/silverlight-3-and-silverlight-4-conditional-xaml/6646974#6646974 – ColinE