简体   繁体   中英

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

My main problem with generic.xaml is Viewbox has moved assemblies.

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?

I looked at http://www.removingalldoubt.com/PermaLink.aspx/defa2a7d-b1e9-49eb-b8c8-438348be8d18 but to no avail...

Note: There are two attributes XmlnsPrefix and XmlnsDefinition that you can place in Assembly.cs.

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.

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

I modified PreprocessXaml to modify only 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 -->

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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