Is it possible to distribute code between the Silverlight web application and the Windows Phone 7 application

I have a simple Silverlight application that I want to run on Windows Phone 7 almost exactly the same as it is. I created a new Windows Phone 7 project, and when I refer to the Silverlight application, I get a warning saying: "Adding a link to the Silverlight project may not work properly. Continue?".

If I continue and try to start in any case, the WP7 project will never start, or sometimes I get the message "AG_E_PARSER_BAD_TYPE error" and it points to a line in xaml. I used the control from the Silverlight project.

The code between the two projects is approximately 99%. Is there any other way to reuse the code than I'm trying? Or how can I make this work?

+3
source share
3 answers

A typical way to achieve this is to use a template such as MVVM, which allows you to define a common model and viewmodel layer (possibly in a separate project), defining a different level of presentation that refers to this shared project.

You said it yourself, you will share the BRIDGE of the code, but not all, so at least at some point you will need to create the logic and layout of the device / interface.

+1
source

, , . "" "". .

+4

, Silverlight [ ] WP7, WP7, silverlight. - , , .

. AG_E_PARSER_BAD_TYPE , XAML Silverlight, .

+1

Source: https://habr.com/ru/post/1765962/


All Articles