简体   繁体   English

XAML Wp7 Wp8代码与mvvm共享名称空间

[英]Xaml wp7 wp8 code share namespace with mvvm

I have a solution with wp7 and wp8 proyects. 我有wp7和wp8 proyects的解决方案。 I share 90% of code between these 2 projects. 我在这两个项目之间共享90%的代码。 The only thing I can not share is xaml files because there is a namespace that make this imposible and there is no conditional compilation in xaml. 我唯一不能共享的是xaml文件,因为有一个命名空间使此操作变得不可能,并且xaml中没有条件编译。 in wp7 the declaration is 在wp7中,声明为

xmlns:Command="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras.WP71"

and in wp8 is 在wp8中是

xmlns:Command="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras.WP8"

Is there a way I can create a alias of these namespaces out of the xaml so I can share 100% my xaml between projects? 有没有一种方法可以从xaml中创建这些命名空间的别名,以便在项目之间共享100%的xaml? or this is a posibility that mvvmlight assembly names are compiled as the same result assembly filename as other nugget libraries I´m using? 还是这有可能将mvvmlight程序集名称编译为与我正在使用的其他块库相同的结果程序集文件名?

You should use the PCL version of the MVVM Light Toolkit. 您应该使用PCL版本的MVVM Light Toolkit。

As far as I know, they behave the same, but you will be sharing the same DLL and thus the same namespace 据我所知,它们的行为相同,但是您将共享相同的DLL,从而共享相同的名称空间

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

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