Question

AFAIK, only Metro style apps can run on Windows 8 ARM, and Metro style apps can only be written with WinRT APIs.

According to this thread Can we access Windows 8 WinRT API from desktop application and Windows Phone 8 app? If so, are they in different namespaces?

Windows Phone 8 use ARM architecture, too. So if our app is written with WinRT APIs, it can run on both Windows 8 x86, Windows 8 for ARM and WP8, right ?

Was it helpful?

Solution

Not exactly. The situation with WinRT and Windows Phone Runtime is similar to WPF/Silverlight. There is overlap, but not 100% coverage. To address this issue Microsoft encourages using Portable Class Libraries to target multiple platforms (since each platform has its own runtime). More information on PCLs: http://msdn.microsoft.com/en-us/library/gg597391.aspx

Also, even if you manage to have most of your classes working under a Portable Class Library, you'll still have to write separate User Interfaces for each platform (the PCL does not support sharing UI). While this may seem upsetting, it actually is more necessary than you think. Here's a link on what Microsoft suggests in terms of sharing XAML UI.

This shouldn’t be seen as a complete roadblock for sharing between Windows Phone 8 and Windows 8. The clear guidance is to design and build your UI separately for each platform, embracing the design guidelines for each. It is technically possible to circumvent these obstacles. You could create your UI during page initialization from code. You could load platform-specific XAML from resources at runtime and inject it as a string into the page. However, none of these techniques scale and they make the construction of your core asset—how your app looks to your user—a tedious and error-prone task. Your code sharing investment will give you a much larger return further down your app stack, by trying to share app logic, data models, viewmodels, etc.

Basically, Microsoft is saying design your user interfaces specifically to the platform, because an application running on the phone (smaller screen) should have a different user interface than one that runs on a tablet/desktop (larger screens).


As far as running WinRT apps on different platforms... Yes, you can. Microsoft has stated that applications written in WinRT can run on Windows 8 and WOA (Windows on ARM). Here's a link from Microsoft talking about this. But, the first portion of my answer still stands... if you want to target different runtimes (WinRT/Windows Phone Runtime)... then use Portable Class Libraries. Selecting "Windows Store" and "Windows Phone 8" will allow your code to run on Windows 8 x86/x64/ARM, and Windows Phone 8.

OTHER TIPS

Windows Phone implements a subset of the Windows 8 WinRT API, dubbed WinPRT (P == Phone). You can find a good overview here with an exact list of support Win(P)RT APIs to be found here.

Word of caution - the XAML on Win8 is similar, but different, to the XAML on WP8 so expect to have to rewrite a lot of your UI for WP. What you really want to do is read this Getting Started guide that steps you through a lot of the considerations and techniques involved in developing apps between these platforms.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top