2011-07-21 10 views
1

generic.xamlの主な問題は、Viewboxがアセンブリを移動したことです。Silverlight 3とSilverlight 4用にgeneric.xamlを使用するにはどうすればいいですか?

SL3およびSL4でコンパイルするViewboxの場所の名前空間を持つgeneric.xamlファイルを1つ作成するにはどうすればよいですか?

私は

注... http://www.removingalldoubt.com/PermaLink.aspx/defa2a7d-b1e9-49eb-b8c8-438348be8d18でなく、無駄に見えた:あなたはAssembly.csに置くことができる2つの属性XmlnsPrefixとXmlnsDefinitionがあります。

ありがとうございます。

+1

同じ問題がここで議論されました:http://stackoverflow.com/questions/6645368/silverlight-3-and-silverlight-4-conditional-xaml/6646974#6646974 – ColinE

答えて

0

最後に、XmlnsDefinitionとXmlnsPrefixをあきらめて、正しく動作させることができませんでした。WPFアプリケーションでは面白かったですが、デザイナーウィンドウではレフェレンスを解決できますが、コンパイラは...できませんでした。 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プリプロセッサを使用して解決

は...私はgeneric.xamlを変更するPreprocessXamlを修正しました。

<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 --> 

関連する問題