Book Image

MCTS: Microsoft Silverlight 4 Development (70-506) Certification Guide

By : Johnny Tordgeman
Book Image

MCTS: Microsoft Silverlight 4 Development (70-506) Certification Guide

By: Johnny Tordgeman

Overview of this book

Microsoft Silverlight is a powerful development platform for creating engaging, interactive applications for many screens across the Web, desktop, and mobile devices. Silverlight is also a great (and growing) Line-Of-Business platform and is increasingly being used to build data-driven business applications. Silverlight is based on familiar .NET languages such as C# which enables existing .NET developers to get started developing rich internet applications almost immediately. "MCTS: Microsoft Silverlight 4 Development (70-506) Certification Guide" will show you how to prepare for and pass the (70-506): TS: Microsoft Silverlight 4 Development exam.Packed with practical examples and Q&As, MCTS: Microsoft Silverlight 4 Development (70-506) Certification Guide starts by showing you how to lay out a user interface, enhance the user interface, implement application logic, work with data and interact with a host platform amongst others.
Table of Contents (15 chapters)
MCTS: Microsoft Silverlight 4 Development (70-506) Certification Guide
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface

Chapter 1. Overview of Silverlight

Just like everything in life, we start things off with an overview. If you have picked up this book on purpose, then I'm sure you have at least some idea what Silverlight is. But, if you just picked this book because the cover looked inviting, fear not, as this chapter will provide all the basics you'll need in your journey to become a certified Silverlight guru.

As Confucius once said, "A journey of a thousand miles begins with a single step", so let's take the first step now and get to know all the basics of Silverlight.

In this chapter we will cover the following topics:

  • What is Microsoft Silverlight

  • Introducing XAML

  • The Silverlight application model

  • Integrating Silverlight with HTML

  • In and out-of-browser support

  • Self-test (Q&A)

What is Microsoft Silverlight

Silverlight is Microsoft's cross-platform, cross-browser, and a .NET-based framework for building in and out-of-browser Rich Internet Applications (RIAs). In simple words, you can write Silverlight applications using a language you already know (be it C# or VB), and run it on all major operating systems (such as OSX, Windows, and Linux) and browsers (such as Internet Explorer, Chrome, Firefox, and Safari).

It's worth noting that the Linux variation of Silverlight is not developed or maintained by Microsoft. Moonlight, which is the name of the Linux variation, is developed by the Mono project with aid from Microsoft and Novell, and is primarily targeted for Linux and other Unix/X11-based operating systems. In addition, your Silverlight application doesn't have to stay inside the browser. Using the out-of-browser capabilities of Silverlight, you can take your application out of the browser and into the desktop, but we will learn more on that later.

Using Silverlight you can build just about anything—from a simple media player that streams movies from your server, to a complex line of business (LOB) application that fetches data from a database and uses some business logic to transform that data into a visually stunning executive dashboard with interactive charts and gauges.

Many companies nowadays are using Silverlight to enrich their applications. Take a look at Seesmic Desktop 2 for example (http://www.seesmic.com/products/desktop), which is a social media tool for Windows and Mac built entirely in Silverlight.

The main competition to Silverlight comes from Adobe Flash. Both are browser plugins targeting rich media applications. While not a direct competitor, HTML5 can also be considered as an alternative in some cases. While Silverlight has matured into a rich line of business platform that is getting increasingly popular for creating intranet applications, HTML5 offers greater reach, as it can be viewed on more devices. But, it is also much harder to develop the same level of business applications using HTML5 instead of Silverlight.

In addition, the HTML5 specifications are not finalized yet and, thus, not all the browsers implement it evenly. For example, while some browsers fully support the Canvas control, others support just some of its features, making it difficult to use the "code once, run everywhere" approach.

Whether you are an ASP.NET developer trying to decide if Silverlight is the right technology for your next project or you are a part of a development team in a big enterprise, here are some reasons to use Silverlight over other technologies:

  • Cross-browser and OS support: The code you write will run exactly the same on every supported browser and OS, so you don't have to waste time with making your application supportable on other browsers than your own

  • Authoring tools: Silverlight is developed on Visual Studio 2010, which you, as a .NET developer, already know and love

  • Plugins with a small size: The Silverlight plugin weighs just a few megabytes, which is a small size compared to the entire .NET framework

  • .NET-based framework: Silverlight is based on the .NET framework, which means that if you are already a .NET developer, learning Silverlight will be like a walk in the park

  • Out-of-browser support: The ability to take your application out of the web world and into the desktop world opens a lot of opportunities to enrich the user's experience from your application

  • Enterprise-ready: Silverlight can integrate with components such as Microsoft Enterprise Library 5 (http://msdn.microsoft.com/en-us/library/ff648951.aspx) and WCF RIA services (http://msdn.microsoft.com/en-us/library/ee707344%28v=vs.91%29.aspx), so you can complete the development of your LOB applications faster and more efficiently

  • Prism: The Microsoft patterns and practices group has published Prism, which guides you on how to increase modularity and helps you to architect your application better

The adoption rate of Silverlight has recently reached the 70 percent milestone (http://www.riastats.com/), which means that almost every three out of four PCs already have Silverlight installed! With the rise in the adaptation rate comes the rise in the need for developers. A leading job-hunting site—http://www.dice.com/—has recently found that Silverlight-related jobs experienced a 12.6 percent growth in demand over the last three months, while Adobe Flash-related jobs experienced just 2.2 percent growth over the same period of time (http://www.readwriteweb.com/enterprise/2011/05/it-hiring-and-salaries-up---wh.php). In addition, Silverlight is the language of choice to develop applications for Microsoft's newest mobile phone system—Windows Phone 7, which means that if you know Silverlight, you are not only a web and desktop developer, you are also a mobile developer!

If I have to sum up the last paragraph in simple words, I would say that you couldn't have picked a better time to become a certified Silverlight developer.

Now that you know what Silverlight is, what it can do, and why you should use it, let's move on to set up your development environment. Your development environment requires the following hardware and software components:

  • A 1.6 GHz or faster CPU

  • At least 1 GB RAM for 32-bit OS or 2 GB RAM for 64-bit OS

  • 3 GB of available hard disk space

  • A PC running Windows XP/Vista/7/Server 2003/Server 2008

Setting up your development environment

Setting up your development environment is as easy as it can get. The process consists of three downloads (two are mandatory and one is optional) and the installation of those components.

The first thing you need is Visual Studio 2010. If you have Visual Studio 2008 or an earlier version, you will need to upgrade it, as the Silverlight 4 developer tools don't support these versions. You can download a free version of Visual Studio 2010 from the Microsoft website at http://www.microsoft.com/express/Downloads/.

Once you have Visual Studio 2010 installed, you will need the Silverlight 4 developer tools. These tools add the support for developing and designing Silverlight 4 applications in Visual Studio 2010. If you have Service Pack 1 for Visual Studio 2010 installed, you already have the tools; if not, you can get them either by using the installed Microsoft/web platform located at http://www.microsoft.com/web/gallery/install.aspx?appid=silverlight4tools;silverlight4toolkit;riaservicestoolkit or downloading the Microsoft Silverlight 4 Tools for Visual Studio 2010 directly from http://go.microsoft.com/fwlink/?LinkID=177428.

The last thing you should download and install is the Silverlight 4 Toolkit from CodePlex. This toolkit adds new components and functionality to the developer tools, and it is highly recommended that you install it. This toolkit can be downloaded from http://silverlight.codeplex.com/releases/view/43528.

Note

While it is completely possible to develop Silverlight 4 applications without the Silverlight 4 Toolkit, it is highly recommended that you download it as it adds many frequently used components, such as an auto-complete box, to the arsenal of components that you can use in your applications.

Now you have a fully equipped development environment for Silverlight. With this accomplishment, we can move on and talk about the first major concept of working with Silverlight—XAML.