Pro Silverlight 3 in C# docx

834 1.7K 0
Pro Silverlight 3 in C# docx

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

 CYAN   MAGENTA  YELLOW   BLACK   PANTONE 123 C Books for professionals by professionals ® Companion eBook Available Pro Silverlight in C# Dear Reader, Pro WPF in C# 2008 Pro ASP.NET 3.5 in C# 2008 (with Mario Szpuszta) Beginning ASP.NET 3.5 in C# 2008 Pro Silverlight in C# 2008 Your Brain: The Missing Manual Silverlight is a revolutionary browser plug-in that allows developers to create rich client applications that run inside the browser Like Adobe Flash, Silverlight supports event handling, two-dimensional drawing, video playback, networking, and animation Unlike Flash, Silverlight is tailored to NET developers Most impressively, Silverlight applications execute pure C# code The most exciting part of Silverlight is its cross-platform muscle Unlike ordinary NET applications, Silverlight applications run seamlessly in nonMicrosoft browsers (like Firefox) and on non-Microsoft platforms (like Mac OS X) Essentially, Silverlight is a scaled-down, browser-hosted version of NET— and that’s made it the most hotly anticipated technology that Microsoft’s released in years In this book, you’ll master Silverlight from the ground up No Silverlight experience is required—but if you’ve worked with Silverlight 2, you’ll appreciate the “What’s New” boxes that point out new features at the start of every chapter By the end of this book, you’ll have a solid understanding of the complete Silverlight platform, and you’ll be able to build anything from a slick business front-end to a browser-based game Welcome aboard! Matthew MacDonald MCSD, Microsoft Silverlight MVP THE APRESS ROADMAP Beginning Silverlight Pro Silverlight in C# Pro Business Applications with Silverlight Accelerated Silverlight Companion eBook Silverlight Recipes Pro Silverlight for the Enterprise Full Color Inside Pro Silverlight in C# Author of The EXPERT’s VOIce ® in Silverlight Pro Silverlight in C# Create cross-platform NET applications for the browser See last page for details on $10 eBook version Full Color Inside www.apress.com US $49.99 MacDonald SOURCE CODE ONLINE Matthew MacDonald Shelve in Web Development User level: Intermediate - Advanced www.it-ebooks.info this print for content only—size & color not accurate trim = 7" x 9.125"  spine = 1.90625"  832 page count www.it-ebooks.info Pro Silverlight in C# ■■■ Matthew MacDonald i www.it-ebooks.info ii www.it-ebooks.info Pro Silverlight in C# Copyright © 2009 by Matthew MacDonald All rights reserved No part of this work may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage or retrieval system, without the prior written permission of the copyright owner and the publisher ISBN-13 (pbk): 978-1-4302-2281-8 ISBN-13 (electronic): 978-1-4302-2382-5 Printed and bound in the United States of America Trademarked names may appear in this book Rather than use a trademark symbol with every occurrence of a trademarked name, we use the names only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark Lead Editor: Ewan Buckingham Technical Reviewer: Damien Foggon Editorial Board: Clay Andres, Steve Anglin, Mark Beckner, Ewan Buckingham, Tony Campbell, Gary Cornell, Jonathan Gennick, Michelle Lowman, Matthew Moodie, Jeffrey Pepper, Frank Pohlmann, Ben Renow-Clarke, Dominic Shakeshaft, Matt Wade, Tom Welsh Coordinating Editor: Anne Collett Copy Editor: Heather Lang and Tiffany Taylor Associate Production Director: Kari Brooks-Copony Production Editor: Brigid Duffy Compositor: Nancy Wright Indexer: John Collin Artist: April Milne Cover Designer: Anna Ishchenko Distributed to the book trade worldwide by Springer-Verlag New York, Inc., 233 Spring Street, 6th Floor, New York, NY 10013 Phone 1-800-SPRINGER, fax 201-348-4505, e-mail ordersny@springer-sbm.com, or visit http://www.springeronline.com For information on translations, please e-mail info@apress.com, or visit http://www.apress.com Apress and friends of ED books may be purchased in bulk for academic, corporate, or promotional use eBook versions and licenses are also available for most titles For more information, reference our Special Bulk Sales—eBook Licensing web page at http://www.apress.com/info/bulksales The information in this book is distributed on an “as is” basis, without warranty Although every precaution has been taken in the preparation of this work, neither the author(s) nor Apress shall have any liability to any person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly by the information contained in this work The source code for this book is available to readers at http://www.apress.com You will need to answer questions pertaining to this book in order to successfully download the code iii www.it-ebooks.info For my family iv www.it-ebooks.info Contents at a Glance ■About the Author xxii ■About the Technical Reviewer xxii ■Acknowledgments xxiv ■Introduction xxv ■Chapter 1: Introducing Silverlight ■Chapter 2: XAML .33 ■Chapter 3: Layout 61 ■Chapter 4:Dependency Properties and Routed Events .107 ■Chapter 5: Elements 135 ■Chapter 6: The Application Model 183 ■Chapter 7: Navigation .227 ■Chapter 8: Shapes and Geometries 253 ■Chapter 9: Brushes, Transforms,and Bitmaps .291 ■Chapter 10: Animation 325 ■Chapter 11: Sound, Video, and Deep Zoom 387 ■Chapter 12: Styles and Behaviors 425 ■Chapter 13: Templates and Custom Controls 449 ■Chapter 14: Browser Integration 491 ■Chapter 15: ASP.NET Web Services 517 ■Chapter 16: Data Binding 541 ■Chapter 17: Data Controls 585 ■Chapter 18: Isolated Storage 635 ■Chapter 19: Multithreading 657 ■Chapter 20: Networking 679 ■Index 727 v www.it-ebooks.info www.it-ebooks.info Contents ■About the Author xxii ■About the Technical Reviewer .xxiii ■Acknowledgments xxiv ■Introduction xxv Understanding Silverlight Silverlight System Requirements 12 Silverlight vs Flash 12 Silverlight and WPF 14 The Evolution of Silverlight 15 About This Book 17 What You Need to Use This Book 17 The Silverlight Toolkit 18 Code Samples 19 Feedback 19 The Last Word 19 ■Chapter 1: Introducing Silverlight Silverlight Design Tools Visual Studio vs Expression Blend Understanding Silverlight Websites Creating a Stand-Alone Silverlight Project Creating a Simple Silverlight Page Adding Event Handling Code Testing a Silverlight Application 11 Creating an ASP.NET-Hosted Silverlight Project 12 ASP.NET Controls That Render Silverlight Content 16 Mixing ASP.NET Controls and Silverlight Content 17 Silverlight Compilation and Deployment 17 Compiling a Silverlight Application 17 Deploying a Silverlight Application 19 Silverlight Core Assemblies 21 vii www.it-ebooks.info ■ CONTENTS Silverlight Add-On Assemblies 22 Assembly Caching 23 The HTML Entry Page 25 Sizing the Silverlight Content Region 27 Silverlight Parameters 27 Alternative Content 29 Creating a Friendly Install Experience 29 The Mark of the Web 30 The Last Word 31 ■Chapter 2: XAML .33 XAML Basics 34 XAML Namespaces 34 Core Silverlight Namespaces 35 Design Namespaces 36 Custom Namespaces 37 The Code-Behind Class 38 Naming Elements 39 Properties and Events in XAML 39 Simple Properties and Type Converters 41 Complex Properties 42 Attached Properties 44 Nesting Elements 45 Events 48 The Full Eight Ball Example 49 XAML Resources 50 The Resources Collection 50 The Hierarchy of Resources 51 Accessing Resources in Code 53 Organizing Resources with Resource Dictionaries 54 Element-to-Element Binding .56 One-Way Binding 56 Two-Way Binding 57 The Last Word 59 ■Chapter 3: Layout 61 The Layout Containers 61 The Panel Background 63 Borders 65 Simple Layout with the StackPanel 66 Layout Properties 68 Alignment 69 viii www.it-ebooks.info INDEX Text property, TextBlock, 140, 167 text selection, TextBox, 168 TextAlignment property, TextBlock, 141, 167 TextBlock, 139, 140—142 drop-shadow effects on, 318 FontFamily property, 141, 142, 143, 144 FontSource property, 144 Foreground property, 140, 294 gradient-filled TextBlock, 294 Inlines collection, 146 LineHeight property, 146 LineStackingStrategy property, 146 Run object, 145—146 TextDecorations property, 145 TextWrapping property, 146 transparency, 300 underlining, 145 TextBox, 139, 167—168 keyboard handling, 130, 132 TextChanged event, 117 TextChanged event, 117, 130 TextDecorations property, TextBlock, 145 TextFilter property, AutoCompleteBox, 171 TextWrapping property, TextBlock, 146, 167 themes, 472, 489 Themes folder, 477 Thickness structure, setting control margins, 70 thread affinity, 661 Thread class, 657, 659—670 Abort() method, 661, 670 creating thread wrapper, 664—665 creating worker class, 665—666 IsAlive property, 660 Join() method, 660 ManagedThreadId property, 660 marshalling code to user interface thread, 661—663 Name property, 660 pausing and resuming threads, 661 setting thread priorities, 661 Sleep() method, 660, 670 Start() method, 660, 664, 670 ThreadState property, 660 using thread wrapper, 667—668 thread pool threads, 672 thread wrapper, 664—665 creating worker class, 665—666 using, 667—668 threading cancelling long-running tasks BackgroundWorker class, 676— 678 ThreadWrapperBase class, 668— 670 dispatcher, 661 FindPrimesThreadWrapper class, 665—666 locking, 667 multithreading, 657—659 single-threaded apartment model, 661 ThreadPool class, 657 ThreadStart delegate, 659 ThreadState property, Thread class, 660 ThreadWrapperBase class, 664 cancelling long-running tasks, 668— 670 classes deriving from, 665 StartTaskAsync() method, 669 Status property, 664, 666 throttling, bit-rate, 398, 399 thumbnails creating image thumbnails for markers, 407 Tick event bomb-dropping game, 362 DispatcherTimer class, 394, 659 DispatcherTimer property, 364 Time property, TimelineMarker, 406 time slice, multithreading, 657 time types, format string for, 573 Timeline class AutoReverse property, 334 TimelineMarker object, 405, 406, 407 TimelineMarkerRoutedEventArgs 782 www.it-ebooks.info INDEX Marker property, 405 timelines of animations, managing, 328 timer code, animation, 364 TimerTrigger class, 447 TimeSpan object, 333, 336 Title property, Page class, 248 Title user control, animation, 360 To property, DoubleAnimation, 328, 333, 334 To property, VisualTransition, 465 To transitions, parts and states model, 465—466 ToggleButton class, 139, 155, 156 ToggleButton element, FlipPanel, 481, 487 ToggleButton states, FlipPanel, 479 ToList() method, binding to LINQ, 566, 567 toolkit prefix (toolkit:), 74 tools, design, 1—3 ToolTip control, 158—160 ToolTip property, RangeBase, 175 ToolTip property, ToolTipService, 158, 159 tooltips, 158—160 ToolTipService class, 158 ToolTip property, 158, 159 Top property, Canvas class, 87 animation programming, 358, 363 attached properties, 111 choosing property to animate, 346 dragging shapes example, 128 drawing line on Canvas, 262 ToString() method, DataGrid calling, 605 tracking application state, 204—208 tracking progress BackgroundWorker class, 674—675 transfer rate bit-rate throttling, 399 Transform class classes deriving from, 305 transform classes, 306 Transform property, GeometryGroup, 273 transformations see transforms TransformGroup class, 306, 347 transforms, 305—312 angling shapes, 307 animating, 346—349 applying to elements in layout containers, 309—310 change-notification support, 307 content from XPS document, 288 dynamic effects and animation, 307 perspective transforms, 312—316 pixel shaders, 316—320 PlaneProjection class, 313—314 reflection effect, 310—312 RenderTransform property, 409 repeating shapes, 307 ScaleTransform class, 103—104 scaling pages, 103 transforming shapes, 307—309 video effects, 409 WPF using layout transforms, 310 TransitionCompleted event handler, 371 transitions, 463—468 controls skipping transition animations, 464 custom transitions, 466—468 default transition, 464—465 From and To transitions, 465—466 page transitions, 369—370 state groups, 464 transitioning to steady state, 466 wipe transition, 372—374 Transitions collection, 464 TranslateTransform class, 306, 346 changing button shape or position, 459 Transmission Control Protocol (TCP), 707—709 transparency, 298—305 alpha component, 64, 300 images, 298, 300 improving animation performance, 379 making controls transparent, 302— 305 783 www.it-ebooks.info INDEX making elements partly transparent, 298, 299 making content region transparent, 302—305 opacity masks, 301—302 TextBlock elements, 300 TreeView, 139, 585, 631—634 TreeViewItem objects, 631 Triangle value, line cap properties, 267 trigger classes, 447 TriggerAction class, 433, 434, 439 TriggerBase class, 435 Triggers collection, 329, 435 triggers, behaviors adding DefaultTrigger attribute to action class, 438 connecting action to element, 435, 436 creating targeted trigger, 439—442 Expression Blend defaults, 438, 439 reason for creating, 435 TargetedTriggerAction class, 439 triggers and actions, 432 behaviors encompassing, 443 triggers, Silverlight, 456 TryParse() method data conversion, 573 TryValidateObject() method, 594 TryValidateProperty() method, 594 two-way data binding, 547—548 two-way element binding, XAML, 57— 58 TwoWay value, BindingMode enum., 547 type attribute, object element, 26 type converters, XAML, 41—42, 129 type sharing, web service, 601—604 TypeConverter attribute, 41 typefaces, 142 types, audio and video, 387 U UIElement class ArrangeCore() method, 91 creating actions, 433 events, 116—117 hierarchy of Silverlight elements, 116 MeasureCore() method, 91 MouseCapture() method, 126 Opacity property, 299 Projection property, 314 RenderTransform property, 309 RenderTransformOrigin property, 309 UIElement infrastructure, 271 underlining, 145 Unfocused state, controls, 457 UnhandledException event, 186, 190, 192 Uniform value, Stretch enum., 148, 258, 298 Uniform value, Stretch property, 395 UniformGrid layout container, 93—98 UniformToFill value, Stretch enum., 149, 258, 298 UniformToFill value, Stretch property, 395 UnitCost property, Product class, 570, 573, 588 Unknown value, Key property, 130 Unlimited size, sizing pages, 99 UpdatePanel control, AJAX, 17 updateSilverlight() function, JavaScript, 509 UpdateSource() method, 548, 552 UpdateSourceTrigger property, 548 updating applications, 208—209 upgrading autoUpgrade parameter, 28 UploadFile() method, FileService, 653 UploadFileAsync() method, 655 uploading transmitting files with web service, 650—656 UpOnly value, StretchDirection property, 260 URI browser URI integration, 241—243 disabling URI system, 243 forward slash, 240 784 www.it-ebooks.info INDEX fragment URI system, 242 getting URI of current page, 241 passing information to destination page, 248 query-string arguments, 249 security, 243 storing root URI, 575 using relative URI, 211 using resources in assemblies, 218 URI format, XML namespaces, 36 URI mapping, 244—246 Uri property, NavigationContext, 248 UriMapper object, 244, 245, 246 UriMapper property, Frame control, 245 URL configuring web service URL, 524— 526 non-SOAP web services using, 686 URL encoding/decoding, HttpUtility, 493 URL system, MediaElement tag, 388 UrlEncode() method, HttpUtility, 693 user controls animation programming, 359 bomb-dropping game, 360—361 DesignHeight attribute, 99 DesignWidth attribute, 99 determining type to create, 229 dynamically loading, 228 embedding in page, 228—230 Silverlight pages as, sizing, 98 window loading dynamically, 228 user interface, Silverlight, User object, ASP.NET, 532 UserControl, 98 Loaded event, 169 markup for blank XAML page, 34 SizeChanged event, 103 sizing Silverlight content region, 27 storing data objects as resources, 546 UserInformation class, 237, 238 user-interface functionality see behaviors UserState property, WebClient, 217 V V command, geometry mini-language, 281 ValidateObject() method, 594, 601 ValidateProperty() method, 594, 623, 624 ValidatesOnExceptions property, 548— 550 ValidateUnitCost() method, 600 validation BindingValidationError event, 118 data binding, 548—553 DataGrid, 621—624 DescriptionViewer, 590 listing validation errors in pages, 585 regular expressions, 596—599 validation attributes CustomValidation, 599—601 Range, 596 RegularExpression, 596—598 Required, 595 StringLength, 595 Validation class, 552 validation rules data annotations, 593 embedding in data classes, 585 ValidationAttribute class, 595 ValidationState group, 549 ValidationSummary class, 139, 586, 590—592 Validator class, 594 ValidateObject() method, 594, 601 ValidateProperty() method, 594, 623, 624 value converter class, 570 value converters applying conditional formatting, 577—579 creating, 571 creating objects with, 574—577 formatting strings with, 570—574 785 www.it-ebooks.info INDEX Silverlight data binding vs WPF, 541 Value property key-frame animations, 354 ProgressBar, 177 RangeBase, 175 ValueChanged event, RangeBase, 175 ValueChanged event, Slider class, 339 VBR (Variable Bit-rate Encoding), 403 VC-1 type, video, 388 vector-drawing model, 152 vector images, 286 versions assembly caching, 24 creating friendly install experience, 30 minRuntimeVersion parameter, 28 VerticalAlignment property Button control, 75 custom layout containers, 93 GridSplitter control, 84 layout panels, 68, 69 shapes, 259, 262 StackPanel, 70 using fixed-size window, 99 VerticalContentAlignment property, 154 VerticalGridlinesBrush property, 607 VerticalOffset property, ToolTip, 160 VerticalScrollBarVisibility property DataGrid, 607 ScrollViewer, 101 VerticalTemplate element understanding parts with Slider, 469 video see audio and video functionality video cards bitmap caching, 380 hardware acceleration, 379 video effects, 409—414 reflection effect, 409 scrambling video whilst playing, 411 video encoding, 400—401 compression modes, 402 Expression Encoder, 400, 401—403 video files MediaElement playing, 395 supported file types for, 388 supporting smooth streaming, 399 video playback, 400—414 markers, 403—407 stopping original window appearing, 408 synchronized video playback, 401 video effects, 409—414 video encoding, 400—403 VideoBrush, 408 video player, Expression Encoder building, 405 video puzzle, 411—414 VideoBrush, 292, 408, 409 creating video puzzle, 411—414 reflection effect, 311 RelativeTransform property, 409 SourceName property, 408 WPF, 423 Viewbox, 260—262 placing in ScrollViewer, 104 resizing window with, 261 using ScaleTransform, 103—104 wrapping Canvas in Grid control, 262 zooming with mouse wheel, 124, 125 ViewMode parameter, 187, 188 virtualization DataGrid, 605, 614 ListBox, 165 visibility control changing visibility of parts, 470 Visibility property Control class, 133 DataGridXyzColumn classes, 610 MediaElement class, 408 UIElement class, 230, 346 Visible value ScrollBarVisibility enumeration, 101 Visibility property, UIElement, 230 Visual Studio 786 www.it-ebooks.info INDEX adding service reference, 519—521 assembly caching, 23 attaching event handlers to elements, boilerplate error-handling code, 191 creating ASP.NET-hosted project, 13 creating proxy class, 519—521 creating Silverlight class library in, 37 creating stand-alone project, creating web services in, 518—519 design process, designing XAML page, editing XAML markup by hand, linking feature, 603 web service type sharing, 601, 602— 604 Visual Studio 2008, 1, 2, Visual Studio 2010, 2, 4, VisualStateGroup, 464, 465 VisualStateGroups, 458, 459 VisualStateManager, 458, 459, 465, 467, 468 GoToState() method, 485 VisualTransition element, 464, 465, 467, 468 VisualTreeHelper class, 47, 433, 434 volume slider for adjusting, 392 temporarily muting playback, no pause, 391 Volume property, MediaElement, 391 W w3schools.com on-line XML tutorial, 34 watermarks, Expression Encoder, 401 WAV audio, 395 WCF services creating in Visual Studio, 518—519 using ASP.NET platform services, 531—532 web services called by Silverlight, 517 web controls ASP.NET controls rendering content, 16 web pages see also pages animating transition between, 370 browser history, 233 child windows, 233—238 creating Silverlight page, 7—12 embedding user controls in, 228— 230 getting URI of current page, 241 hiding elements, 230 HTML test page, 25—31 HyperlinkAction class, 447 identifying pages using enumerations, 232 legacy integration with Silverlight, 491 moving between, 227 passing information to destination page, 248 query-string arguments, 249 retaining page state, 231—233 sharing information between, 249 swapping entire page content, 230 triggering page navigation from, 248 Web Project creating ASP.NET-hosted project, 13 web resources placing resources on the Web, 214— 217 web service methods creating web services, 519 exceptions, 523 GetCategoriesWithProducts(), 568, 569 web service type sharing, 601—604 web services, 517—526 accepting large amounts of data, 653 787 www.it-ebooks.info INDEX adding Visual Studio reference, 519—521 building data service, 554—557 building server-side proxy, 681 calling data service, 557—559 calling, 521—523 configuring web service URL, 524— 526 consuming simple web service, 687—690 creating in Visual Studio, 518—519 creating proxy class, 519—521 cross-domain access, 681 cross-domain web service calls, 528—529 data types, 526—527 denial-of-service attacks, 653 duplex services, 534—539 FileService class, 651—653 FileServiceClient class, 654—656 Flickr web service, 691, 693 monitoring network connection, 530—531 polling connections, 533 processing XML, 690—691 REST-based web services, 686—690 RSS, 704—706 services requiring XML data, 698— 701 services returning JSON data, 701— 703 services returning SOAP data, 701 services returning XML data, 691— 698 LINQ querying XDocument, 696—698 navigating over XDocument, 694—696 Silverlight client, 654—656 simple web services, 686 simulated server initiated communications, 533—534 SOAP web services, 686 sockets connections, 533 transmitting files with, 650—656 using ASP.NET platform services, 531—532 WSDL document describing, 521 XML-RPC service, 698, 699 Web Site creating ASP.NET-hosted project, 13 Web, the cross-domain web service calls, 528—529 interacting with, 679—690 cross-domain access, 680—682 HTML scraping, 682—686 mark of the Web, 30—31 placing resources on, 210, 214—217 web.config file adding WCF service, 519 building data service, 555 configuring duplex services, 534 creating ASP.NET-hosted project, 15 WebClient class building Flickr request URL, 693 CancelAsync() method, 216, 217 Cancelled property, 217 consuming simple web service, 687, 688 downloading assemblies on demand, 219 downloading from file system, 216 downloading media files asynchronously, 389 downloading resources with, 216— 217 DownloadProgressChanged event, 216, 217 DownloadStringAsync() method, 216, 683, 684 DownloadStringCompleted event, 216, 693 Error property, 217 limitations, 216 OpenReadAsync() method, 216, 217, 683 OpenReadCompleted event, 216 querying HTML page with, 683 relative URIs, 216 788 www.it-ebooks.info INDEX security, 680 UserState property, 217 working with HTML, 683, 684 WebRequest class BeginGetRequestStream() method, 688, 690 BeginGetResponse() method, 689, 690 consuming simple web service, 687, 688 CreateRequest() method, 688 ReadResponse() method, 689 security, 680 using XML-RPC service, 699 websites, 3, browser integration with Silverlight, 491 cross-domain web service calls, 528—529 DeepZoomProjectSite website, 419 drawback of Silverlight-only website Hard Rock Memorabilia website, 423 isolated storage, 636 whitespace, TextBlock element, 140 width MaxWidth property, layout, 69 MinWidth property, layout, 68 width attribute, object element, 26 Width option Out-of-Browser Settings window, 200 Width property Button class, 87 ColumnDefinition object, 80 giving pages fixed-size, 99 GridSplitter, 84 layout panels, 69, 72 setting Height and Width to zero, 408, 411 shapes, 255, 257 wildcards, regular expressions, 598 Window property, HtmlPage, 492, 493 Window Title option Out-of-Browser Settings window, 200 windowless parameter, 28 windowless rendering, 302—305, 379 windows see also browser window child windows, 233—238 popup windows, 233, 495—496 Windows assemblies, 22 Windows Media Audio type, 387 Windows Media Encoder, 400 Windows Media metafiles, 396 Windows Media Video types, 388 Windows Movie Maker, 400 Windows.Browser namespace, 492 Windows.Expression.Interactivity.dll see System.Windows.Interactivity dll Windows.Media namespace, 271 wipe effect, page transitions, 369—370 wipe transition, 372—374 WipeTransition class, 372 WMA type, 387 WMV types, 388, 400 wmx files, 396 WordArt feature, animation, 360 WorkerReportsProgress property, 674, 675 WorkerSupportsCancellation property, 676 Working Data folder, 416 WPF (Windows Presentation Foundation) and Silverlight animation systems, 326 BAML, 17 data binding, Silverlight vs WPF, 541 Deep Zoom, 423 Pixel Shader Effects Library, 320 Shader Effects Library, 353 styles, 426 using layout transforms, 310 VideoBrush, 423 WrapBreakPanel, 112—115 789 www.it-ebooks.info INDEX WrapPanel, 62, 74—75 data templates changing item layout, 583 wrapping text, 146 WriteableBitmap class, 320—323 WriteObject() method DataContractJsonSerializer class, 703 writing data isolated storage, 638—640 writing files SaveFileDialog class, 647, 650 WSDL document, 521 wsx files, 396, 397 X, Y x prefix (x:), 35 see also xaml namespace X1/Y1/X2/Y2 properties, Line class, 262 XAML (Extensible Application Markup Language), 33—39 attached properties, 44, 45 blank document, markup for, 34 case-sensitivity, 42 code-behind class, 38—39 designing pages, element-to-element binding, 56—58 events, 48 namespaces, 34—38 pronouncing XAML, 33 properties, 41—45 property-attribute syntax, 43 property-element syntax, 42—43 replacing tags with code statements, 44 setting mouse cursor in XAML, 129 Silverlight changes, 33 sizing Silverlight content region, 27 splashScreenSource parameter, 28 type converters, 41—42 why study syntax of XAML, 59 XAML elements, 34 element-to-element binding, 56—58 naming elements, 39 nested elements, 45—47 property-element syntax, 42—43 XAML export, 284 XAML files App.xaml file, App.xaml.cs file, AppManifest.xaml file, 18 AssemblyInfo.cs file, Canvas export option creating, 285 code-behind class, 38 conversion tools, 286 exporting pictures through XPS, 286, 287 MainPage.xaml file, MainPage.xaml.cs file, Resource Dictionary export option, 285 Silverlight pages, XAML markup attaching App event handlers, 186 data templates, 579 defining Popup control, 161 editing by hand, replacing attribute with nested element, 427 Silverlight animations, 328 styles, 425 using resource in, 51 XAML markup extensions, 51, 54, 56, 57 xaml namespace, 35 Class attribute, 38 Name attribute, 39 XAML resources, 50—56, 210 accessing in code, 53—54 adding UriMapper object as, 244 hierarchy of, 51—53 organizing with resource dictionaries, 54—56 resources collection, 50—51 XAML template designing ChildWindow control, 235 XAML view, Visual Studio, XAP files, 18 assembly caching, 23, 24 790 www.it-ebooks.info INDEX CheckAndDownloadUpdateAsync() method, 208 decompilation, 21 deploying media file alongside, 389 deploying Silverlight application, 19—20 isolated storage, 636 out-of-browser applications, 197— 209 placing resources in assembly, 211 placing resources in package, 213— 214 placing resources on the Web, 214, 215 reducing size, application library caching, 23 resources, 209 separating infrequently used code in assemblies, 219 Silverlight application life cycle, 185 XAP package deploying media file inside, 389 embedding media file in, 388 XAP resource, 209 XAttribute getting object, 694 getting actual value out of, 696 XDocument, 691 Ancestors() method, 696 dealing with namespaces, 698 Descendants() method, 696 Elements() method, 694, 695 Elements[After|Before]Self properties, 696 exposing nested elements through methods, 694 Load() method, 693 navigating over, 694—696 Node (XyzNode) properties, 696 Parse() method, 693 querying XDocument with LINQ, 696—698 Save() method, 700 XElement, 694, 696 XHTML XAML similarities, 33 XML mapping document to new class, 697 on-line tutorial, 34 parsing, 693 processing, 690—691 services requiring XML data, 698— 701 services returning XML data, 691— 698 System.Xml.dll assembly, 22 XML character entities equivalents for special characters, 41 XML DOM model, 691 XML namespace prefix, 37 mapping FlipPanelControl to, 477 XML namespaces and Silverlight namespaces, 36 declaring, 35, 37 mapping to Silverlight namespaces, 35 URI format for, 36 XML Paper Specification (XPS), 286 XML policy file cross-domain access, 680 XmlDocument, 691 XMLHttpRequest object, 680 xmlns attribute, 35 XmlReader, 690, 691 Create() method, 213 pulling content out of object, 693 XML-RPC request/response Flickr image search, 700, 701 XML-RPC service, 698, 699 XmlSerializer, 691 benefit of serialization, 722 serializing message object to stream, 721 storing objects with, 643—646 XmlWriter, 690, 691 XNamespace, 698 XNode object, getting, 694 XPS (XML Paper Specification), 286, 287, 288 791 www.it-ebooks.info INDEX Z Z command, geometry mini-language, 281, 282 zero-length state animations, 463 ZIndex property, Canvas class, 88—89, 259 ZIndex, layering with, 88—89 zip extension, Silverlight decompilation, 21 ZIP files assembly caching, 23 file name extension options, 224 Zoom() method, MultiScaleImage, 422 ZoomAboutLogicalPoint() method, 422 Zoomify, 415 zooming browser zooming, 104 Deep Zoom, 414—42 792 www.it-ebooks.info www.it-ebooks.info www.it-ebooks.info www.it-ebooks.info 233 Spring Street, New York, NY 10013 Offer valid through 4/10 www.it-ebooks.info ... Configuring Animation Properties 33 1 From 33 1 To 33 3 By 33 3 Duration 33 3 Animation Lifetime 33 4... 231 Browser History 233 Child Windows 233 xi www.it-ebooks.info ■ CONTENTS Designing a ChildWindow 235 Showing a ChildWindow 236 ... 33 5 Simultaneous Animations 33 6 Controlling Playback 33 7 xiii www.it-ebooks.info ■ CONTENTS Animation Easing .33 9 Using an Easing Function

Ngày đăng: 15/03/2014, 21:20

Từ khóa liên quan

Mục lục

  • Prelims

  • Contents at a Glance

  • Contents

  • About the Author

  • About the Technical Reviewer

  • Acknowledgments

  • Introduction

  • Introducing Silverlight

    • Silverlight Design Tools

      • Visual Studio vs. Expression Blend

      • Understanding Silverlight Websites

      • Creating a Stand-Alone Silverlight Project

      • Creating a Simple Silverlight Page

        • Adding Event Handling Code

        • Testing a Silverlight Application

        • Creating an ASP.NET-Hosted Silverlight Project

          • ASP.NET Controls That Render Silverlight Content

          • Mixing ASP.NET Controls and Silverlight Content

          • Silverlight Compilation and Deployment

            • Compiling a Silverlight Application

            • Deploying a Silverlight Application

            • Silverlight Core Assemblies

            • Silverlight Add-On Assemblies

            • Assembly Caching

            • The HTML Entry Page

              • Sizing the Silverlight Content Region

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan