Creating Your First Application
Since Visual Studio 2008 supports .NET 3.0 and 3.5, WPF application support is already built in. However, since the release of Visual Studio 2008 preceded Silverlight 2.0, Silverlight support is not provided out of the box. After you install the Silverlight 2.0 SDK, Visual Studio 2008 gains support for building Silverlight 2.0 applications and class libraries, and adds a read-only design surface and appropriate IntelliSense in the XAML editor. While Visual Studio is an established tool targeted to developers, tool support for WPF and Silverlight for both designers and developers is necessary. This need is satisfied by the Expression suite of products from Microsoft.
Let's install the Silverlight 2.0 SDK and briefly explore it and one of the Expression tools.
Visit http://silverlight.net/GetStarted/ and download Microsoft Silverlight Tools for Visual Studio 2008. This single download includes the SDK for Visual Studio 2008 (Standard edition and above) and the runtime for Silverlight 2.0.
Two more tools are available at this page: Expression Blend and the Deep Zoom Composer. If you have seen the Hard Rock Memorabilia site, you have seen a product of the Deep Zoom Composer. This technology will be discussed when we take a closer look at media support in Silverlight in Chapter 5. For now, just download and install Expression Blend 2.5 Preview.
When you edit a XAML file in a WPF application using Visual Studio, you have access to a toolbox of controls, a design surface onto which you can drag and drop controls, and a text editor view of the XAML code. When you edit a XAML file in a Silverlight application, you still have these three elements, but the design surface is read-only. This is probably a result of the Silverlight package being an add-on to Visual Studio. One thing you can do, though, is drag and drop controls from the toolbox onto the text editor. This can help a lot when you want to work with XAML exclusively in Visual Studio.
You can use Expression Blend if you want a full drag-and-drop user interface construction tool for Silverlight. It's possible to use Expression Blend simultaneously with Visual Studio. Modifications to both XAML files and the project/solution file are fine, since when you switch from one tool to the other, the tool will reload the updated files.
Start by loading Visual Studio 2008 and creating a new project (see Figure 1-1).
Figure 1-1. The New Project dialog in Visual Studio 2008
After you click OK, the next dialog allows you to create a web site/web application project that hosts the Silverlight application (see Figure 1-2).
Figure 1-2. The Add Silverlight Application dialog in Visual Studio 2008