For a little more than a week ago Microsoft released a Release Candidate of Silverlight 2. I’m not going to talk too much about this release, as it has been covered in great detail in the blogosphere. I have now updated my Silverlight 2 sample applications from Beta 2 to the Release Candidate. The RC is not a public release, and is intended as an interim release to give developers some time to get ready for the final release, which is expected shortly. You are not supposed to deploy RC versions of your Silverlight applications to the public, as this could fragment the user base even more and give a poor user experience. However, since the audience of this blog is mostly developers I’ve decided to uploaded fresh RC versions of my sample applications.
I didn’t bump into too many issues in the update. Most of the changes where small XAML modifications now that the ContentPresenter control derives FrameworkElement instead of Control. I discovered that Blend 2.0 SP1 Pre View did a far better job than Visual Studio 2008 to help me work out XAML changes.
The only real issue I ran into was my use of user control inside a DataTemplate in the YouCard application. I have a list of User objects that is bound to an ItemsControl. A common technique to keep the XAML clean is to use a UserControl inside a DataTemplate. That way you can encapsulate all the XAML needed to represent one item in a list into a separate control. In Beta 2 you had to explicitly set the DataContext on your user control to pass the object you want to display in your DataTemplate. If you do that in the RC your binding will fail. If you try to set a breakpoint and debug the DataContext property of your user control you will discover that it’s always null. It took some time to figure out the problem, but the solution was really simple. You simply don’t need to specify the DataContext for your user control inside the DataTemplate. The DataContext will automatically be set for you.
I’ve uploaded new versions of YouCard, DiveLog and Webcam POC to my test page. The source code is available in my Code Samples SkyDrive folder. Now we just need to wait a few more weeks for the RTW!