【问题标题】:How to have a generic.xaml for Silverlight 3 and Silverlight 4?如何拥有 Silverlight 3 和 Silverlight 4 的 generic.xaml?
【发布时间】:2011-07-21 06:12:41
【问题描述】:

generic.xaml 的主要问题是 Viewbox 已移动程序集。

我如何拥有一个 generic.xaml 文件,其命名空间用于将在 SL3 和 SL4 中编译的 Viewbox 的位置?

我查看了http://www.removingalldoubt.com/PermaLink.aspx/defa2a7d-b1e9-49eb-b8c8-438348be8d18,但无济于事......

注意:您可以在 Assembly.cs 中放置两个属性 XmlnsPrefix 和 XmlnsDefinition。

提前致谢。

【问题讨论】:

标签: silverlight xaml conditional compilation generic.xaml


【解决方案1】:

最后放弃了 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) &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 -->

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2010-10-15
    • 1970-01-01
    • 1970-01-01
    • 2011-01-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多