Migrating apps from Windows 8 to Windows Phone 8

Tagged: WinRT WP8 Windows8

In this article, I'm listing some of the challenges might be faced when porting a Windows 8 XAML/C# app to Windows Phone 8. I'm assuming it's a content app, like an RSS news reader for example.

UI pages & controls

All XAML pages and controls have to be different. UI controls in Windows phone are using different namespaces. And they are actually different, they don't map one to one. Here is a sample of workarounds to replace Windows 8 controls:

GridView & ListView: these can be replaced by ListBox, ofcourse removing the horizontal scrolling recommended in Windows 8. Everything in Windows Phone scrolls vertically by default. Grouped GridView that are typically used in the hub pages of Windows 8 can be replaced by a Panorama control with each PanoramaItem containing a ListBox.

FlipView: this one has no replacement in Windows Phone. You just go to a detail page, and you can implement your own flipping technique, may be using the AppBar (next & previous buttons).

Dark & Light Themes: in Windows 8 the developer can specify which theme to use in an app. On the Phone, the user get to choose which theme from the Settings, so the developer should either abide by using the default theme chosen by user, or he can override the colors for all controls to fix his own theme.

StandardStyles & LayoutAwarePage: the default project template for Windows Phone 8 doesn't come with the common folder which had these features. The developer is free to create his own version of these files to use as styles or base page.

Pages & Navigation code

LoadState: this method should be replaced by overriding OnNavigatedTo.

Navigation: instead of 
this.Frame.Navigate(typeof(ItemDetailPage), itemId);
use
NavigationService.Navigate(new Uri("/ItemDetailsPage.xaml?ItemID=" + itemId, UriKind.Relative)); 

Getting Data

Windows.Data (Json, Xml, HtmlUtility): this namespace is not supported. For reading RSS feeds for example you will have to use LinqToXml instead.

Internet Connection: instead of
Windows.Networking.Connectivity.NetworkInformation.
GetInternetConnectionProfile().GetNetworkConnectivityLevel()
use:
Microsoft.Phone.Net.NetworkInformation.NetworkInterface.
NetworkInterfaceType != Microsoft.Phone.Net.NetworkInformation.NetworkInterfaceType.None 

Live Tile Notifications: The tiles in Windows Phone are different than Windows 8. In Windows 8 tiles are either square or wide and can be updated using one of the available different templates. In Windows Phone, tiles have 3 sizes, they use one of 3 templates, and biggest change is that they take local image as a URL. So if you want to update the image from the web, you should use ShellTileSchedule class to retrieve the image and update it.

Add a Comment