Our overarching goal in writing this book was to give ASP.NET
developers the power to quickly and easily create visually stunning
Internet applications, coupled with rich interactivity to fully
immerse the user in a new online experience. Silverlight gives you
everything you need to do just this, and in serious style!
As well as taking you through each feature that ships with
Silverlight, this book will make sure you’re able to debug,
troubleshoot, and performance-tune your Silverlight applications,
as well as seamlessly hook into your existing ASP.NET architecture
and code base.
This book is aimed at .NET developers and architects who want to
quickly get up to speed with all that Silverlight 2 has to
As well as covering the breadth of features that Silverlight 2
provides, this book makes a point of demonstrating where necessary
how the particular feature can be integrated tightly with the
ASP.NET host application. An example is in Chapter 7, where the
ASP.NET Profile service is utilized directly from within
Silverlight to obtain user-specific data.
It’s fair to say that although this book is aimed at
ASP.NET developers, it covers all of the salient features of
Silverlight 2 to the degree that it’s a useful programming
resource for developers not using ASP.NET also.
If you’re fresh to .NET development, however, you might
want to check out a beginning .NET book first, to help you overcome
the syntax and set-up queries when learning a new language.
Otherwise, take a deep breath and dive in!
This book covers the full feature set of Silverlight 2, diving
into each of the subject areas to give depth and breadth coverage.
As well as teaching you about the component parts of the
Silverlight API, the book also covers debugging, troubleshooting,
and performance-tuning your Silverlight applications, arming you
with all the skills and knowledge you’ll need to create
advanced Silverlight-based applications in record time.
Importantly, this book covers the integration points between
ASP.NET and Silverlight, taking you through the different
techniques you can use to seamlessly augment your existing or new
ASP.NET web sites with the power of Silverlight.
If you want to program in Silverlight and potentially use
ASP.NET as the host, then this book covers it all.
The book is split into two distinct parts. Part I is titled
“Silverlight Fundamentals for ASP.NET Developers,” and
Part II is titled “Developing ASP.NET Applications with
Silverlight.” Part I is intended to give you grounding in
what Silverlight is as a technology and how it fits into the
Web-based landscape. The component pieces of a Silverlight
application are also laid out at a high level, and any knowledge
required before putting an application together is explained.
Part II is written to give you depth of knowledge across the
Silverlight feature-set and show you how to leverage the power of
both Silverlight and ASP.NET to create compelling applications.
A brief synopsis of the content follows:
“Silverlight in a Nutshell”—This will
teach you at a high level what Silverlight is and how it can help
you deliver engaging, immersive web applications. Differentiating
Silverlight from other Web-based technologies is also covered here,
and a description of the required development environment is
provided. In short, after reading this, you’ll be able to
describe Silverlight and explain why you’d want to use it and
what gives it the edge over the competition.
allows you to rapidly build a well-rounded application with a great
user interface, but if you encounter any problems during
development, it is going to be important for you to understand the
underlying architecture upon which you are developing. This
outlines the core features of Silverlight 2 and guides you around
the building blocks of this highly flexible framework, paying
particular attention throughout to your ASP.NET heritage.
“XAML Condensed”—Quickly getting up to
speed with XAML is what this is all about, helping you brush aside
the syntax queries and get to grips with the basics of this
multi-purpose declarative language. Hooking the XAML files up to
.NET code is also shown here, helping you inject dynamic
event-driven actions into your Silverlight UI. Finally, one
technique for the dynamic creation of XAML is shown, followed by a
tour of Expression Blend.
“Programming Silverlight”—By the time
you get here, you’ll be itching to start coding, and code you
will as the feature-agnostic programming constructs that make up a
Silverlight application are covered in detail. The composition of a
Silverlight application is laid bare and its constituent parts
explained at length, as well as detailing the Silverlight
application lifetime and how to hook into it. The different options
for embedding the Silverlight plug-in within your application are
associated DOM. This then leads onto a discussion of the
Silverlight Object Model, explaining how the visual tree is
constructed to form the UI. Another technique for dynamically
creating XAML and adding it to the visual tree is also shown here.
Finally, the Silverlight event model, browser interaction, and
threading model are covered for you.
“Creating the User Interface”—You now
know how to program Silverlight and how to write XAML. This shows
you how to put it all together to start laying out the user
interface of your Silverlight application. Each of the layout
controls that ship with Silverlight is covered
TabControl—including information on when to use
which one. Information on how to create a scalable UI is also
provided, followed finally by a section that details how to
localize your application, thereby making it available to other
languages and cultures.
“Silverlight Controls”—Silverlight 2
provides an assortment of controls that can be used to display and
capture data. In this, you’ll learn to work with user input
controls, items controls, and media controls and see how they can
be put to use to build interactive and rich user interfaces.
You’ll also learn how to use controls such as the
MultiScaleImage control to work with
Silverlight’s Deep Zoom technology.
“Styles and Templates”—Altering the
look and feel of your application is the crux here, with the
different techniques for applying styling information to the
controls that comprise it demonstrated here. As well as this,
integrating with the ASP.NET Profile service via WCF is detailed,
giving you the ability to personalize your Silverlight application
on a per-user basis.
“User Interaction”—What’s the
point of having a great technology like Silverlight 2 if we
can’t interact with it? We review the different ways that you
can interact with your application, understanding how the
UIElements work with input devices like the keyboard,
mouse, and stylus. We also explore the different ways to navigate
around the application and present the different options that we
have and in which scenarios each one is preferred.
“Communicating with the Server”—The
ability to access data located at distributed sources is key in
many Silverlight 2 applications. You learn different networking
technologies that are available and see how they can be put to use.
Several different topics are covered such as creating and calling
Object Notation (JSON) data, pushing data from a server to a client
with sockets, and leveraging HTTP Polling Duplex functionality.
“Working with Data”—It is all about
data! One of my colleagues always says, “If you are not using
data binding in Silverlight 2, you are doing something
wrong!” This explains the data framework available within
your applications and then deeps dive into the inner workings of
data binding, showing you the different approaches that you may
take. In order to understand how the data is retrieved, we explain
the different technologies and techniques to get the most of
Silverlight 2 data using the available data controls. Finally, this
explains how you can manipulate the data using LINQ and LINQ to
“Creating Custom Controls”—This will
take you on a journey in order to discover the different options
that you have available to customize the Silverlight 2 controls. We
start exploring the user control model that ASP.NET developers are
used to, and then we dig into the internals of visual
customization. You will be amazed by this powerful new model.
Finally, for those who need to push the technology to the limit,
this explains how to create a complete custom control from
“Securing Your Silverlight
Application”—Whether you’re an Enterprise
developer or a Silverlight hobbyist, you are going to want to
release your application out to the wild at some point. In doing
so, you are providing a high level of exposure to your application,
and therefore security should not be an afterthought. Thankfully,
Silverlight 2 has a security framework built into the run time,
which will give you the peace of mind of working within a secure
environment. This introduces you to the Silverlight security
framework, but also talks you through your security
responsibilities as a Silverlight developer.
“Audio and Video”—Embedding
high-fidelity audio and video in your Silverlight application is
sure to capture your users’ imaginations, and this shows you
how you can do just this using the Silverlight-provided
MediaElement control and the ASP.NET Media Server
Control. Playback control is demonstrated, as is the more advanced
topic of providing synchronization points within your chosen media.
This will definitely help you put the WOW factor into your web
“Graphics and Animation”—A detailed
tour of the graphics API that ships with Silverlight is first
discussed here, including the
that can be rendered to screen and also the
Geometry-derived objects that can be created and then
rendered via a
are covered next, demonstrating the
VideoBrush, and their
usage. Next up is the very cool DeepZoom technology, covering the
creation of DeepZoom-enabled images using the DeepZoom Composer and
their usage in your Silverlight application via the
MultiScaleImage control. Finally, the different
animation techniques that you can use within your Silverlight
application are covered, ranging from the basic From/To/By type to
the more advanced Key frame types, including the different
transition mechanisms within.
Applications”—Writing an application from start to
finish without any development issues is still quite some way off.
This introduces you to a range of techniques and tools to help you
through the hard times when your application isn’t behaving
as you would expect it to. Besides retrospectively fixing problems
within your application, this concludes with the more proactive
approach of ensuring that your application hits a known quality bar
before you are satisfied that it is ready to be released.
Silverlight’s testing framework is the flavor of the day
“Performance”—Silverlight is an
incredibly powerful and flexible framework. Its inherent
flexibility often means that there are several ways to achieve your
goals. In choosing an alternative path, you will often find that
the penalty is poor performance. This gives a series of
best-practice advice to allow you to make an informed decision when
you hit those forks in the road. In addition, you will learn how to
instrument your code in order to simply identify the bottlenecks
within your application.
To get the most out of this book, it’s recommended that
you code along with the examples provided, either by copying the
code shown in the chapters or by downloading the samples and
running them yourself.
To do this, you’re going to need Visual Studio 2008, which
is available to download from MSDN, provided you have a
subscription. As well as this, you’ll also need to download
and install the Silverlight Tools for Visual Studio 2008, which
allows you to create Silverlight-based applications within Visual
Studio. This install will also take care of installing the
Silverlight run time and SDK for you. You can download this
If you want to follow the examples that use Microsoft Expression
Blend or the Deep Zoom Composer, you can also download these from
As well as these software requirements, you will need a basic
working development knowledge of Microsoft .NET and have experience
in Web-based development. A passion for creating rich web
applications is advantageous, although not necessary!