Ensuring That Your Silverlight Applications Work with Silverlight 5
Microsoft Silverlight will reach end of support after October 2021. Learn more.
Several changes have been made to the Silverlight runtime and the Silverlight Tools between Silverlight 4 and Silverlight 5. For these changes, the following principles apply:
Most Silverlight 4 applications will work with Silverlight 5 without any changes.
When breaking changes are required, Silverlight will try to maintain support for the old behavior, as well as the new behavior, by using a quirks mode.
Nevertheless, some changes made to Silverlight components can potentially cause your older Silverlight-based applications to fail (compile time, XAML load time, or possibly design time) or to behave differently.
This topic describes the changes that were made between Silverlight 4 and Silverlight 5. This topic does not describe new features or enhancements for Silverlight 5. For information about what is new in Silverlight 5, see What's New in Silverlight 5.
For corrections and additions to this topic, see the Silverlight SDK blog.
Upgrading Projects Using Silverlight 5 Tools
There are no known breaking changes between Silverlight 4 and Silverlight 5 in the Silverlight core runtime. Applications that were originally compiled using Silverlight 4 tools, and that continue to target the Silverlight 4 runtime, should work without issues on a client that has the Silverlight 5 runtime.
To retarget an existing Silverlight 4 project for the Silverlight 5 runtime specifically, you should change the project targeting in Visual Studio, using the Silverlight Build Options / Target Silverlight Version section of the Visual Studio project configuration dialog. Then, recompile the project.
For more information on how version targeting can influence the behavior of your application, see Silverlight Plug-in Versioning.
If your project references any Silverlight SDK client assemblies (for example System.Windows.Controls.dll) make sure that your project specifically references the Silverlight 5 version of the SDK client assemblies that were distributed with the Silverlight 5 Visual Studio tools. A project that targets Silverlight 5 cannot use the Silverlight 4 SDK assemblies.
Any custom assemblies or third-party assemblies that are referenced by a project that targets Silverlight 5 do not necessarily need to be recompiled for Silverlight 5.
Note that quirks mode behaviors do not apply to the behavior of specific third-party assemblies. Quirks mode applies to the overall application, and versioning settings are made by applications, not assemblies. A third-party assembly is always executed under the application's versioning.
Quirks Mode Behavior
This section describes where the runtime or its API include version-specific behavior differences. These behavior differences are based on which runtime version the application targets. Often, the changes represent bug fixes to Silverlight 5, but the Silverlight 4 behavior remains accessible as a specific quirks mode, which is used only when the application targets a Silverlight 4 runtime. This is done in case the logic of your application relied on the Silverlight 4 behavior.
In Silverlight 5, the tick-synchronized timing in the ClientHttp code was moved off of the UI thread. The ClientHttp code should emulate the tick-synchronized timing present before its implementation was moved.
Prior to Silverlight 5, if you set the SelectedIndex, SelectedItem, or SelectedValue before setting a Selector's ItemsSource, that value would be coerced to null. In Silverlight 5, the values stay set so there is selection when the ItemsSource is set. This enables a number of binding scenarios and matches the behavior in WPF.
Vector Printing is the default printing format for Silverlight 5.
Multicore JIT on application startup is only used for Silverlight 5 applications or in 64 bit.
Prior to Silverlight 5, ButtonBase does not change the visual state when Visibility is set to Collapsed, so when the control is visible again, it stays in the visual state before it is made invisible. In Silverlight 5, the visual state is updated when Visibility is set to Collapsed.
Prior to Silverlight 5, the default background color for writeable bitmap is transparent black, which is not desirable for printing. In Silverlight 5, transparent white is used as the default.
Prior to Silverlight 5, in a ListBox, focus was set to an item for a selection change when oldIndex != newIndex only in the case when the newIndex != -1. In Silverlight 5, the focus is set even if newIndex == -1. If newIndex == -1, the focus is set to the ListBox.