Chapter I: Introducing Silverlight

Posted by Apress Free Book | Silverlight December 04, 2008
Tags: silverlight
If you are already a .NET developer, you will be in familiar territory after learning XAML and its features. The correspondence of XAML to classes in .NET is a major strength, and the tool support built around XAML for designers and developers is strong and growing.

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 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

Total Pages : 6 12345