質問

Universal apps allow sharing of common assets in the Shared Project, including XAML pages. However the Hub App (Universal Apps) project template creates two distinct MainPage.xaml files in each platform-specific project.

Is there any reason for this? Am I going to regret putting all of my XAML files in the Shared Project?

役に立ちましたか?

解決

If one XAML file can be used for both platforms then put it into the shared project. If the views differ too much between the platforms or the UI performance is bad when sharing XAML code then you should create separate XAML files and put them in both projects.

Putting the XAML file into the shared project is the same as having the same file in both projects. Adding files to the shared project is the same as linking files into a project - just more convenient. (Read this article about file linking and PCL)

I recommend to start with everything UI (e.g. XAML, converters, ...) in the shared project and view models and logic in an external PCL library (with W8 and WP8.1 targets).

If a view/XAML file is different in W8 or WP then you can copy the XAML for this particular view into both platform specific projects.

More detailed information: http://blog.galasoft.ch/posts/2014/04/about-windows-phone-8-1-and-universal-apps/

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top