Preface

I would consider myself a web guy. When I first accessed the World Wide Web sometime around 1994, I immediately fell in love with its possibilities and technical challenges. From then on, I worked almost exclusively on web projects and did very little programming apart from that. As the years have passed, I have seen technologies come and go, but some of them stayed. For instance, I remember starting to work with ASP and PHP simultaneously around 1997 or 1998, and finally moving away from ASP because it was so limited. I returned to the ASP world when the first betas of ASP.NET were released, and my interest heightened when ASP.NET 2.0 came up, and it was off to the races again. (Today, I am happily using both.) I appreciate that my JavaScript knowledge is in demand again, thanks to one new term: Ajax.

One of the technologies I really developed a love-hate relationship with was Macromedia Flash (now Adobe Flash). I really like that the technology can do so much more than HTML and JavaScript, including everything you want to call “Ajax.” I am also happy that the browser plug-in has such an enormous market share. I really, really hate the Flash editor. The designers I work with are very happy with it, but from a developer’s perspective, I change into explicit lyrics mode whenever I have to use it. This is probably no surprise: Flash is historically a designer’s tool and has just recently begun to appeal to developers. I am a terrible designer, so I probably do not deserve better.

But still, Flash is a very nice technology because it combines advanced graphical features with powerful coding support. So, I was more than happy when I heard that Microsoft was working on a similar technology: Silverlight. (No one at Microsoft will ever tell you that there is a connection between Silverlight and Flash, and that’s probably true, but it serves to point out similarities and differences.) Knowing that Microsoft has always been a very developer-friendly company, I expected Silverlight to have the features of Flash, with a better development experience (at least for me). And, to be honest, the first steps that were released as “Silverlight 1.0” were really promising. Most programming is done in trusted Visual Studio, but there are designer tools as well. Microsoft still has a long way to go, with the tool and market share, but the first steps are done, and I look forward to seeing the next ones.

As Silverlight 2 evolved during its beta phase, this book adapted to each new version, allowing us to release an update to Essential Silverlight 2 Up-to-Date whenever a new, significant Silverlight release came out of the Redmond labs. Since Silverlight 2 has gone RTM (release to manufacturing), this book has been updated one last time as well (until, of course, a second edition of the final, printed version is due). We will add errata and late-breaking changes on the book’s catalog page at http://www.oreilly.com/catalog/9780596519988.

Who This Book Is For

There are two target audiences for this book: developers who would like to familiarize themselves with the Silverlight technology, and designers who would like to see what Silverlight has to offer. I’ve chosen to focus on the developer. True to the promise of an O’Reilly Essentials book, Essential Silverlight 2 Up-to-Date is not a complete reference or an in-depth tutorial. Instead, you will quickly learn how to get Silverlight 2 up and running, learn what this new platform has to offer, and put its capabilities to the test through the dozens of working code examples. Support for Silverlight from Microsoft and third parties continues to grow, and whenever possible we point you to sources for further reading that you can turn to for information.

This book covers Silverlight 2. For details on Silverlight 1.0, you can refer to my book Essential Silverlight 1.0 (O’Reilly). Although knowledge of Windows Presentation Foundation (WPF) is not required, if you have already worked with it, it has many similarities with the Silverlight UI framework. From a programming point of view, JavaScript and C# are the languages of choice. If you have not worked with either language before, refer to the O’Reilly catalog for some excellent choices.

How This Book Is Organized

Part 1 contains background information on Silverlight and related technologies.

Chapter 1

A brief introduction to Silverlight and other rich Internet applications

Chapter 2

Introduces WPF and how it relates to Silverlight

Chapter 3

Goes through all the required installation steps and steps for creating your first Silverlight application

Chapter 4

Reviews software tools that facilitate the creation of Silverlight content

Part 2 focuses on the results you can achieve with the declarative means of Silverlight, but some C# coding will also be covered.

Chapter 5

Features the most important elements of Microsoft’s WPF markup language

Chapter 6

Explains how Silverlight applications may become interactive by processing events

Chapter 7

Exposes two different approaches to making Silverlight animations dynamic

Chapter 8

Shows how to use audio and video data in Silverlight applications, including C# access

Chapter 9

Demonstrates the UI components that ship with Silverlight 2

Chapter 10

Explains the use of data binding in a Silverlight 2 application

Chapter 11

Shows the use of styles and templates to give applications a consistent look

Part 3 focuses on C# development aspects.

Chapter 12

Reviews which additional ASP.NET web controls facilitate the embedding and creation of Silverlight content

Chapter 13

Shows Silverlight features to access data via the network, including HTTP resources and Windows Communication Foundation (WCF) services, and also covers security topics

Chapter 14

Explains how Silverlight can access local files on the client machine and how to store data locally

Part 4 focuses on JavaScript development aspects.

Chapter 15

Describes how to access Silverlight content from JavaScript, including interaction between managed and JavaScript code

Chapter 16

Shows advanced JavaScript possibilities, including the ability to make HTTP requests

Appendix A

Provides a list of properties and methods the Silverlight plug-in exposes

What You Need to Use This Book

For developing Silverlight content, you need only a text editor. It is much more convenient is to use Visual Studio 2008 or the (free) Visual Web Developer Express Edition 2008 (however, the former option is preferable). Chapter 3 covers these and additional tools. Chapter 2 guides you through all the necessary installation steps both for developing and for viewing Silverlight content.

Conventions Used in This Book

The following typographical conventions are used in this book:

Italic

Indicates new terms, URLs, email addresses, filenames, and file extensions.

Constant width

Used for program listings, as well as within paragraphs to refer to program elements such as variable or function names, databases, data types, environment variables, statements, and keywords.

Constant width bold

Shows commands or other text that should be typed literally by the user.

Constant width italic

Shows text that should be replaced with user-supplied values or by values determined by context.

Tip

This icon signifies a tip, suggestion, or general note.

Caution

This icon indicates a warning or caution.

Using Code Examples

This book is here to help you get your job done. In general, you may use the code in this book in your programs and documentation. You do not need to contact us for permission unless you’re reproducing a significant portion of the code. For example, writing a program that uses several chunks of code from this book does not require permission. Selling or distributing a CD-ROM of examples from O’Reilly books does require permission. Answering a question by citing this book and quoting example code does not require permission. Incorporating a significant amount of example code from this book into your product’s documentation does require permission.

We appreciate, but do not require, attribution. An attribution usually includes the title, author, publisher, and ISBN. For example: “Essential Silverlight 2 Up-to-Date by Christian Wenz. Copyright 2008 O’Reilly Media, Inc., 978-0-596-519-988.”

If you feel your use of code examples falls outside fair use or the permission given here, feel free to contact us at .

How to Contact Us

Please address comments and questions concerning this book to the publisher:

O’Reilly Media, Inc.
1005 Gravenstein Highway North
Sebastopol, CA 95472
800-998-9938 (in the United States or Canada)
707-829-0515 (international or local)
707-829-0104 (fax)

We have a web page for this book, where we list errata, examples, and any additional information. You can access this page at:

http://www.oreilly.com/catalog/9780596519988

Register this book for updates at:

http://register.oreilly.com

To comment or ask technical questions about this book, send email to:

For more information about our books, conferences, Resource Centers, and the O’Reilly Network, see our web site at:

http://www.oreilly.com

Acknowledgments

I have expressed the thought on various occasions that technical book authors should not thank their partners/kids/dogs and pretend that writing a book put their private and social lives at risk. In prefaces of fiction or memoirs you never read such complaints, but in technical books they seem to be all too common. I have written several dozens of those and always managed to juggle work and play.

This time, however, I understood. I wrote this book on an extremely tough schedule so that it could be published in time for the Silverlight release. So, I had to work crazy hours and neglect some things and some people. (Not that I haven’t done that in the past, but this time it was worse than usual.) Therefore, thanks to all who suffered in one way or another—you know who you are.

I also have to thank my editor at O’Reilly, John Osborn, for joining forces with me again. Andrew Savikas got me set up with DocBook and also tried to convince me that writing a book in XML was not too bad (I still want my word processor back). Keith Fahlgren and Abby Fox set up the Subversion repository, implemented the automated PDF build, and also cleaned up my DocBook mess from time to time. Laurel Ruma and Audrey Doyle copyedited the text, and I don’t know which they cursed more: my writing or my XML. Yvonne Schimmer provided me with video material for the chapter on multimedia and supported the rest of the book as well. Special thanks as well to Todd Anglin, who contributed the content that appears in Chapter 1.

This book would not have been possible without the support from people within Microsoft who provided me access to preview bits of Silverlight and additional, nonofficial resources. These people include Scott Guthrie, Brian Goldfarb, Chung Webster, and Vivek Dalvi. Thank you very much for your trust and support.

Get Essential Silverlight 2 Up-to-Date now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.