As Silverlight 2 RTM is out, we have upgraded our Silverlight proof of concept application http://autopia.dotnetsolutions.ltd.uk/ from Silverlight 2 beta version. In this blog, I will try to explain my experience during the up-gradation process.
As we are migrating our older code to the newer release, I first took up the nice documentation from the link http://download.microsoft.com/download/6/f/e/6fe1f43d-9d0c-4346-ad08-602df9bcb3cf/BreakingChangesBetweenBeta2andRelease.doc
Once I have gone through the changes document, I uninstalled all my previous beta tools which are Microsoft Silverlight, Silverlight 2 SDK, and Silverlight Tools for Visual Studio, Expression Blend.
Then I opened the project which was done using beta version and it prompted notifying to upgrade as expected and I accepted it to upgrade.
As we host our Silverlight application inside a web application, and that web application do not have any extra functionality other than hosting, I deleted it and created a new web project and added my Silverlight project to be hosted inside the newly created Web Application. In this way I can safely ignore any changes I need to make across the web application to be compatible with the new version.
As a matter of interest, the changes for the web application with previous version are:
1. The MIME type changed from application/x-silverlight-2-b1 or application/x-silverlight-2-b2 to application/x-silverlight-2 based on which beta version you have used.
2. The Silverlight installation url has changed from http://go.microsoft.com/fwlink/?LinkID=108182 or http://go.microsoft.com/fwlink/?LinkID=115261 to http://go.microsoft.com/fwlink/?LinkID=124807
The next thing and in my opinion, easy to be ignored and caused lot of annoyance is generic.xaml. I have spent a couple of hours to find the cause of the error and eventually found it. The platform looks for generic.xaml inside “Themes” folder. So I have created a “Themes” folder at root level and moved the generic.xaml file inside the folder.
The next major challenge is ContentPresenter. ContentPresenter now derives from FrameworkElement instead of Control. So the properties like Background and Font related properties are no more available. So it was a big exercise to keep the styling we had and move the properties to the controls which are using the ContentPresenter.
Once done, I started looking to replace the custom dropdown control we have written. As Silverlight 2 now contains the dropdown control, I wanted to use it and get rid of our custom control as the functionality is exactly the same. I simply renamed the custom control type to ComboBox type and moved the styling to Popup element inside ControlTemplate targeted on ComboBox.
Also a couple of places where the XAML becomes invalid is where in the beta versions if you use like windows:Setter.Value this is perfectly valid. In RTM it should be changed to just Setter.Value. In the same way when you use VisualStateManager, vsm:Setter.Value is perfectly valid in the beta version while in RTM it should be just Setter.Value.
After these changes, the application works like a charm in RTM.