Getting Started with the Silverlight 5 Release Candidate

Editor's Note: The Following is a guest post by Silverlight MVP Michael Crump.

Introduction

The final release of Silverlight 5 is coming up shortly, but that does not mean that we cannot go ahead and get our feet wet with the recently released bits. The release candidate was announced on September 1st, 2011 and is freely available to download right now. I personally consider this an important release and it adds many improvements including XAML Debugging, Multiple Windows Support, Linked Text Containers, 3D Graphics and much much more.

Today, I will show you where to download the bits and highlight several important features of Silverlight 5 that I think business developers would benefit the most from. By the end of this article, you should have enough information to go ahead and get started building your first Silverlight 5 Application.

Before we get started downloading the tools, I wanted to point out some a webinar that I recently did for Silverlight Show titled “Getting Started with Silverlight 5”. Several people have emailed me and found it useful for their learning and I hope you are able to get something out of it as well.  

Source Code

The source code to all samples provided in this article and more can be found here.

Getting Started

Let’s go ahead and get started by downloading the tools needed to build a Silverlight Application. I would like to point out that before we get started that you can install the beta on top of the final release of Silverlight 4.

  • Visual Studio 2010 SP1 or Visual Web Developer Express 2010 SP1 is required to develop Silverlight 5 Applications.  Visual Studio 2010 SP1 or Visual Web Developer Express 2010 SP1.
  • After you have installed VS2010 SP1 or Visual Web Developer Express 2010 SP1 then you will need to download and install the Silverlight 5 Tools for Visual Studio 2010 SP1.
  • This download will install all components necessary for Silverlight 5 RC  and Microsoft WCF RIA Services V1 SP2 RC development:
    • Silverlight 5 RC Developer Runtime
    • Silverlight 5 RC SDK (software development kit)
    • Update for Visual Studio 2010 Service Pack 1 and Visual Web Developer Express 2010 Service Pack 1 (KB2502836)
    • Microsoft WCF RIA Services V1.0 SP2 RC
  • You should also install the Expression Blend Preview for Silverlight 5. The current version of Expression Blend 4 will not allow you to make changes to your Silverlight 5 UI. 
  • I always like to have a local copy of the help documentation on my hard drive in case I need to read it while on a flight or if my internet is down. So, I would recommend downloading the Silverlight 5 SDK CHM Help documentation. It is around ~75MB, but well worth it in those tight situations. 

A couple of optional files are located below. Most of these tools are automatically installed when you installed the Silverlight 5 Tools.

  • For reference purposes, the developer runtimes are available here for Windows and Mac OS.
  • The WCF RIA Services v1 SP2 RC can be found here but as mentioned earlier it is installed with the Silverlight 5 Tools.
  • I found the Silverlight 5 Features list helpful for understanding what is and isn’t included in the release.
  • You can also download the Silverlight 5 SDK but it is also installed with the Silverlight 5 Tools.

After Installation

One of the first things you are going to notice after installation is when you create a new Silverlight project in Visual Studio 2010 that you have the following option right after you type a name for your project.

You also have the ability to select Silverlight 3 or 4 from this drop-down. Let’s go ahead and look at a few key features. Don’t worry about the source code to the applications and I will provide a link at the end of the article with everything you need.

XAML Binding Debugging

One of the things that I looked forward to most in this release was the support of XAML Binding Statements Debugging. Let me go ahead and show you a screenshot.

Do you see the breakpoint that I inserted on the HyperlinkButton line? Now before you get all trigger happy you will want to know that you can only insert a breakpoint on a line that has the {Binding } expression. 

Let’s just say that you had an error on a Binding expression. You would simply add the breakpoint to the line that wasn’t binding properly and run the application (with the debugger of course) and you would see the following in your locals window:

It is very easy to debug Binding expressions now with that feature. Another great feature is that if you have the Silverlight 5 Beta installed then your Silverlight 4 applications automatically get access to the debugging feature.

Multiple Window Support

Imagine having the ability to spawn multiple windows from an Out-of-Browser application with elevated trust with just a couple of lines of code. Well, you now have that ability with Silverlight 5.

Linked Text Containers

This feature enables the text of a RichTextBlock control to overflow from one into the next. Multiple RichTextBlockOverflows can be chained together to spread text across a layout. Let’s go ahead and take a look at a screenshot of a RichTextBlock with a RichTextBlockOverflow working together.

As you can see from this screenshot, we had a RichTextBlock in the upper left and its content overflowed onto the RichTextBlockOverFlow #1, #2 and #3. You can think of this as something that is similar to a newspaper article. As the browser expands or contracts the content fills the available area.

NOTE: Post-beta, Microsoft changed this to use the non-editable RichTextBlock instead of RichTextBox. So a word of warning, many post-beta demos of this functionality on the web will no longer work. You can view my Silverlight 5 demo page for a working demo of this functionality.

Conclusion

We have downloaded the required tools and became familiar with some of the new features in Silverlight 5 including XAML Debugging, Multiple Windows and Linked Text Containers. The Silverlight 5 Release Candidate actually contains a lot more things that I didn’t have room to cover. I would recommend you to explore P/Invoke which would allow you to do cool things such as detect when a USB drive is inserted into the computer. If you wish to see the source code for the features I showed today as well as other Silverlight 5 features then visit this page. I would also invite you to connect with me on Twitter and subscribe to my blog. Thank you for reading.

Author's Bio

Michael Crump is a Silverlight MVP and MCPD that has been involved with computers in one way or another for as long as he can remember, but started professionally in 2002. After spending years working as a system administrator/tech support analyst, Michael branched out and started developing internal utilities that automated repetitive tasks and freed up full-time employees. From there, he was offered a job working at McKesson Corporation and has been working with some form of .NET and VB/C# since 2003.

He shares his findings in his personal blog: https://michaelcrump.net and he also tweets at:@mbcrump