Changes to the Silverlight Runtime for Windows Phone
Until now we’ve been focusing on Common XAML, but now our attention turns to Silverlight for Windows Phone. Though Common XAML (i.e. Universal Apps) is meant to eventually replace it, the Silverlight framework is still a viable option for Windows Phone developers.
Moving forward innovations and investments will be primarily directed at XAML first. They will then try to make those same features in Silverlight.
Roughly 90% of the Silverlight APIs are available in XAML. The intent is to move all of the remaining features into XAML in the future. Some of the more notable APIs are the Lockscreen, Lenses, VOIP, Camera, and Clipboard.
Upgrading to Windows Phone 8.1
Migrating apps from Silverlight for WP 8.0 to 8.1 is a simple process. You merely have to right-click on project and select upgrade from the menu. Since there will be a period of time when some Windows Phone 8 devices haven’t been upgraded, Microsoft recommends keeping both a WP8 and WP8.1 app in the store. (The stores still supports 7.1 as well.)
Silverlight 8.1 apps run in something called a “Modern Context”. In real terms this means that Silverlight 8.1 needs both a WMAppManifest and an appxManifest. Without the later you won’t be able to access newer XAML based features.
Silverlight 8.1 is not 100% compatible with Silverlight 8.0. For example, Array.Sort no longer uses a stable sort, which could cause problems for some applications.
Another concern is Fast App Resume. In Silverlight 8.0 this was an optional feature that you could turn on. Inside the Modern Context it is the only option.
XAML apps do not terminate when you press the Back button. Silverlight 8.1 apps will terminate by default, just like Silverlight 8.0, but you can disable it.
Background audio doesn’t currently work in Silverlight 8.1. It is hoped that it will be fixed in a future update.
Note that Silverlight 8.0 apps do not run in the modern context. This means that Silverlight 8.0 apps are 100% compatible with Windows Phone 8.1.
Aside from what was mentioned above, all of the Silverlight 8.0 APIs are available in Silverlight 8.1. Most of the XAML APIs are exposed. A notable exception is anything dealing with Modern Resource Technology isn’t being exposed to Silverlight.
- Silverlight apps can now access the SD Card.
- The Share contract can exchange binary data now. Previously it only supported text and HTML.
- Silverlight applications can be Picker Providers. This allows integration with services such as Drop Box.
- GeoFencing is supported.
- WinRT style Background Tasks are supported in Silverlight apps.
- Appointments and Calendar support has been enhanced to allow editing and deleting appointments.
- Email with attachments is now supported.
- Web Authentication makes using OAuth easier to use.
- Accessibility support is better than before, but still limited. Unlike XAML there are no pre-defined styles but the app can at least query for accessibility settings.
- Data Roaming allows phone and store apps to be associated with each other. This means user information such as settings, high scores, and save files can roam between Windows 8 and Windows Phone. This feature requires that you reserve an app name.
When creating a new XAML or Silverlight 8.1 app, a name needs to be reserved from the Windows Store just like you would with a new WInRT app.
Because of the possibility of name collisions, existing Silverlight 8.0 apps do not need a matching name reservation when being upgraded to Silverlight 8.1.
Which Framework to Use
- New Apps: Silverlight 8.x or XAML
- Existing Windows Store App: XAML
- Lock Screen App: Silverlight 8.x
- Camera Based App, VOIP: Silverlight 8.x
- Music App: Silverlight 8.0 or XAML
- Existing Silverlight Phone Apps: Silverlight 8.x or XAML
For more information see the What’s New with Windows Phone Silverlight Apps video on Channel 9.
Mike Hartington Jul 26, 2015