Cover

Silverlight 2 Released!

October 13, 2008
No Comments.

Url: http://silverlight.net
Silverlight Logo
Its been a long road to release but we’re finally there. If you’re anything like me and have been through WPF/E, Silverlight 1.0, Silverlight 1.1, Silverlight 2 Beta 1, Beta 2 and RC0, I know you’re ready for this thing to hit the streets.

I would like to congratulate the team on a solid set of functionality and tooling. For a fairly new product, this technology has progressed much faster than I expected it to. When asked some months ago, I didn’t think Silverlight would be in this great a shape until Silverlight 3.  The control model, data binding, data access, tool support, visual state manager, etc. Its all a much bigger leap from Silverlight 1.0 that I could have possibly envisioned.

There are a number of changes since Beta 2 (though this list is the same as the RC) that I want to make sure you know about:

  • Visual Studio 2008 now requires SP1 to be applied before the Silverlight 2 tools will work so make sure you have updated to the Service Pack 1 before you try to install the tool package.
  • Blend 2.5 is now a Service Pack for Blend 2.  You’ll need Blend 2 then you can apply Service Pack 1.
  • Rendering is now pixel-aligned by default. In earlier versions you could do sub-pixel rendering which could result in odd or aliased designs.  In the release, all rendering is pixel-aligned unless you override it with FrameworkElement.UseLayoutRounding which is true by default.  Setting it to default will do sub-pixel rendering.
  • For hosting Silverlight with an <OBJECT /> Tag, you must change your type from “application/x-silverlight-2-b2” to “application/x-silverlight-2”.
  • For embedded fonts, font URI’s must be resource based (instead of XAP based). That means that relative URI’s for font’s must point to a font-file as a resource inside an assembly instead of as a file inside the .xap file.  If you are using Blend 2 to embed your fonts, this will happen by default.  If you are refactoring old code, changing the font’s “Build Action” from “Content” to “Resource” should do the trick.
  • If you are using the VisualStateManager, you will need to change VisualTransition.Duration to VisualTransition.GeneratedDuration.  This usually means changing the “Duration” attribute in your ControlTemplates to “GeneratedDuration”.
  • If you are using the KeyDown event, you’ll be happy to find out that the event is now delivered asynchronously.  In Beta 2 and before you could get into re-entrancy issues.  You may need to tweak your use of this event to deal with this new model.
  • OpenFileDialog no longer uses the FileDialogFileInfo class but instead changes the API to simply the use of the selected files.  If you use the dialog, you’ll need to adjust the use.
  • Most controls now have a new default control template that should be less Window’y.  If you have made some minor changes to those templates for your own, you will find that they don’t match any longer. Because of this you might want to re-skin them in Blend.
  • Finally, the biggest painful change for you is to make sure that your styles and control templates are in the right order. In previous revisions, the rules were lax around StaticResources having to be defined before they are used. This caused a lot of problems for tooling and inconsistent runtime behavior.  To address this you *must* have a related resource defined before its used.  This may mean re-ordering your control templates.

I hope this opens up the more conservative uses of Silverlight 2 and allows Silverlight to move from an ‘early-adopter’ technology to a mainstream way to build Internet-based applications.

Also announced was the fact that you can use Eclipse now to write Silverlight 2 applications.  Cool!  http://www.eclipse4sl.org/  It’ll be licensed under the EPL 1.0 License.

Also announced was the new Controls from Shawn Burk’s teamto be released on CodePlex!  These controls include:

  • DockPanel
  • WrapPanel
  • ViewBox
  • Label
  • HeaderedContentControl
  • Expander
  • TreeView
  • NumericUpDown
  • AutoComplete
  • Accordion

These controls and their test-suite will be covered under MS-PL so they will be ready (including source code) coming pretty soon.

What do you think?