Download Wiley Silverlight 1.0
Transcript
28401ftoc.qxd:WroxPro 9/12/07 9:36 PM Page xi Contents x xix xxi AL Acknowledgments Foreword Introduction RI Chapter 1: Introduction to Silverlight What Is Silverlight? TE What Does DOM Really Mean? MA Silverlight Versions Explained Getting the Silverlight Plug-In Getting the Silverlight SDK Building Silverlight Applications GH Understanding XAML Summary TE D Creating the Silverlight Object in HTML Silverlight Object Attributes Adding Multiple Silverlight Objects to a Page Resizing a Silverlight Control Displaying in Full Screen Mode RI Chapter 2: Building Silverlight Applications Using XAML PY Rendering Silverlight Content Working with XAML in This Chapter Layout of Silverlight Content CO Positioning Objects Using ZIndex Positioning Objects Using Transforms Drawing with Text and Brushes Using the TextBlock Object Creating Hyperlinks Silverlight Video Adding Video to Web Pages Supported Audio and Video Formats Interacting with the MediaElement Object Using Markers and Timelines in Video Painting Video onto Objects Creating Video Reflections Animating Silverlight Elements Summary 1 1 4 5 6 9 13 17 18 20 21 23 25 27 29 29 30 31 34 38 41 41 43 45 46 46 47 49 52 53 56 58 28401ftoc.qxd:WroxPro 9/12/07 9:36 PM Page xii Contents Chapter 3: Designing Silverlight Applications Using Expression Blend 2 Getting the Latest Blend 2 Preview Creating a New Silverlight Project 60 60 The Silverlight Project Starter Template Blend Workspace Overview Layout and Design in Blend 61 62 74 Creating and Understanding Timelines 79 Understanding Storyboards in Silverlight Creating a Timeline 80 80 Working with Artwork Created Outside of Blend Designing with Blend/Silverlight in Mind Exporting to XAML in Other Tools Summary Chapter 4: Coding Silverlight Applications with JavaScript and XAML The JavaScript Programming Model Creating the Player Using JavaScript 84 84 86 89 91 92 92 Refactoring the Silverlight Player Creation 95 Dissecting the Silverlight.js Helper Library 96 createObject and createObjectEx isInstalled Accessing the Silverlight Player Object Accessing XAML Content Locating XAML Content Elements Getting and Setting XAML Properties Instantiating and Inserting XAML Elements Examining Events in Silverlight Player Events XAML Element Events Accessing Storyboards Programmatically Using the Downloader Object Downloading Packages Downloading Fonts Using JavaScript and the MediaElement Using DownloadProgressChanged and BufferingProgressChanged Events Working with Markers Summary xii 59 96 103 104 105 105 106 108 113 113 115 125 128 131 133 134 136 137 138 28401ftoc.qxd:WroxPro 9/12/07 9:36 PM Page xiii Contents Chapter 5: Using Silverlight with ASP.NET Creating Custom Controls Setting Up the Project Adding the Silverlight JavaScript Library Adding Xaml Control Properties Rendering the Xaml Control Using ASP.NET AJAX with Silverlight Refactor into a ScriptControl Adding Client-Oriented Properties Creating the Client-Side (JavaScript) Default Type Embedding and Registering the New Client-Side Type Implementing AJAX Extension Methods Creating Dynamic Silverlight User Interfaces with ASP.NET Creating the Button Template Creating the ButtonBar Server-Side Code Creating the ButtonBar Client-Side Code Using the ButtonBar Control Final Thoughts/Recommendations Summary Chapter 6: Silverlight 1.1 and the CLR The CLR The Framework Base APIs Data APIs Communications APIs Presentation APIs Debugging Dynamic Language Support A Quick Silverlight 1.1 Example Summary Chapter 7: Video Player: Silverlight 1.0 Case Example Getting Started Designing the Application Architecture Designing the User Interface Managing the Developer/Designer Workflow Preparing the Media for the Application Creating the Data Layer 139 142 142 146 150 154 158 158 160 161 164 164 166 166 170 178 184 187 187 189 191 192 193 194 195 196 199 199 199 200 201 202 202 202 204 205 206 xiii 28401ftoc.qxd:WroxPro 9/12/07 9:36 PM Page xiv Contents Creating the Host Web Page Coding Lumos Scene Class Button Class VideoArea Class Summary Appendix A: Silverlight Object Reference ArcSegment BeginStoryboard BezierSegment Canvas ColorAnimation ColorAnimationUsingKeyFrames ColorKeyFrame ColorKeyFrameCollection DiscreteColorKeyFrame DiscreteDoubleKeyFrame DiscretePointKeyFrame DoubleAnimation DoubleAnimationUsingKeyFrames DoubleCollection DoubleKeyFrame DoubleKeyFrameCollection Downloader DrawingAttributes Duration Ellipse EllipseGeometry FontFamily GeometryCollection GeometryGroup Glyphs GradientStop GradientStopCollection Image ImageBrush InkPresenter KeyboardEventArgs KeySpline KeyTime xiv 207 208 209 216 217 220 221 221 221 222 222 222 223 223 223 224 224 224 224 225 225 225 225 226 226 226 227 227 227 228 228 228 229 229 229 230 230 230 231 231 28401ftoc.qxd:WroxPro 9/12/07 9:36 PM Page xv Contents Line LinearColorKeyFrame LinearDoubleKeyFrame LinearGradientBrush LinearPointKeyFrame LineBreak LineGeometry LineSegment MatrixTransform MediaAttributeCollection MediaElement MouseEventArgs ParserErrorEventArgs Path PathFigure PathFigureCollection PathSegmentCollection PointAnimation PointAnimationUsingKeyFrames PointCollection PointKeyFrame PointKeyFrameCollection PolyBezierSegment Polygon Polyline PolyLineSegment PolyQuadraticBezierSegment QuadraticBezierSegment RadialGradientBrush Rectangle RectangleGeometry RepeatBehavior ResourceCollection RotateTransform Run RuntimeErrorEventArgs ScaleTransform Silverlight Control SkewTransform SolidColorBrush SplineColorKeyFrame SplineDoubleKeyFrame 231 232 232 232 232 233 233 233 233 234 234 234 235 235 235 236 236 236 236 237 237 237 238 238 238 239 239 239 239 240 240 240 241 241 241 241 242 242 242 242 243 243 xv 28401ftoc.qxd:WroxPro 9/12/07 9:36 PM Page xvi Contents SplinePointKeyFrame Storyboard Stroke StylusInfo StylusPoint StylusPointCollection TextBlock Timeline TimelineCollection TimelineGroup TimelineMarker TimelineMarkerCollection TimelineMarkerEventArgs TimeSpan TransformCollection TransformGroup TranslateTransform TriggerAction TriggerActionCollection TriggerCollection UIElementCollection VideoBrush 243 243 244 244 244 244 245 245 245 246 246 246 246 247 247 247 247 248 248 248 248 249 Appendix B: XAML Reference 251 Introducing XAML Silverlight XAML Basics Declaring Objects in XAML 251 253 255 Object or Content Element Syntax Attribute Element Syntax Property Element Syntax Setting a Property Using Implicit Collection Syntax Deciding When to Use Attribute or Property Element Syntax to Set a Property XAML Hierarchy Adding XAML Objects to the Silverlight Object Hierarchy Events and the Silverlight Control Code Behind and x:Name Silverlight Player Events Defining Event Handlers Defining Events in JavaScript Referencing the Silverlight Control Summary xvi 255 255 256 256 258 258 260 261 262 264 266 268 269 272 28401ftoc.qxd:WroxPro 9/12/07 9:36 PM Page xvii Contents Appendix C: Silverlight Online Resources 273 Author Blogs Silverlight Influential Blogs Resource Web Sites 273 273 274 Index 275 xvii 28401ftoc.qxd:WroxPro 9/12/07 9:36 PM Page xviii