Porting Silverlight Applications to Windows Phone
[Note: This topic contains pre-release information and is subject to change in future releases. Blank topics are included as placeholders. References to "Beta" refer to the current version of Windows Phone Developer Tools and references to "Technical Preview" refer to the current version of Windows Phone OS 7.0 and Windows Phone 7.]7/12/2010
While most of the code in a Silverlight application can be ported unmodified to a Windows Phone application, there are some considerations to keep in mind. This section covers development and design choices to be made when porting an existing Silverlight application.
If your Silverlight application uses the Frame and Page navigation model, then you must change the root frame to derive from PhoneApplicationFrame and have each page derive from PhoneApplicationPage. For more information, see Frame and Page Navigation for Windows Phone.
For more information about Silverlight considerations for Windows Phone, see Silverlight Differences on Windows and Windows Phone and Class Library Support on Windows Phone.
All Silverlight applications for Windows Phone will have to adapt to run in a 480 x 800 form factor. If possible, the ability to run in both portrait and landscape mode is also desirable.
The user interface may also have to be adapted for touch input. Larger hit targets make touch input easier for the end user. Interface designers may want to minimize the amount of input required by the keyboard.
The Application Bar for Windows Phone is used to provide users with quick access to an application’s most common tasks. It may be desirable to add an Application Bar control to the program to enhance ease of use.
The Windows Phone UI Design and Interaction Guide provides a complete set of guidelines on how to design a Windows Phone application.
While the Silverlight application may run correctly on a Windows Phone device, a developer may want to adapt the application to take advantage of some phone-specific features. The following list shows some possible ways that you can adapt an application to include some Windows Phone specific features:
A contact application may want to use the camera features to store photos of people or places along with the contact. For more information, see Photos for Windows Phone.
A movie finder application may want to use the GPS features to find the user’s current location to locate nearby theatres. For more information, see Location for Windows Phone.
A game may want to use the accelerometer to control input for game control. For more information, see Accelerometer Overview for Windows Phone.
Any Windows Phone application will have to take into consideration the hardware it is running on as compared to a desktop application. CPU resources may be more limited. Network speed may vary depending on the user’s carrier. Applications that depend on data from the Internet will have to degrade gracefully when a network connection is not available.
Battery life is very important so choices such as screen colors, CPU utilization, and polling for information should all take into consideration the effect they have on battery life.