Adam Nathan is a senior software development engineer for Microsoft and the founding developer of Popfly, Microsoft’s first product built with Silverlight. He is the author of the best-selling
Windows Presentation Foundation Unleashed (Sams, 2006),
.NET and COM: The Complete Interoperability Guide (Sams, 2002), a coauthor of
ASP.NET: Tips, Tutorials, and Code (Sams, 2001), and a contributor to books such as
.NET Framework Standard Library Annotated Reference, Vol. 2 (Addison-Wesley, 2005) and
Windows Developer Power Tools (O’Reilly, 2006).
Adam regularly speaks at development conferences and to internal groups within Microsoft about a variety of .NET topics. Having started his career on Microsoft’s Common Language Runtime team in 1999, Adam has been at the core of .NET technologies since the very beginning. Adam is also the creator of popular tools and websites for .NET developers, such as PINVOKE.NET (and its Visual Studio add-in). You can find him online at www.adamnathan.net.
IntroductionIntroduction
In This Chapter
Who Should Read This Book?
Software Requirements
Code Examples
How This Book Is Organized
Conventions Used in This Book
Thank you for picking up Silverlight 1.0 Unleashed! Silverlight is changing the way many people think about designing and developing websites or web applications, and this book helps you take advantage of everything Silverlight enables. Silverlight makes it easier than ever to create rich web-based content or applications. And given that it's possible to use Silverlight without expensive development or design tools, learning Silverlight is a wonderful way for everyone from hobbyists to professionals to create compelling software.
As Silverlight was developed, it was obvious that a new wave of books would appear in the marketplace. But it wasn't clear to me that these Silverlight books would have the right balance to guide people through the technology while showing practical ways to exploit it. Therefore, I wrote Silverlight 1.0 Unleashed with the following goals in mind:
To provide a solid grounding in the underlying concepts in a practical and approachable fashion
To answer the questions most people have when learning the technology, and to show how commonly desired tasks are accomplished
To be an authoritative source, thanks to input from members of the Silverlight team who designed, implemented, and tested the technology
To be clear about where the technology falls short, rather than selling the technology as the answer to all problems
To be an easily navigated reference that you can constantly come back to
I hope you find this book to exhibit all these attributes.
Who Should Read This Book?
This book is for software developers and designers who are interested in creating compelling web-based content, applications, or controls. This book contains a lot of content to help you get the most out of Silverlight, regardless of your prior experience with other technologies. And even if you are already well versed in Silverlight, I'm confident that this book still has something to teach you. At the very least, it should be an invaluable reference for your bookshelf.
To summarize, this book
Covers everything you need to know about Extensible Application Markup Language (XAML) in Silverlight
Examines the Silverlight feature areas in incredible depth: graphics, text, audio, video, animation, ink, events, and more
Demonstrates how to create reusable controls and perform common tasks (such as drag-and-drop) using basic building blocks
Explains how to download assets asynchronously to maximize your user experience
Demonstrates how to create hybrid applications that mix Silverlight content with HTML or Flash content in powerful ways
Highlights features scheduled for future versions of Silverlight while showing how to achieve your desired results with the current version
Examples in this book appear in XAML, HTML, and JavaScript. You do not need to be familiar with these languages in order to understand this book.
By focusing on version 1.0, this book clearly shows what you can and can't accomplish with the first version of Silverlight. If you are interested in learning about future Silverlight features in more depth, Windows Presentation Foundation (WPF) Unleashed provides a good preview of the direction Silverlight is heading (which is to more closely resemble the feature set of WPF).
Software Requirements
Three pieces of software are required to use the samples in this book:
Version 1.0 or later of Silverlight, which can be freely downloaded from http://www.silverlight.net.
An operating system supported by Silverlight. Version 1.0 supports Windows XP or later (including the non-IA64 server versions) and Mac OS X 10.4.8 or later (either PowerPC or Intel). Future versions of Silverlight will support additional operating systems. (For example, the next version should support Windows 2000.) Note that the .NET features in future versions of Silverlight may only support Intel Macs, but all the features in 1.0 are supported on both architectures.
A web browser supported by Silverlight. Version 1.0 supports Internet Explorer 6 or later, Firefox 1.5 or later, and Safari 2.0.4 or later (on Mac OS X only). Future versions of Silverlight will support additional web browsers.
If you want to run the samples on Linux instead, you can use Moonlight, Novell's open source implementation of Silverlight for Linux. The plan (not yet realized at the time of writing) is for Moonlight to run on all Linux distributions and support the Firefox, Opera, and Konqueror browsers.
Although a lot of Silverlight development can be done with a simple text editor, you can be more productive with the following recommended software:
For developers, Microsoft Visual Studio 2008 or later, which can be a free Express edition downloaded from http://msdn.microsoft.com. (Visual Studio 2005 can be used as well, but the JavaScript editor isn't as rich, and the XAML editor comes with a separate downloadthe extensions for .NET Framework 3.0 development available from MSDN.)
For designers, Microsoft Expression Studio. Within this suite, Expression Blend is specifically designed for creating XAML-based user interfaces (whether based on Silverlight or WPF), even animated ones. Expression Encoder, covered in Chapter 10, "Audio and Video," makes it easy to produce compellingeven interactiveaudio and video content optimized for Silverlight.
Code Examples
The source code for examples in this book can be downloaded via http://www.informit.com/title/9780672330070 or http://www.adamnathan.net/silverlight.
How This Book Is Organized
This book is arranged into three parts:
Part I: Fundamentals
Part II: Creating Static Content
Chapter 3: "Shapes, Lines, and Curves"
Chapter 4: "Text"
Chapter 5: "Brushes and Images"
Chapter 6: "Positioning and Transforming Elements"
Part III: Making Your Content Come to Life
Chapter 7: "Responding to Input Events"
Chapter 8: "Downloading Content on Demand"
Chapter 9: "Animation"
Chapter 10: "Audio and Video"
The first two chapters explain the fundamentals. Chapter 1 focuses on ways to get Silverlight content into a web page and your options for how it interacts with HTML. Chapter 2 explores XAML in great depth, giving you the foundation to understand the XAML you'll encounter in the rest of the book and in real life.
Part II covers the variety of static content that Silverlight is capable of rendering. This not only includes text and images, but also sophisticated vector-based content. Chapter 6 ends Part II by showing how to arrange, resize, and even transform multiple pieces of content in rich ways.
The final part of the book explains how you can make your otherwise static content come to life. Chapter 7 is the most important chapter for developers because Silverlight's input events make it possible to create an interactive application. Chapter 8 demonstrates how you can greatly improve the experience with large content by downloading it on-the-fly and showing slick progress indicators. And with animation, audio, and video (covered in Chapters 9 and 10), yo...