Upgrading existing Silverlight 2 beta 1 code to beta 2

by apijunkie 11. June 2008 23:59

Silverlight girl and I recently upgraded Bumble Beegger to work with Silverlight 2 beta 2.

Some things were easier then others all in all it took a few hours to finish and was not a big ordeal.

If you are planning on upgrading your code you can find official Microsoft documentation about breaking changes between beta 1 and beta 2 here. Also note that the last minute correction and additions can be found here.

Below are some of the coding issues we encountered and how we solved them in the hope that this will save someone else some time:

1. FrameworkElement.Resources is a ResourceDictionary

Trying to a use Add without a key fails.

Example:

canvas.Resources.Add(value); // compilation error on beta 2

canvas.Resources.Add("key",value); // o.k. on beta 2
 

2. WebClient reference change

To use web client you will need to add a reference to System.net.
 

3. ApplicationSettings.Default was changed

ApplicationSettings.Default is not accessible you can use IsolatedStorageSettings.ApplicationSettings instead.


4. The type or namespace name 'DataGrid' does not exist in the namespace

You can find more info about this problem and the solution here


5. DataGrid syntax changes.

Example:

DataGridTextBoxColumn was changed to DataGridTextColumn

You can find more info about it here.
 

6. SetValue needs explicit cast to double.

Example:

item.SetValue(Canvas.LeftProperty, value); // compilation error on beta 2

item.SetValue(Canvas.LeftProperty, (double)value); // o.k. on beta 2
 

 

Tags:

Comments are closed

About the author

Name of author

I was first wounded by x86 assembly, recovered and moved on to C. Following a long addiction to C++ and a short stint at rehab I decided to switch to a healthier addiction so I am now happily sniffing .NET and getting hooked on Silverlight.

I am mainly here to ramble about coding, various API’s, Junkies(me especially) and everything else that happens between coders and their significant other.

  James Bacon