简体   繁体   English

如何为 Silverlight 3 和 Silverlight 4 提供 generic.xaml?

[英]How to have a generic.xaml for Silverlight 3 and Silverlight 4?

My main problem with generic.xaml is Viewbox has moved assemblies.我对 generic.xaml 的主要问题是 Viewbox 已移动程序集。

How do I have the one generic.xaml file with a namespace for the location of the Viewbox that will compile in SL3 and SL4?我如何拥有一个 generic.xaml 文件,其名称空间用于将在 SL3 和 SL4 中编译的 Viewbox 的位置?

I looked at http://www.removingalldoubt.com/PermaLink.aspx/defa2a7d-b1e9-49eb-b8c8-438348be8d18 but to no avail...我查看了http://www.removingalldoubt.com/PermaLink.aspx/defa2a7d-b1e9-49eb-b8c8-438348be8d18但无济于事......

Note: There are two attributes XmlnsPrefix and XmlnsDefinition that you can place in Assembly.cs.注意:您可以在 Assembly.cs 中放置两个属性 XmlnsPrefix 和 XmlnsDefinition。

Thanks in advance.提前致谢。

Finally gave up on XmlnsDefinition and XmlnsPrefix as I could not get the to work properly...It was funny in a WPF application the designer window can resolve the referemces but the compiler could not...go figure.最后放弃了 XmlnsDefinition 和 XmlnsPrefix,因为我无法正常工作......在 WPF 应用程序中很有趣,设计师 window 可以解析参考,但编译器无法...

I solved using the cpp preprocessor from blog... http://blogs.msdn.com/b/blemmon/archive/2009/04/29/using-the-preprocessor-to-share-incompatible-xaml-between-sl-and-wpf-part-1.aspx我使用博客中的 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

I modified PreprocessXaml to modify only generic.xaml.我修改了 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) &quot;Themes/generic.i.xaml&quot; &gt; Themes/generic.xaml" />
<!-- Replace the pages with the preprocessed pages so that subsequent targets will use the preprocessed files -->

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM