分享
Silverlight 2 Unleashed.pdf
下载文档

ID:3340737

大小:42.35MB

页数:567页

格式:PDF

时间:2024-03-02

收藏 分享赚钱
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,汇文网负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。
网站客服:3074922707
Silverlight Unleashed
Table of ContentsCopyright.1Foreword.4About the Author.5Acknowledgments.6We Want to Hear from You!.7Introduction.9About Code in This Book.9One Year Older.10Chapter 1.Introducing Silverlight.11Where Does Silverlight Come From?.12Using Third-Party Plug-Ins.15Running on Multiple Platforms.17Making the Web Application Secure.18Introducing S.19What Do You Need to Run Silverlight?.19Updating Your RuntimeAutomatically.20Trying Silverlight Demos.20What Do You Need to Develop Silverlight?.24Reading the Documentation.25Looking into Silverlights Future.27Summary.28Chapter 2.Understanding XAML.29Using XML for Data.29Using XML for User Interfaces.31Understanding XML Namespaces.31Defining Additional Namespaces.32Creating a Canvas with Children.33Attaching Properties:Canvas.Left and Canvas.Top.34Documenting Your Markup with XML Comments.35Testing XAML Markup.35Setting Properties in XAML.38Changing Brushes.40Composing Scenes in XAML.40Saving Typing,Saving Space.42Summary.43Chapter 3.Playing with XAML Transforms and Animations.45Transforming Visuals.45Types of Transforms.47Composing Transforms.52Creating a Basic Animation.54Understanding the Animations Elements.55Adding a Scale Animation.57Using Other Types of Animations.58Deploying the Scene to a Web Page.60Summary.60Chapter 4.Expression Blend.61The Expression Studio in Short.61Installing Expression Blend.62Starting Expression Blend.62Setting Options.63Creating a New Project.64Understanding the Panels.65Looking at the Files.66Silverlight 2 UnleashedExecuting in the Web Browser.67Working with Shapes.67Using the Properties Panel.68Using the Color Picker.69Creating a 3D Border Effect Using RadialGradientBrush.71Resetting Properties to Their Default Value.72Composing the Elements Hierarchy.72Summary.73Chapter 5.Using Media.75Mixing Colors.75Seeing Through the Transparency Channel.77Seeing Through the Opacity.79Using Vector Graphics.80Adding Media to Your Scenes.82Controlling Sound and Video.88Checking the Other Properties.91Using Media to Write.92Transforming Media.94Using Web-Based Media.94Summary.95Chapter 6.Blending a Little More.97Creating Transforms.97Creating an OpacityMask.98Using Paths.100Clipping Path.102Grouping Controls.103Making a User Control.106Working on the Thumbnails Gallery.109Summary.113Chapter 7.Deploying to a Web Page.115Creating a Test Page.115Understanding the object Tag.117Detecting Silverlight.122Integrating Silverlight in an Existing Web Page.123Getting Web Space.128Getting Started with FTP.130Copying Your Silverlight Application.132Summary.134Chapter 8.Programming Silverlight with JavaScript.137Learning the Basics.138Understanding the Concept of Objects.144Using the Literal Notation JSON.146Static Members.148Loading Scripts in a Web Page.149Understanding the Context.150Integrating Silverlight in an Existing Web Page Using JavaScript.151Debugging.158Summary.159Chapter 9.Understanding.NET.161History of.NET.161Downloading and Installing Visual Studio 2008.164Creating a Silverlight 2 Application in Visual Studio 2008.164Intellisense.170Programming C#with Basic Constructs.171Summary.182Chapter 10.Progressing with.NET.183Programming with Objects in C#.183Adding Interactivity to the Thumbnails Application.189Silverlight 2 UnleashedOverloading Methods.193Raising Events and Using Delegates.194Storing Data on the Client.198Summary.205Chapter 11.Progressing with Animations.207Animating Elements in Blend.207Synchronizing Animations.212Reversing a Storyboard.214PointAnimation.214Starting and Stopping the Animation.216Working on the Thumbnails Gallery.218Summary.229Chapter 12.Encoding Videos with Expression Encoder.231Before We Start.231Introducing Expression Encoder.232Setting Options.232Understanding the Panels.233Importing a Video.234Saving your Changes.235Specifying the Output Type.235Testing Before Encoding.239Setting Metadata.240Encoding the Video for Silverlight.243Checking the Result.244Advanced Parameters.245Summary.246Chapter 13.Progressing with Videos.247Why Streaming?.247Publishing on Your Own Website.248Adding an Overlay.249Letting Your Users Choose the Player.253Publishing on Microsoft Silverlight Streaming Servers.258Adding the Application in an Existing Web Page.260Firing Script Commands(and Catching Them).262Modifying the Player Template in Blend.264Summary.267Chapter 14.Letting.NET and JavaScript Talk.269Making.NET Available to JavaScript.269Handling.NET Events in JavaScript.271Calling JavaScript Methods from.NET.275Calling.NET Methods from JavaScript.277Adding a“Login”Dialog to the Thumbnails Application.278Summary.297Chapter 15.Digging into Silverlight Elements.299Exploring the Class Hierarchy.299Choosing XAML or Code-Behind.301Packing and Laying out with Panels.304Scrolling and Bordering.315Using Pop-Ups.318Drawing Shapes.319Summary.321Chapter 16.Digging Deeper into Silverlight Elements.323Understanding the Control Class.323Discovering Basic Controls.325Picking Dates with Calendar and DatePicker.333Writing with Ink.335Making a Simple Drawing Application.336Presenting Data with ItemsControls.343Silverlight 2 UnleashedDeep Zooming Your Image Collection.345Summary.348Chapter 17.Using Resources,Styling,and Templating.349Storing Items in Collections.350Using ResourceDictionaries in Silverlight.351Styling a Control.356Styling the Thumbnails Application.360Embedding Fonts in the Application.362Templating the Lookless Control.364Summary.369Chapter 18.Data Binding and Using Data Controls.371Understanding Data Binding.371Digging in the Binding Class.377Setting the DataContext.378Using Data Controls.380Using XML Data Sources.394Summary.394Chapter 19.Creating User Controls and Custom Controls.395Creating a Thumbnails Viewer User Control.395Creating the Items and Designing a DataTemplate.405Creating a MediaInfoDisplay Custom Control.413Summary.422Chapter 20.Taking Silverlight 2 One Step Further.423Creating a Default Template for the MediaInfoDisplay Control.423Using the MediaInfoDisplay Control.425Scrolling the Items.430Creating a New RepeatButton Template.433Exporting Classes to an External Assembly and Refactoring.437Talking About the Application Object.442Using Generics.444Summary.445Chapter 21.Taking Silverlight 2 Even Further.447Registering Multiple JavaScript Event Handlers.448Finding Silverlight Elements in JavaScript.449Accessing the HTML Page From.NET.451Exchanging Data Between.NET and JavaScript.453Passing Initialization Parameters.461Attaching.NET Events to HTML Elements.462Publishing Directly from Visual Studio.465Debugging Your Silverlight Application.466Summary.473Chapter 22.Connecting to the Web.475Creating and Loading an XML File.475Loading a Zip File and Showing Progress.488Making Requests to WCF Services.496More Connectivity.505Summary.506Chapter 23.Placing Cross-domain Requests and Handling Exceptions.507Placing Cross-domain Requests.507Communicating with Third-Party Services.511Placing POST Requests.524Throwing and Catching Exceptions.525Summary.533Chapter 24.Silverlight:Continuing the Journey.535Updating a Service Reference.535Killing a Process.536Silverlight 2 UnleashedAbout Protecting Your Work.538Binding in Special Configurations.539Using the ASP.NET Controls Silverlight and MediaPlayer.544Creating Unit Tests for Silverlight.549Making or Buying XAML Resources.557Using Third-Party Controls and Libraries.560Reading Silverlight-Related Blogs.561Summary.561Silverlight 2 UnleashedSilverlightUNLEASHED800 East 96th Street,Indianapolis,Indiana 46240 USALaurent BugnionSilverlight 2 UnleashedPage 1Return to Table of ContentsSilverlight 2 UnleashedCopyright 2009 by Pearson Education,Inc.All rights reserved.No part of this book shall be reproduced,stored in a retrievalsystem,or transmitted by any means,electronic,mechanical,photocopying,recording,or otherwise,without written permission from the publisher.No patent liability isassumed with respect to the use of the information contained herein.Although everyprecaution has been taken in the preparation of this book,the publisher and authorassume no responsibility for errors or omissions.Nor is any liability assumed fordamages resulting from the use of the information contained herein.This material may be distributed only subject to the terms and conditions set forth inthe Open Publication License,v1.0 or later(the latest version is presently available athttp:/www.opencontent.org/openpub/).ISBN-13:978-0-672-33014-8ISBN-10:0-672-330148Library of Congress Cataloging-in-Publication DataBugnion,Laurent.Silverlight 2.0 unleashed/Laurent Bugnion.-1st ed.p.cm.ISBN 978-0-672-33014-81.Silverlight(Electronic resource)2.Multimedia systems.3.User interfaces(Computer systems)4.Application software-Development.I.Title.QA76.575.B84 2008006.7-dc222008040836Printed in the United States of AmericaFirst Printing October 2008TrademarksAll terms mentioned in this book that are known to be trademarks or service markshave been appropriately capitalized.Sams Publishing cannot attest to the accuracy ofthis information.Use of a term in this book should not be regarded as affecting thevalidity of any trademark or service mark.Warning and DisclaimerEvery effort has been made to make this book as complete and as accurate as possi-ble,but no warranty or fitness is implied.The information provided is on an“as is”basis.The author and the publisher shall have neither liability nor responsibility to anyperson or entity with respect to any loss or damages arising from the informationcontained in this book.Bulk SalesSams Publishing offers excellent discounts on this book when ordered in quantity forbulk purchases or special sales.For more information,please contactU.S.Corporate and Government Sales1-800-382-For sales outside of the U.S.,please contactInternational SEditor-in-ChiefKaren GettmanExecutive EditorNeil RoweDevelopment EditorMark RenfrowManaging EditorPatrick KanouseProject EditorMandie FrankCopy EditorGeneil BreezeIndexersTim WrightBrad HerrimanProofreaderDeborah WilliamsTechnical EditorsJ.Boyd NolanMartha RotterPublishing CoordinatorCindy TeetersDesignerGary AdairCompositorBronkella Publishing,LLCSilverlight 2 UnleashedPage 2Return to Table of ContentsDedicationHow to write this book without your never-ending,ever patientsupport,Chi Meei This was once again a crazy project,and Icouldnt have done it without your approval and your help.By yourconstant support and the energy and dedication you put into shield-ing me from the small worries of life,you made this book possible.Ilove you.To Alise and Laeticia,my two princesses.Before you appeared in mylife,I thought I was happy.Now I know something big was missing.I love you both so much.Un jour sans danser est un jour perduMaurice BjartJe ne sais pas ce qui est beau,mais je sais ce que jaimeet je trouve a amplement suffisant.Boris VianLe Pote est semblable au prince des nuesQui hante la tempte et se rit de larcher;Exil sur le sol au milieu des hues,Ses ailes de gant lempchent de marcher.Baudelaire LAlbatrosSilverlight 2 UnleashedPage 3Return to Table of ContentsForewordThere are two undeniable trends in the software development world.The first is towardweb style deployment of applications.The web is quickly maturing as an applicationdelivery platform,and increasingly,web applications are seen as the right solution formany styles of applications.The second is toward richness of applications.User experi-ence is becoming increasingly important;consumer-facing applications attracting andretaining users has never been harder and even small usability improvements often makethe difference.In business applications,CIOs are realizing that if they can save even a fewseconds on every transaction by making employees more effective they can save millionsof dollars.Not surprisingly,Silverlight 2 sits squarely in this sweetspot.Silverlight 2 is a web application technology.The Silverlight runtime itself is smaller thanthe average Britney Spears song and is seamless to install on any browser(InternetExplorer,Firefox,Safari,and so on)and on any platform(Windows,Mac,Linux).Silverlight applications are small and fast to deploy and have zero impact on the clientmachine.There is no install or uninstall step for Silverlight applications,and all theseapplications run in a sandbox that ensure they cannot harm user machines or otherapplications.Silverlight 2 enables building great user experiences.Through the power of the conver-gence around video,vector graphics and a powerful developer framework,Silverlight isthe ideal platform for UX.Developers have full expressiveness with the power of the CLRunder the hood in Silverlight.The C#and VB languages allow developers to be productivetoday without learning new languages and development tools.The XAML markup allowsdesigners to use Expression and other design tools to build great transitions and anima-tions so that applications look and feel great.All of this together enables Silverlight appli-cations to deliver more productive experiences to end users helping them get their jobsdone faster.This book unleashes Silverlight for you.Laurent not only has a deep understanding ofSilverlight,where it is now and where it is going,but he also deeply understands realworld programming concerns.This book will make learning Silverlight fun.I cant wait to see what you build with it.Brad AbramsProduct Unit ManagerMicrosoft Corporationhttp:/ 2008Silverlight 2 UnleashedPage 4Return to Table of ContentsAbout the AuthorLaurent Bugnion works as a senior software developer and architect in Switzerland,wherehe lives with his wife,Chi Meei,and his two daughters,Alise(2001)and Laeticia(2004).Originally an electronics engineer from the Engineering School of Yverdon(Switzerland),his interests quickly moved to software,and he achieved a post-graduate degree in soft-ware engineering in 1999 in the Engineering School of Rapperswil(Switzerland).Currently,his interests are very much set on WPF,Silverlight,and other.NET 3.5 tech-nologies,which he helped introduce,teach,and coach at Siemens for the past three years.Prior to that,he first wrote embedded C/C+,and then moved to desktop computers inJava,JavaScript,and eventually.NET(WinForms and ASP.NET).After more than 12 yearsspent developing various software products at Siemens,Laurent is employed sinceDecember 2008 by IdentityMine,one of the worlds leading firms in WPF and Silverlightdevelopment and design.Privately,Laurent has also been active,developing websites and web applications inHTML,JavaScript,CSS,ASP,and currently ASP.NET.He has done his best to contribute tovarious developers communities,first in the JavaScript newsgroups,and then inMicrosofts forums related to ASP.NET,C#,WPF,and Silverlight.He blogs regularly onhttp:/blog.galasoft.ch and publishes articles,prototypes,and demos related to thementioned technologies.Laurent became a Microsoft Most Valuable Professional(MVP)in 2007 for ASP.NET andthen in 2008 for Client Application Development.In 2008,he also earned an MCTS forWindows Presentation Foundation.Silverlight 2 UnleashedPag

此文档下载收益归作者所有

下载文档
收起
展开