Trying to wrap my head around the current situation with Silverlight 2 and 3 support in Visual Studio 2008 and 2010, I’m confused enough that I feel like shouting out a line from my daughter’s favorite Dr. Suess book, Fox in Socks: “Now wait a minute, Mr. Socks Fox”!!
It is a little confusing. But I think I now understand who supports what and I’ll take a stab at jotting it down, for future reference.
Visual Studio 2008 SP1
- Supports either Silverlight 2 or Silverlight 3, but not both on the same development machine
- Silverlight 2 — install using the Silverlight Tools for Visual Studio 2008 SP1
- Silverlight 3 — install using the Silverlight 3 Tools Beta for Visual Studio 2008 SP1
Visual Studio 2010
- Supports both Silverlight 2 and Silverlight 3
- Can install both on the same development machine
- Each Silverlight project targets one of the two Silverlight versions
- Silverlight 2 — need to install the Silverlight 2 SDK manually
- Silverlight 3 — install manually
Ok, as far as I can tell, that’s the current situation.
This basically boils down to two questions:
- Do I want to develop in Silverlight 2 or Silverlight 3?
- Silverlight 2 is more stable and is officially released
- Silverlight 3 (beta) — new controls, navigation framework, out-of-browser support
- Which version of Visual Studio do I want to use?
- VS 2008 — easier install experience, stable/released
- VS 2010 — improved tooling for Silverlight & WPF
The last point is what I want to talk about. Notice that improved tooling for Silverlight is a feature of Visual Studio, not of Silverlight itself. Visual Studio 2010 finally gives us full design-time drag-and-drop support for Silverlight.
Let’s see what this looks like. But first, let’s go back and take a look at the Silverlight design-time experience in Visual Studio 2008. (I’m using Silverlight 3 here).
The Bad Old Days – Visual Studio 2008 SP1
Until now, Silverlight developers haven’t had the most basic tooling enjoyed by even the lowliest VB6 developers. Namely — the ability to drag and drop controls onto a design surface and set their properties right in the designer.
Specifically, here’s what you couldn’t do. If you look at the split window for Silverlight controls in the designer, you’ll notice that the upper pane is labeled “Preview”.
This was a “Preview” pane because all it could do was to render your XAML on the screen as a preview of how it would eventually look in your Silverlight application. You couldn’t drag controls onto this surface. You also couldn’t select any controls in order to reposition them or to set their properties.
In Visual Studio 2008, if you try dragging Silverlight controls onto this Preview window, you just get a big fat “don’t do this” icon. Even sadder, you can’t select any controls. If you look at the properties window in Visual Studio, you just see the following sad message:
Thankfully, you could at least drag and drop controls down into your XAML. This would at least insert the proper XAML tags for the control that you’d selected. But you just got an empty tag. (In the picture below, I’ve just dragged a Button into my XAML).
And, although we weren’t able to set property values in the property editor, there was some consolation in that Intellisense worked in the XAML code.
So the Silverlight development environment was workable, but not ideal. Also, you could always author/edit your UIs in Expression Blend. But then there was a big learning curve to tackle.
Enter Visual Studio 2010
In Visual Studio 2010, we finally have full designer support for Silverlight applications. In the picture below, I’ve just dragged a Button from the toolbox onto the design surface.
It makes me want to weep. (Who would have thought that a developer would be so happy with being able to drag a button onto a form)?
Not only did the designer let me drag the button onto a design surface, but now it actually gives me a little more than an empty/default Button tag in my XAML. I actually get a sensibly configured button object, with a reasonable size and a preset label. Also notice that the upper pane is now labeled “Design”, rather than “Preview”.
But don’t weep yet. It gets better. You can actually left-click to select the button in the designer. When you do this, you’ll see that you can now actually set properties for the button in the property window.
Now you may weep or cheer, depending on your particular emotional reaction.
You’ll also notice that you can now click on the little event icon and then double-click to generate event handlers in your code-behind. (As opposed to using Intellisense in the XAML to discover relevant events).
This is great, although I still don’t understand why there is no dropdown in the properties window to select the individual controls. Is there a good reason why neither WPF or Silverlight applications allow selecting individual controls from the property window?
Also note that all of the above is possible in both Silverlight 2 and Silverlight 3.
Where Are We?
So clearly, Silverlight is now a full-fledged citizen in Visual Studio, with full tooling. This may not seem like much, but for anyone who works with Silverlight a lot, it will make a huge difference. Not to mention a much shallower learning curve for developers coming up to speed with Silverlight.
Mr. Socks Fox wasn’t spouting blibber blubber after all.