Welcome to Pete Brown's 10rem.net

First time here? If you are a developer or are interested in Microsoft tools and technology, please consider subscribing to the latest posts.

You may also be interested in my blog archives, the articles section, or some of my lab projects such as the C64 emulator written in Silverlight.

(hide this)

Silverlight 2 RC0 – Developer-Only RTW Prep Release

Pete Brown - 26 September 2008

By now, you probably heard that Silverlight 2 RC0 is out and available for download. While you’ll find that the breaking changes are fewer (or less significant) than those from Beta 1 to Beta 2, there are still some details to pay attention to. The developer release contains a breaking changes document which will help you through the issues.

First and foremost: This is a developer-only build. Do not release code built on RC0 as end-users will not have this build. The point of RC0 is to allow developers to have enough time to update their Beta 2 applications (in a staging or internal test environment) to RTM. Keep your public-facing sites on Beta 2. Beta 2 will automatically upgrade to RTW. RTW is coming soon, and this is your chance to prepare for it.

That is no comment on stability or usefulness of RC0, just on the fact that there will be no end-user runtime for RC0.

New Goodies in RC0

ComboBox! I know many of you requested this, and the Microsoft team listened. ComboBox is in this release, ready for you to play with. If you already have your own ComboBox controls in your project, pay attention to the first issue I cover in the “Important Changes” below.

Other new controls include the PasswordBox and the ProgressBar

New Styles: The controls all have subtle new style changes. I think these look tons better than the original Silverlight controls styles. The new styles are also simpler (especially the button) so restyling them is easier.

MessageBox. We’ve all needed a messagebox for simple modal display, and now we have this browser helper method.

Better Binding information on failure. When your bindings fail, the diagnostic messages in the debug window are far more useful than they were before. I was pretty happy when I saw this :)

Blend 2 Service Pack 1 – The design tool formerly known as Blend 2.5. Note that you’ll need to uninstall Blend 2.5 and install Blend 2 before you install this service pack. If you’ve been using Blend 1 and Blend 2.5 together, and don’t have Blend 2, you’ll need to download a trial or purchase the full version of Blend 2.

Important Changes Since Beta 2

So, back to some of the changes and new bits in RC0 that you’ll need to take into account when porting from Beta 2. This is a partial list of things I found interesting. To see the full list, take the union of this and the breaking changes document. Don’t rely just on this list or any other list posted in the blogs.

New Object Type

If you’re not using the <asp:Silverlight> control to create your control, just as you did when moving from Beta 1 to Beta 2, you’ll need to go into the markup on your web page and change the type from x-silverlight-2-b2 to x-silverlight-2. The older type was only for the beta. The web server mime type of x-silverlight-app does not change.

Custom Controls with the Same Name as Built-in Controls

This one isn’t in the breaking changes document. You’ll really only run into this if you created, say, a ComboBox in your own code, and named it “ComboBox”. The problem is, in the current release, the xaml namespace doesn’t quite correctly scope the control names. The end result is a cryptic error or more commonly, the app just failing to load. I’m not sure if this will be fixed in the RC0 or RTW builds, but it was an issue with earlier bits.

Speaking of controls, interested in more Silverlight controls? Pay attention to what Shawn Burke’s team is doing. In his blog post, he points out that he expects to deliver a preview release of at least the following controls:

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

After having spoken with him about several of those controls, I’m convinced that they will be putting out a quality product that both designers and developers will be happy to use.

ContentPresenter Changes

If you style up the ContentPresenter inside your VSM templates or regular styles, be aware that ContentPresenter no longer has many of the properties it had in earlier versions. To get some of the same behavior, you’ll need to include additional elements. This change is because ContentPresenter now derives from FrameworkElement rather than Control.

Font URI is Restricted to Assembly Resource

Any embedded fonts now need to be compiled in as resources in your project rather than kept external to the assemblies.

System.Windows.Controls.Extended.dll renamed to System.Windows.Controls.dll

Simply remove the old reference and add the new one then recompile.

Image and Media Errors At Runtime Now

I believe these were swallowed previously, as I never received them until porting to RC0. In any case, it is a good practice to have handlers for your ImageFailed events. Now it is even more of a best practice :)

Visual State Manager and Styling Changes

You’ll need to change your <vsm:VisualTransition Duration=… > to <vsm:VisualTransition GeneratedDuration=… > in your transitions in VSM. More details in the breaking changes document.

In the project I updated, I ran into a number of issues pulling my App.xaml (Blend-generated VSM styles) forward into RC0. On the style for a button, I had to remove:

            <Setter Property="TextAlignment" Value="Left"/>
            <Setter Property="TextWrapping" Value="NoWrap"/>

I also had to change all instances of duration (as mentioned above) to GeneratedDuration

<vsm:VisualTransition Duration="00:00:00.1500000" From="MouseOver" To="Normal"/>
<vsm:VisualTransition GeneratedDuration="00:00:00.1500000" …

Also removed the ContentPresenter properties (see ContentPresenter Changes above) as flagged by VS. Mostly these are all just brainless activities due to the templates originally created in Blend.

You’ll also need to make sure your generic.xaml is now in the themes/ folder rather than at the root of your project.

The thing that hung me up the longest, though, was this:


Undeclared prefix [Line 188 Position: 70]

Line 188 is in the middle of a comment in the markup, so it shouldn’t be compiled. If you double-click the error, it just brings you to the top of the xaml file; not very useful.

Thanks to some help from Peter Blois and Nikola Mihaylov at Microsoft, the solution turned out to be pretty simple. In all your xaml files, replace “vsm:” with “” (empty string). There’s a bug in cider that makes it not work with the prefix. In the case above, I fixed the file that it complained about, but neglected to fix the referenced styles in App.xaml. Once Nikola pointed that out, I was good to go.

Note, however. Back up your work first. There appear to be some cases where the “vsm:” prefix is actually required. This is one of the only real trolls I found under the bridge between Beta 2 and RC0.

The vsm styles are the source of a bunch of issues with in my interim changes, so check there early if you have unexpected problems and use vsm styles. Worst case, go through and comment out the bodies of your styles (leave the outermost declaration intact so you don’t have to modify markup elsewhere) and run after time. Not the best debugging process, but we all know that works. You’ll find the source of many WSOD (White Screens of Death – thanks Jose!) this way.

Peter Blois had another recommendation. Pull your project into Blend and try it out. At the time I wrote this, the current Blend 2 SP1 build was not available, but is now.

[Update: See my post on debugging vsm issues for more detail]

Oh, and still no word on the other v2 release I’m expecting, but that should be any day now ;)

posted by Pete Brown on Friday, September 26, 2008
filed under:    

6 comments for “Silverlight 2 RC0 – Developer-Only RTW Prep Release”

  1. Pete Brownsays:

    To the best of my knowledge, the vsm prefix is not required at all (and messes up cider due to a RC0 and prior bug). However, there may be some edge cases where a requirement for it pops up. Removing it just hasn't been 100% tested yet.

    I don't have any more information than that at this point, unfortunately.

  2. Pete Brownsays:

    Ok, latest recommendation (and this makes sense) is to remove the vsm: prefix from all style and setter tags, but keep it for all VisualState* tags (like VisualStateManager and VisualStateGroup), as those are actually in the vsm namespace.


Comment on this Post

Remember me

3 trackbacks for “Silverlight 2 RC0 – Developer-Only RTW Prep Release”

  1. Community Blogssays:
    Ed Silverton with 3D Flickr Photo, A gaggle of Silverlight Developers blogging about RC0, and Bill Reiss
  2. <ChristophDotNet says:
    Following Jesse’s and Pete’s excellent posts on porting Silverlight2 apps from Beta 2 to the final release
  3. POKE 53280,0: Pete Brown's Blogsays:
    This is the second birth I’ve been privileged to witness this month, and if I made any more comparison