| Comments

Silverlight LogoAt the MIX11 conference Scott Guthrie announced the availability of Silverlight 5 Beta.  I suppose this doesn’t come at a surprise to most as this is now a regular annual occurrence.  In fact it is almost exactly a year ago when Silverlight 4 was released.

The team has been working very hard to deliver on the features we discussed at the Silverlight Firestarter event last December 2010.  That was a flurry of revealing that happened in December showing the world what the Silverlight team has been working on.  There was no rest for them of course and they continued to complete this initial version of Silverlight 5 to release at MIX11. 

As always with Silverlight betas, this is a developer release.  This means that this is a preview for software developers to understand and appreciate (and give feedback) the new features provided.  There is no “end-user” runtime available for the release nor a “go-live” license for you to develop applications into production. 

So enough with the pleasantries…

Download Silverlight 5 and Tools

To get started with the Silverlight 5 beta you are going to need some tools.  Here’s the link dump (be patient as some link caches get updated):

These are the full set of tools to help you evaluate Silverlight 5.  At a bare minimum for a developer you’ll need/want the Visual Studio 2010 and the Silverlight 5 Tools for VS.

NOTE: In case you are like me and don’t like to read the finer details you may have missed the note that you don’t need to install the developer runtime/SDK separately if you are installing the Silverlight 5 Tools.  Again, it is not necessary to install the SDK and developer runtimes *again* if you have already installed the Silverlight 5 Tools for Visual Studio.  The links to the developer runtimes are provided for convenience as some use these to put on test machines without developer tools to test things out and debug.

Go ahead and start downloading the tools now…here’s some information on the release for you as you download!

Silverlight 5 Resources

There are a few places you can go to get more information and quick learning on Silverlight 5:

You should also subscribe/bookmark those links as they’ll likely to be continually updated with good nuggets of information!

What’s new in Silverlight 5 – feature review

Here’s more of the details on what is new in this release.  This shouldn’t come of any surprise if you watched the Silverlight Firestarter event and saw all the new stuff.  This is a little long in description here, but hopefully for your benefit.


How could we have a release without improved tools?  Visual Studio 2010 has proved to me to be a great platform (have you seen the Extension Manager and how you can grab all the great things online?  VSCommands is my favorite) for productive development on the Microsoft platforms.

You would expect to have the Silverlight 5 support in the tools and it is in there, all what you want.  The cool thing is that adding the tools on your existing SP1 installation gives you ultimate Silverlight multi-targeting support:

Silverlight Multi-targeting

In addition to the basics and supporting the new features, we’ve added one of my favorite tooling features that folks have been asking for: XAML debugging.  Now right now it is for Binding expressions only, but let’s be honest, that’s what you care most about right!  So what does this feature mean?  Well you can set a breakpoint in your editor on XAML lines that have the {Binding} syntax in them:

XAML Breakpoint Editor

When that binding is evaluated you’ll get information about the binding evaluation:

XAML Breakpoint Watch Window

Pretty helpful huh?  We hope so.  For now it is supported for Binding only.

Video: Pete Brown demonstrates XAML debugging


A few things improved on the media front based on some feedback from our customers.  First, when having the need for low-latency sound (for things like audio loops, etc.) the MediaElement wasn’t doing the trick.  There were a few hacks you could do, but overall not ideal.  So remember how we did some fun things on the phone that allowed you to use XNA?  Well, now we have SoundEffect for Silverlight 5 as well.  This should look familiar if you are a Windows Phone developer:

   1: using Microsoft.Xna.Framework.Audio;
   3: // theStream is some audio stream you've retrieved
   4: // from a source
   6: SoundEffect se = SoundEffect.FromStream(theStream.Stream);
   7: se.Play();

Hopefully this will be a welcome addition for those working with audio.  You can also control the volume, pitch, etc. in the SoundEffect class.

Video: Pete Brown demonstrates low-latency sound

We also introduced a new feature that some affectionately call the “training video” feature.  Technically it’s called TrickPlay or variable speed playback.  This allows you to set a playback speed/rate on your MediaElement from 0.5-2 (where 1 is the normal playback of your media).  The idea is that you’d get media playback at your chosen speed but also proper audio pitch correction.  The code couldn’t be simpler:

   1: protected void SpeedUpTrainingButtonClicked(object sender, RoutedEventArgs args)
   2: {
   3:     trainingVideoMediaElement.PlaybackRate = 1.8;
   4: }

For the beta, the audio pitch correction isn’t yet available so when setting the PlaybackRate you’ll only see the video effect right now.

We have also enabled hardware decode for H.264 playback in this release!

^ back to top


We’ve made a few improvements to the Text stack.  We’re introducing a RichTextBoxOverflow element that will allow you to have linked text containers where the text flows to another element.  This will help with automatically laying out text in situations like mulit-column.  Here’s a snippet of what it might look like using element binding:

   1: <StackPanel Width="200">
   2:     <RichTextBox Width="50" Height="50"
   3:         OverflowContentTarget="{Binding ElementName=OverflowArea}">
   4:         <Paragraph>
   5:             This is some really long text that won't fit right into the main RTB control and should overflow into the area that I've defined in my XAML to be the other section.
   6:         </Paragraph>
   7:     </RichTextBox>
   8:     <RichTextBoxOverflow x:Name="OverflowArea" />
   9: </StackPanel>

This would render:

Linked Text Container

For the typography-philes in the Silverlight world, we’re adding tracking and leading support.  If those terms are foreign to you, you are not alone!  They basically provide more control over character spacing when text is rendered.  Example:

   1: <RichTextBox FontSize="12" CharacterSpacing="300" />

Would look like:

Text Tracking and Leading

A few things that we’re working on that aren’t in in the beta right now but we’re working on are improving text clarity using pixel-snapping and enhanced OpenType support.  Some of these were demonstrated at MIX so be sure to watch the keynote and session videos!

Video: Pete Brown demonstrates text in Silverlight 5

^ back to top

Data Binding

There are a few features that I categorize in this area of data binding.  They may all not directly be related, but I mentally put them in this category.  First we now support Implicit DataTemplates.  What this means is that you can specify a DataTemplate for a specific type in your binding.  Let’s use a simple example.  Let’s say I have an object Person which has FirstName, LastName, Title.  I now have another object called Manager, which inherits from Person and Employee which also inherits from Person.  If I was binding to a list box and wanted to list these people I could do something like this:

Class Code:

   1: void MainPage_Loaded(object sender, RoutedEventArgs e)
   2: {
   3:     List<Person> people = new List<Person>();
   5:     people.Add(new Manager() { FirstName = "Scott", LastName = "Guthrie", Title = "VP" });
   6:     people.Add(new Employee() { FirstName = "Tim", LastName = "Heuer", Title = "Minion" });
   7:     people.Add(new Manager() { FirstName = "Steve", LastName = "Ballmer", Title = "CEO" });
   8:     people.Add(new Employee() { FirstName = "Scott", LastName = "Hanselman", Title = "Open Source Fanatic" });
  10:     PeopleList.ItemsSource = people;
  11: }


   1: <ListBox x:Name="PeopleList">
   2:     <ListBox.Resources>
   3:         <DataTemplate DataType="local:Manager">
   4:             <Border Background="LightBlue">
   5:                 <StackPanel Orientation="Horizontal">
   6:                     <TextBlock Text="{Binding FirstName}" />
   7:                     <TextBlock Text="{Binding LastName}" />
   8:                 </StackPanel>
   9:             </Border>
  10:         </DataTemplate>
  11:         <DataTemplate DataType="local:Employee">
  12:             <Border Background="Bisque">
  13:                 <StackPanel Orientation="Horizontal">
  14:                     <TextBlock Text="{Binding FirstName}" />
  15:                     <TextBlock Text="{Binding LastName}" />
  16:                 </StackPanel>
  17:             </Border>
  18:         </DataTemplate>
  19:     </ListBox.Resources>
  20: </ListBox>

which would render:

Implicit DataType Binding

This flexibility allows me to use binding on same shaped objects, but provide unique characteristics in my template where appropriate.

Video: Pete Brown demonstrates Implicit DataTemplates

Ancestor RelativeSource binding is also now supported which allows a DataTemplate to bind to a property of the element that contains it, like:

   1: <UserControl x:Class=”MyApplication1.UserControl1
   2:             xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation
   3:             xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml>
   4:     <ContentControl Tag=”SomeValue>
   5:         <HeaderdContentControl>
   6:             <HeaderedContentControl.Header>
   7:                 <TextBlock Text=”{Binding Tag, RelativeSource=
   8: {RelativeSource,AncestorType=ContentControl, AncestorLevel=2}}” />
   9:             </HeaderedContentControl.Header>
  10:             <Button>Click Me!</Button>
  11:         </HeaderdContentControl>
  12:     </ContentControl>
  13: </UserControl>

This has been a highly requested feature as well!

How about some custom MarkupExtensions?  Yes, that’s available now as well!  This will help with those who follow the MVVM pattern of development as well as those who have been yearning to be able to have their own expressions run on markup.  I’ve also thought people could use this to scaffold localization efforts as well around a MarkupExtension.  Maybe something like:

   1: <TextBlock Text="{local:ResourceLookup Path=MyResourceKey}" />

I think this will be a useful feature.  Of course you are required to actually write code for your extension!

Also in the beta is the ability to perform binding in Style setters.  These are some great improvements to our markup/binding story and features which you have been asking for so I can’t wait to see how they are used!

^ back to top


This is another general category I am including some features which are available in Silverlight 5.

First is what we call ClickCount.  This will help with basically doing the double-click tracking on elements in your application:

   1: private void CheckClick(object sender, MouseButtonEventArgs e)
   2: {
   3:     if (e.ClickCount == 2)
   4:     {
   5:         // double-click happened
   6:     }
   7: }

Video: Pete Brown demonstrates ClickCount usage

Next is multiple-window support.  This is the same Window element that the MainWindow shares and you are able to create numerous Windows that your application can interact with and show as separate windows in the OS.  This is not a ChildWindow implementation where they are all within the main object.  This feature is available to out-of-browser applications.  Once the main application is closed, all the Windows created from that will close as well.

Video: Pete Brown demonstrates multiple Windows

^ back to top

3D Graphics API

One of the coolest demos at the Silverlight Firestarter was the 3D demonstrations.  I don’t even claim to be close to a novice on 3D graphics, but I can’t wait to see what people do with the 3D APIs.  I would keep a watch on Rene Schulte as I’m positive he’ll have some cool stuff come out!  It’s hard to show a short snippet of 3D but here’s some effects you’ll be able to do:

Silverlight 3D Example

Be sure to watch out for more examples here to understand the capabilities.

Check out Rene Schulte and Andy Beaulieu for some good examples.  Here are some teasers:

^ back to top

Trusted Applications in Browser

A new feature we are bringing is the ability to do some of the “trusted” features in Silverlight in the browser.  This brings the current functionality of trusted applications in current form to be used in the browser context without having to be installed.  This still requires the XAP to have the ElevatedPermissions security setting in the manifest as it would exist with out-of-browser applications as well as the XAP being signed (and the certificate in the user’s trusted publisher store).

Additionally the requirement would be that a registry key be set on the machine to enable this.  This could be deployed via Group Policy or other desktop-management techniques.  Once these are in place, the application can take advantage of the elevated permissions feature set introduced in Silverlight 4, including things like full keyboard access in full-screen mode.

^ back to top

Trusted Applications Out-of-browser Enhancements

In addition to the new multiple Window support, trusted out-of-browser applications can now access the broader file system outside of the user’s “My Documents” type areas on the disk.  We hope this provides greater flexibility in the most trusted application area.

^ back to top

General “stuff”

In addition to the features noted above, here’s some things that are also included that I chose not to put in one of these categories and are implemented in the Silverlight 5 beta:

  • Startup performance improvements on multi-core systems (multi-core JIT)
  • ComboBox with type-ahead searching
  • DefaultFileName in SaveFileDialog!!!
  • Improvements in the graphics stack brought over from the Windows Phone codebase
  • Hardware acceleration in Windowless mode in Internet Explorer 9

You may be realizing there was a lot more shown at MIX keynote and will be discussed.  You’d be right.  There are a number of things we are still refining that aren’t in the current beta such as:

  • Vector printing
  • Power awareness for things like full-screen apps (i.e., don’t put me to sleep if I’m watching an awesome movie)
  • Remote control support allowing users to control media playback
  • OpenType support as previously mentioned
  • Text clarity improvements with pixel snapping as previously mentioned
  • A new DataContextChanged event
  • WS-Trust support for services
  • 64-bit support for the plugin
  • COM interop for trusted in-browser applications
  • P/Invoke for trusted applications
  • PivotViewer control improvements and distributed in the SDK

As you can see we’re still going to be busy and hope that you like what you see so far!

^ back to top

Summary and Feedback

Now you have some new toys to play with.  If you’ve read all this post then your tools should have been done downloading now, so go install them, watch some of Pete’s videos linked here and learn about the new features.  If you find issues please be sure to report the feedback (it is better to report bugs/issues via the official channels than as a comment here).  Also be sure to read the changes document to get an idea of how any changes may affect your applications.

Congratulations to the Silverlight 5 team (be sure to say hello to them at MIX if you are there) and we hope you like what you see and the direction we’re going to enable features you’ve been asking for in the platform.

Hope this helps!

Please enjoy some of these other recent posts...