ptg From the Library of Lee Bogdanoff Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. ptg Praise for Essential Silverlight 3 “Essential Silverlight 3 is not only filled with technical details, clear examples, and performance tips that will make any Silverlight application better, but Ashraf also includes insights that can only come from one of the lead devel- opers of the Silverlight runtime. From graphics, to text, to media—this book contains all the information you need on the core Silverlight 3 runtime.” —Brad Abrams, product unit manager, Microsoft “The third iteration of Silverlight is a big step forward in true line-of-business capability for RIAs. Ashraf takes these new concepts and puts them forth in a meaningful and concise read.” —Jason Beres, Microsoft MVP; author; INETA Speaker “Essential Silverlight 3 is truly an essential book in the library of any Silverlight developer. The ‘Under the Hood’ portions of each chapter explain the details of Silverlight’s implementation, and the ‘Performance Tips’ explain how to use that information to get the most out of your soft- ware. I am very grateful I don’t have to track down or figure out all of this critical information on my own.” —Noah Gedrich, director of technology, BLITZ Agency “Ashraf Michail delivers an insightful and practical book for anyone seeking to better understand, master, and unlock the full potential of Silverlight 3. It is filled with code samples, performance tips, and other useful advice to help you create truly outstanding Silverlight applications.” —Oleg Kokorin, CEO, MS Team, LLC “Essential Silverlight 3 tackles in depth a rich, vast platform. The author has a depth of knowledge and technical insight that is present throughout, providing a pleasing ‘why’ on top of the usual ‘how.’” —Richard Leggett, interactive developer “This is a book of inestimable value on Silverlight. Even experienced Silverlight developers will learn from Essential Silverlight 3.” —Mark Monster, software engineer, Rubicon From the Library of Lee Bogdanoff Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. ptg “A great reference and textbook on Silverlight 3.” —Judith Myerson, systems architect and engineer “Chock full of performance tips and information about Silverlight internals that you won’t find anywhere else.” —Jeff Prosise, cofounder, Wintellect “Skillfully written, comprehensively explained, and logically delivered. Essential Silverlight 3 is undoubtedly a must-have study and keep- on-your-desk practical guide for building a wide range of high-value rich Internet applications.” —Ash Rofail, CEO, Santeon, Inc. “Essential Silverlight 3 is a must-read for anyone who wants a better understanding of the Silverlight Framework. In his book, Ashraf Michail, architect on the Silverlight team, offers unique insights into Silverlight’s architecture and design principles, along with guidance on how to improve the overall quality and performance of Silverlight applications.” —Gerhard Schneider, senior development lead, Microsoft “Essential Silverlight 3 does not just get your feet wet—its technical insights and performance tips take you for a deep dive into the Silverlight ocean.” —Velvárt András, Silverlight MVP; founder, Response Ltd. “This book really lives up to the title—Essential, indeed. Anyone doing Silverlight 3, or looking to get started with it, needs this book close at hand.” —Chris G. Williams, Microsoft MVP and principal consultant, Magenic Technologies “A must-read for all software developers who are trying to build rich Silverlight applications with great performance—it provides many useful performance tips. I would recommend it to anyone trying to improve performance of Silverlight 3 applications.” —Radenko Zec, senior software developer, Lanaco; INETA group leader, Banjaluka, Bosnia and Herzegovina From the Library of Lee Bogdanoff Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. ptg Essential Silverlight 3 From the Library of Lee Bogdanoff Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. ptg T he award-winning Microsoft .NET Development Series was established in 2002 to provide professional developers with the most comprehensive, practical coverage of the latest .NET technologies. Authors in this series include Microsoft architects, MVPs, and other experts and leaders in the field of Microsoft development technologies. Each book provides developers with the vital information and critical insight they need to write highly effective applications. Visit informit.com/msdotnetseries for a complete list of available products. Microsoft ® .NET Development Series From the Library of Lee Bogdanoff Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. ptg Ashraf Michail Essential Silverlight 3 Upper Saddle River, NJ • Boston • Indianapolis • San Francisco New York • Toronto • Montreal • London • Munich • Paris • Madrid Capetown • Sydney • Tokyo • Singapore • Mexico City From the Library of Lee Bogdanoff Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. ptg Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and the publisher was aware of a trademark claim, the designations have been printed with initial capital letters or in all capitals. The .NET logo is either a registered trademark or trademark of Microsoft Corporation in the United States and/or other countries and is used under license from Microsoft. Microsoft, Windows, Visual Basic, Visual C#, and Visual C++ are either registered trademarks or trademarks of Microsoft Corporation in the U.S.A. and/or other countries/regions. The author and publisher have taken care in the preparation of this book, but make no expressed or implied warranty of any kind and assume no responsibility for errors or omissions. No liability is assumed for incidental or consequential damages in connection with or arising out of the use of the information or programs contained herein. The publisher offers excellent discounts on this book when ordered in quantity for bulk purchases or special sales, which may include electronic versions and/or custom covers and content particular to your business, training goals, marketing focus, and branding interests. For more information, please contact: U.S. Corporate and Government Sales (800) 382-3419 corpsales@pearsontechgroup.com For sales outside the United States, please contact: International Sales international@pearson.com Visit us on the Web: informit.com/aw Library of Congress Cataloging-in-Publication Data Michail, Ashraf. Essential Silverlight 3 / Ashraf Michail. p. cm. Includes index. ISBN 978-0-321-55416-1 (pbk. : alk. paper) 1. Silverlight (Electronic resource) 2. Multimedia systems. 3. Websites—Design. 4. Application software—Development. I. Title. QA76.575.M52187 2009 2009 006.7—dc22 2009026788 Copyright © 2010 Pearson Education, Inc. All rights reserved. Printed in the United States of America. This publication is protected by copyright, and permission must be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permissions, write to: Pearson Education, Inc. Rights and Contracts Department 501 Boylston Street, Suite 900 Boston, MA 02116 Fax: (617) 671-3447 ISBN-13: 978-0-321-55416-1 ISBN-10: 0-321-55416-7 Text printed in the United States on recycled paper at RR Donnelley in Crawfordsville, Indiana. First printing, September 2009 From the Library of Lee Bogdanoff Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. ptg To my mother, for a lifetime of encouragement. From the Library of Lee Bogdanoff Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. ptg This page intentionally left blank From the Library of Lee Bogdanoff Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. ptg Contents Figures xvii Foreword xxiii Preface xxv Acknowledgments xxix About the Author xxxi 1 Silverlight Overview 1 Silverlight Principles 3 Web Deployment 3 Security 3 Media and Rich Internet Applications 4 Ease of Development 5 Cross Platform 5 Silverlight Features 6 Application Model 7 Graphics 7 Text 7 Input 8 Animation 8 Layout 8 Media 8 Controls 9 Data Binding 9 ix From the Library of Lee Bogdanoff Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. [...]... watermark From the Library of Lee Bogdanoff Figures FIGURE 1.1: Example Silverlight sites shown at http:/ /silverlight. net/showcase 2 FIGURE 1.2: Installing a Silverlight application so that it can run outside the Web browser 2 FIGURE 1.3: Visiting a Silverlight Web page without installing the Silverlight runtime 4 FIGURE 2.1: Visual Studio Silverlight application project 14 FIGURE 2.2: Hello World application... watermark From the Library of Lee Bogdanoff Silverlight Principle s 3 In this chapter, you will learn • The Silverlight design principles • The features available in Silverlight • The Silverlight application improvements you can make by understanding the Silverlight internals Silverlight Principles With Silverlight, you can write applications that • Deploy through a Web browser • Run in a secure environment... always stays up to date You must install the Silverlight runtime to view Silverlight content If a user has not installed the Silverlight runtime, Silverlight pages typically display a prompt to install the runtime, as shown in Figure 1.3 As Silverlight adoption continues to increase, fewer users will need to download the runtime to view your content If the Silverlight runtime is not present, a user can... writing your first Silverlight applications or if you are an expert Silverlight developer, you will learn a lot from this book For the beginner, this book explains the concepts required to write your applications For the advanced Silverlight developer, you will find in-depth information on how Silverlight works “under the hood” and how to use that information to get the most out of Silverlight Prerequisites... install a Silverlight 3 application on your computer and run it when not connected to a network as shown in Figure 1.2 Figure 1.1: Example Silverlight sites shown at http:/ /silverlight. net/showcase Figure 1.2: Installing a Silverlight application so that it can run outside the Web browser Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark From the Library of Lee Bogdanoff Silverlight. .. is implemented in Silverlight and how you can use that information to improve your applications Throughout the book, there are many Performance Tips and Technical Insights The book consists of the following 12 chapters: • Chapter 1, Silverlight Overview,” is an introduction to Silverlight and the content in the remainder of the book Chapter 1 highlights the features that are new in Silverlight 3 and... RIAs with Silverlight, including email applications, business applications, social networking applications, mashup creation tools, casual games, high quality image viewers, ads, and a variety of other Internet applications You can find some example applications at http://www .silverlight. net/showcase, as shown in Figure 1.1 Silverlight consists of a runtime that users can download to view Silverlight. .. Bogdanoff 2 Chapter 1: Silverlight Over view Silverlight includes a version of the NET Common Language Runtime (CLR) to let you write code in NET languages such as C# or Visual Basic The Silverlight features include vector graphics, text, animation, layout, video playback, audio playback, data access, and controls for your media and rich Internet applications In addition to running Silverlight content... a set of tools, and libraries for your applications End users can download the free runtime from http://www .silverlight. net to run Silverlight applications You can develop Silverlight applications with Visual Studio using familiar NET languages Designers can create artwork and animation for Silverlight using tools such as Expression Blend and Expression Design or import assets from other popular design... Composer In addition to the default libraries built into the Silverlight runtime, you can download a variety of libraries from http://www.codeplex.com/ Silverlight You can use these libraries in your applications, modify the source code, or use it as an example for how to write Silverlight components In this book, you will learn how to build a Silverlight application and use features such as graphics, . for Essential Silverlight 3 Essential Silverlight 3 is not only filled with technical details, clear examples, and performance tips that will make any Silverlight. Beres, Microsoft MVP; author; INETA Speaker Essential Silverlight 3 is truly an essential book in the library of any Silverlight developer. The ‘Under the Hood’