Some experience migrating Silverlight graphical apps to Windows 8 Store


Recently, I had the opportunity to migrate a Silverlight application to Windows 8 Store. The application is highly graphical, showing a variety of images or symbols representing real-world objects and allowing the user to interact with these objects and view their state (Human Machine Interface). Therefore its navigation and interaction paradigm is largely the same in both Silverlight and in Windows 8 Store. Also, most of the .NET types it uses are the same in both Silverlight and Windows 8 Store – classes derived from the Shape class, transforms, etc. This would not have been the case if the application had a business form type of interface: the touch optimized nature of Windows 8 and therefore also controls exposed in Windows 8 would require substantial changes to that interface.

Still, moving the codebase from Silverlight to Windows 8 Store did require some code modifications and exposed a number of differences between types and their definitions in Silverlight and Windows 8 Store versions of .NET. The following table summarizes these differences. (It is not meant to be exhaustive – it just shows the differences I encountered in the codebase I worked with).

Silverlight feature

Windows 8 Store

PixelShader

Not supported

WriteableBitmap for copying images

Not supported

BitmapSource

Not supported

TextBlock.TextDecorations

Not supported

DependencyProperty.Register method

Silverlight syntax DependencyProperty.Register(…, new PropertyMetadata(new PropertyChangedCallback(…) in Windows 8 is interpreted to mean that the PropertyChangedCallback is the default value of the dependency property rather than the delegate to a method. Compiler will not flag this as a problem and run-time effects may not be immediately obvious. Therefore, you should scan your source for the use of new PropertyChangedCallback and fix the code.

DependencyPropertyChangedEventArgs

Struct in Silverlight, sealed class with no public constructor in Windows 8. Obviously struct and class have different copy  semantics. Check your code for the use of this type.

MouseEvents

PointerEvents in Windows 8. Also, since Windows 8 supports multi-touch interactions, individual PointerEvents may represent different,  simultaneous interactions. You will need to provide your own logic to handle these or change your code to use higher-level gestures (e.g. rotate).

OnApplyTemplate

Public virtual in Silverlight, protected virtual in Windows 8.

Custom xaml namespaces

Changed syntax from clr-namespace to using

Control.Focus

Parameterless in Silverlight, takes FocusState parameter in Windows 8 (usually FocusState.Programmatic)

TransformGroup.Transform

In Windows 8 it’s now called TransformGroup.TransformPoint

FontStyles

FontStyle in Windows 8

VirtualKey.Ctrl

VirtualKey.Control in Windows 8

Timer

ThreadPoolTimer, different signature of Tick event handler

Comments (0)

Skip to main content