853 silverlight 5 in action

1K 576 0
853 silverlight 5 in action

Đ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

IN ACTION Revised Edition of Silverlight in Action Pete Brown MANNING www.it-ebooks.info Silverlight in Action PETE BROWN MANNING SHELTER ISLAND www.it-ebooks.info For online information and ordering of this and other Manning books, please visit www.manning.com The publisher offers discounts on this book when ordered in quantity For more information, please contact Special Sales Department Manning Publications Co 20 Baldwin Road PO Box 261 Shelter Island, NY 11964 Email: orders@manning.com ©2012 by Manning Publications Co All rights reserved No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by means electronic, mechanical, photocopying, or otherwise, without prior written permission of the publisher Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks Where those designations appear in the book, and Manning Publications was aware of a trademark claim, the designations have been printed in initial caps or all caps Recognizing the importance of preserving what has been written, it is Manning’s policy to have the books we publish printed on acid-free paper, and we exert our best efforts to that end Recognizing also our responsibility to conserve the resources of our planet, Manning books are printed on paper that is at least 15 percent recycled and processed without elemental chlorine Manning Publications Co 20 Baldwin Road PO Box 261 Shelter Island, NY 11964 Development editor: Technical proofreader: Copyeditor: Proofreader: Typesetter: Cover designer: ISBN: 9781617290312 Printed in the United States of America 10 – MAL – 18 17 16 15 14 13 12 www.it-ebooks.info Jeff Bleiel Thomas MacKearney Liz Welch Elizabeth Martin Marija Tudor Marija Tudor brief contents PART PART CORE SILVERLIGHT 1 ■ Introducing Silverlight ■ XAML and the property system ■ The application model and the plug-in ■ Working with HTML and browsers ■ Out-of-browser applications ■ The security model and elevated trust 114 26 47 73 95 CREATING THE USER INTERFACE 125 ■ Rendering, layout, and transforming ■ Panels 160 ■ Human input 180 10 ■ Text fundamentals 11 ■ Editing plain and rich text 225 12 ■ Control basics and UserControls 13 ■ Animation and behaviors 199 iii www.it-ebooks.info 272 247 127 iv PART PART PART PART BRIEF CONTENTS 14 ■ Resources, styles, and control templates 307 15 ■ Extensions, converters, custom controls, and panels 337 WORKING WITH DATA AND SERVICES 365 16 ■ Binding 367 17 ■ Data controls: DataGrid and DataForm 18 ■ Input validation 433 19 ■ Networking basics 20 ■ Working with SOAP services 21 ■ RESTful services with the ASP.NET Web API 22 ■ Working with XML, JSON, RSS, and Atom 23 ■ Duplex, sockets, and local connections 410 460 491 520 549 575 2D AND 3D GRAPHICS 601 24 ■ Graphics and effects 603 25 ■ Working with images 630 26 ■ Introduction to 3D 27 ■ 3D lighting, texturing, and animation 649 679 MAKING THE MOST OF THE PLATFORM 709 28 ■ Pop-ups, windows, and full-screen applications 29 ■ Navigation 734 30 ■ Working with files and directories 31 ■ Printing 798 32 ■ COM, Native Extensions, and p-invoke 711 761 832 BEST PRACTICES 867 33 ■ Structuring and testing with the MVVM pattern 869 34 ■ Debugging your application 35 ■ The install experience and preloaders www.it-ebooks.info 913 929 contents preface xxi acknowledgments xxiv about this book xxvi about the cover illustration PART 1 xxxi CORE SILVERLIGHT Introducing Silverlight 1.1 A Silverlight primer Silverlight and the web Silverlight and WPF Types of Silverlight applications ■ 1.2 A brief history of Silverlight Features for business and client applications Media and graphics enhancements 10 User interaction 11 Text 11 ■ ■ 1.3 ■ Getting started with Silverlight development 12 Setting up your development environment 13 1.4 ■ Helpful sites Building your first Silverlight web application 14 Project setup 15 User interface 16 Calling Twitter search 18 Parsing the results and binding the ListBox 19 Making the ListBox contents more meaningful 23 ■ ■ ■ 1.5 Summary 25 v www.it-ebooks.info 13 vi CONTENTS XAML and the property system 26 2.1 XAML basics 27 Objects 28 Namespaces 29 Properties 32 Dependency properties 33 Attached properties 35 Events 36 Commands 38 ■ ■ ■ ■ 2.2 Object trees and namescope Object trees 39 2.3 2.4 2.5 39 Namescope 42 ■ XAML type converters 43 Loading XAML at runtime 44 Summary 46 The application model and the plug-in 47 3.1 The Silverlight application model 48 Application startup process 49 XAP 50 The application manifest file 51 The Silverlight application object 52 Application dependencies 55 Assembly caching 56 ■ ■ ■ ■ 3.2 Creating the Silverlight plug-in 58 Using the object tag 59 Using the Silverlight.js utility file Creating an instance of the Silverlight plug-in 61 60 ■ 3.3 Integrating the Silverlight plug-in 62 Relating the Silverlight application to the HTML DOM 62 Clarifying the initial experience 64 Handling plug-in events 68 Sending initialization parameters 70 ■ ■ 3.4 Summary 71 Working with HTML and browsers 73 4.1 4.2 Silverlight and the HTML DOM 74 Working with the web page from managed code 75 Navigating web page contents 76 Working with element properties 77 Handling CSS information 78 Accessing the query string 78 ■ ■ 4.3 Working with the hosting browser window 79 Prompting the user 79 Navigating the browser window 81 Discovering the browser properties 81 ■ 4.4 Bridging the scripting and managed code worlds Calling managed code from JavaScript 82 from managed code 85 www.it-ebooks.info ■ 82 Using JavaScript vii CONTENTS 4.5 Hosting HTML in Silverlight Hosting the WebBrowser control WebBrowserBrush 92 4.6 Summary 86 87 ■ Using the 94 Out-of-browser applications 95 5.1 Implementation specifics Process and hosting 5.2 5.3 97 ■ 97 Capabilities and restrictions 98 The end-user experience 98 Creating out-of-browser applications 100 The out-of-browser settings file 100 Controlling the experience 102 Customizing icons 105 Updating ■ ■ 5.4 5.5 ■ Alerting the user with notification toast Controlling the host window 107 105 106 Basic window properties 108 Changing window chrome 109 Minimizing, maximizing, restoring, and closing 110 Moving a window 111 Resizing 111 ■ ■ ■ 5.6 Summary ■ 112 The security model and elevated trust 114 6.1 6.2 6.3 Code classifications and the transparency model 115 User initiation and consent 117 Elevated trust 119 Creating elevated trust applications 120 Enabling in-browser elevated trust applications 122 Detecting elevated trust mode 124 ■ ■ 6.4 PART Summary 124 CREATING THE USER INTERFACE 125 Rendering, layout, and transforming 127 7.1 The UIElement and FrameworkElement Properties 7.2 128 ■ 128 Methods 134 The rendering process 135 Clock tick 137 Per-frame rendering callback Rasterization 138 ■ www.it-ebooks.info 137 viii CONTENTS 7.3 The layout system 144 Multipass layout—measuring and arranging 144 The LayoutInformation class 146 Performance considerations 147 ■ 7.4 Render transforms 148 RotateTransform 149 ScaleTransform 150 SkewTransform 150 TranslateTransform 151 TransformGroup 151 CompositeTransform 152 MatrixTransform 153 ■ ■ ■ 7.5 3D projection transforms PlaneProjection 155 7.6 Summary ■ 155 Matrix3dProjection 157 159 Panels 160 8.1 Canvas 161 Setting the offsets 162 8.2 8.3 The StackPanel 165 The WrapPanel 166 Vertical wrapping 8.4 Setting the stack order 163 ■ 167 ■ Horizontal wrapping 168 The Grid 169 Arranging Grid content 170 Positioning Grid content 172 Spanning cells 172 Sizing it up 173 Working with the grid programmatically 176 Customizing cell boundaries 177 ■ ■ ■ ■ 8.5 Summary 179 Human input 180 9.1 Capturing the keyboard 181 Understanding focus 181 Handling keyboard events Dealing with modifier keys 184 ■ 9.2 Mouse input 185 Mouse movement events 186 Using the mouse wheel 191 9.3 9.4 Mouse button events 188 ■ Using multitouch 193 Collecting ink drawings 194 Creating the InkPresenter 195 Styling the ink 197 9.5 182 Summary ■ 198 www.it-ebooks.info Collecting ink 195 ix CONTENTS 10 Text fundamentals 199 10.1 The text system 200 Subpixel text rendering 200 Text hinting 201 formatting 202 Text rendering 203 ■ ■ Text ■ 10.2 Displaying text 204 Font properties 204 Flow control properties 209 Spacing 212 ■ 208 ■ Text ■ 10.3 OpenType font support 215 Ligatures 216 Stylistic sets 217 Font capitals 219 Fractions and numbers 220 Variants, superscript, and subscript 221 ■ ■ ■ 10.4 10.5 11 Embedding fonts 223 Summary 224 Editing plain and rich text 11.1 225 Handling basic text input 226 Enabling multiline text support 227 selection 228 11.2 11.3 11.4 11.5 12 ■ 247 Control 248 ■ Tab navigation and control state 249 ContentControl 251 The ContentPresenter 252 12.3 242 Summary 245 Appearance 248 Templating 250 12.2 Working with selected Free-form text layout Control basics and UserControls 12.1 ■ Multicolumn and free-form linked text 241 Multicolumn text 241 11.7 Mastering text Understanding input method editors 228 Copying text with the Clipboard API 231 Collecting sensitive data 232 Entering and displaying rich text 233 Formatting and inline elements 233 text 237 11.6 ■ Button controls 253 The Button 254 The HyperlinkButton 255 The RadioButton 255 The CheckBox 257 ■ ■ www.it-ebooks.info 955 INDEX Internet Explorer and MouseWheel event 191 and Silverlight 58 colors 614 DHTML Object Model 75 in full screen 730 Silverlight and ActiveX model 48 understanding limits 97 Internet Explorer 481 interpolation 292 curves 296 discrete 296 linear 294 spline 294 types 293 InvalidateSurface 659 important for animation systems 663 InvalidOperationException 255 Inversion of Control pattern 883, 903 Invoke method 85 InvokeScript method 90 IsActive property 108 IsChecked property 256 IsDropDownOpen property 262 IsEnabled property 249 IsFullScreen property 732 IsItemsHost property 347 ISM 593 isolated storage 791–796 available free space 794 creating directories 793 deleting files and directories 793 increasing quota 794 listing files and directories 792 per domain quota 794 quota 98 reading files 796 sensitive data 796 writing files 795–796 isolated storage quota increase 118 IsolatedStorageException 793 IsolatedStorageFile class 791–792 IsolatedStorageFileStream 795–796 IsPressed property 253 IsReadOnly property 227, 236, 417 IsTabStop property 249 IsThreeState property 258 ISV 57 IsValid property 428 isWindowless 65 Italic element 234 Italic font style 207 Items property 259, 326, 383, 441 ItemsCollection 258 ItemsControl data binding 383 data templates 402 ItemsControl class 258–265, 324, 356 ItemSource property 22 ItemsPanel class 326 ItemsPanel property 259 ItemsPresenter class 325 ItemsSource property 259, 383, 402 ItemTemplate property 259, 402 report writer example 821 IValueConverter 396 J JavaScript calling managed code 82–85 creating a Silverlight control 61 custom splash screens 934 invoking 90 script tag 60 setting focus in Silverlight 181 JavaScript Object Notation See JSON JournalOwnership property 759 journals, controlling 759 joystick 844 JPG image format 631 jQuery vs Silverlight JSON 61, 314, 540, 558–566 converting 558 serialization 562 syntax 68 testing RESTful service 530 JsonObject class 558 JSP 58 K Key property 184 keyboard 181–185 input limitations 731 modifier keys 184–185 responding to events 183 Keyboard class 184 www.it-ebooks.info KeyDown event 182, 640 keyed elements, data binding 382 KeyEventArgs class properties 183 KeyEventArgs parameter 182 KeyFrame class 698 only holds data 699 KeyFrame, naming template 293 KeyFrameAnimation class 706 members 700 KeyframeAnimation class 698 keyframes 291–297 adding 700 animation 698–706 timing 296 types 293 KeySpline property 295 control points 295 curves for interpolation 296 keystrokes 181–185 modifier keys 184–185 KeyTime property 296 KeyUp event 182, 640 L LabelPosition property 424 lambda expressions 19, 716 in debugging 921 lambda syntax 895 Language property 567 LastName property 439 LastOperation property 592 LastUpdatedTime property 567 layout arrange pass 145 arrange step 351 calculation 174 customizing 350–354 in Silverlight 144 in WPF 144 layout system 144–148 measure pass 145 measure step 350 multipass 144, 146 orbital 346 performance 147 radial 346 sizing and positioning 148 slots 146 subpixel rendering 163 virtualization 147 with attached properties 35 956 layout dimensions vs onscreen dimensions 813 layout panels Canvas 161, 164 Grid 169–179 nesting 169 StackPanel 165–169 layout system 144–148 LayoutCompleted event 146 LayoutInformation class 146 LayoutRoot control rerooting 812 Left enumeration value 131 Left property 162 left text alignment 211 LeftProperty dependency property 134 libraries, referencing 30 ligatures 216 contextual 217 discretionary 217 historical 217 lighting the scene 681 vectors 680–687 Line class 604–605 comparison with LineGeometry 609 x and y coordinate pairs 605 linear interpolation 294 keyframe types 293 LinearColorKeyFrame class 293 LinearDoubleKeyFrame 293 LinearGradientBrush class 318, 614–616 animation 286 declared as a resource 308 LinearPointKeyFrame 293 LineBreak flow control element 208 LineGeometry class, comparison with Line 609 LineHeight property 213 LineSegment class 612 linked files, and crosscompilation 507 Links property 567, 570 links, adding to top menu 741 LINQ 471 and web services 872 LINQ to XML 14, 550 Atom document parsing 19 parsing with 20 retrieving data 551 INDEX Linux, checking OS platform 834 ListBox class 259, 261 control templates 326 defining items at design time 260 defining look and feel 260 selecting items 261 ListBox control binding 21 data binding 384 ListBoxItem class 260 Load method 44 load progress, monitoring 936 Loaded event 290 LoadEmployees method 901 local space See model space LocalMessageReceiver object 596 LocalMessageSender object 597 Location API 836 logical trees 40 lookless controls 250 looping animation 281–282 loose resources 314–315 referencing relatively 314 retrieving with absolute URI 315 loose XAML 63 Lucida font 205 M Mac and ClearType 202 checking OS platform 834 debugging on 920 no Silverlight mouse wheel support 191 See also Apple MainDrawingSurface_Draw stubbed out 659 MainViewModel class 552 MainWindow object 110 managed code and scripting 82 calling DOM 75–79 calling from JavaScript 82–85 Managed Extensibility Framework See MEF Mandelbrot fractals 636–638 manifest file See AppManifest.xaml manipulating images 633 www.it-ebooks.info MapUri method 749 Margin property 132 markup extensions 338 StaticResource 309–310 TemplateBinding 324 Marshal class 857, 862 matrices 695 conversion 696 Matrix class 696 methods and properties 697 Matrix3dProjection 157 MatrixTransform 153–155 MaxDropDownHeight property 262 maximizing window 729 MaxLength property 227 measure pass 145 step 350 MeasureOverride function 145 media bitmap images 631–647 spring animations 642 Media Stream Source API 10 MediaElement, VideoBrush 619 MEF 55, 903, 937 menus, adding items 754 merging resource dictionaries 310 Message property 596 MessageBox, debugging 918 MessageReceivedEventArgs class 596 microformats 573 microphone and webcam access 118 Microsoft Excel See Excel Microsoft Expression 643 Microsoft Office 784 Microsoft Public License See Ms-PL Microsoft.Expression.Interactions.dll assembly 897 minimizing window 729 Mode property 369, 371 mode, Visible 415 Model 880 model space 695 transparency 115 Model-View-Controller See MVC Model-View-ViewModel myths 881 what it isn’t 881 INDEX Model-View-ViewModel pattern 869 basics 878–887 commands 892–896 compared to code-behind 879 history 878 separation from UI 892–906 See also Model See also View See also ViewModel modes full-screen 118 pinned 118 modifier keys 184–185 ModifierKeys enumeration 184 motion animation 276 MotionFinished event 642 mouse location 186 scrolling 11 wheel 191–192 mouse events 185–192 collecting ink 195 custom click event 190 mouse wheel 191 MouseButtonEventArgs 188 MouseEnter event 186 MouseLeave event 186 MouseLeftButtonDown event 111, 188, 195 MouseLeftButtonUp event 188, 195 MouseMove event 186, 195 MouseOver visual state 330, 332, 334 MouseRightButtonDown event 188 MouseRightButtonUp event 188 moving elements programmatically 162 movingPosition parameter 238 Mozilla Firefox 75 Ms-PL 60 multicast ASM 593 ISM 593 sockets 593–595 SSM 594 multiline text support 227 multipage printing 816–830 prerequisites 816–820 multipass layout 144, 146 MultiScaleImage class 638–639 composing dzi files 643 viewport 641 zooming programmatically 640 MultiScaleTileSource class 639 multitouch 11, 193 MVC design pattern 26 MVVM design pattern 27, 534 MvvmApplication sample application 871–878 AddVacationBonusCommand command 895 and web services 872 base ViewModel class 883 busines logic 888, 890 button functionality 877 CallMethodAction behavior 897 code-behind solution 875 DataGrid code 875 Edit button 896 employee detail view 873 employee detail window 876, 901 employee list view 872, 875 EmployeeDataService class 890 EmployeeListViewModel class 884, 888, 891, 900 Employees property 885 EmployeeVacationBonusService class 889 EmployeeViewModel class 898 list page ViewModel 884 LoadEmployees method 887, 901 LoadingProgress overlay 873 OnNavigatedTo method 887, 905 pop-ups 877 SelectedEmployee property 885 SilverlightTest class 911 testing 906–912 updated list view 886 View-specific entities 898 ViewModel locator 904 ViewModelCommand class 893 my namespace 270 N Name property 82, 330, 430 namescope 42–43, 596 bug in Silverlight 43 NameScope property 596 namespaces declaring 31 in SML 21 www.it-ebooks.info 957 in XAML 29–32 multiple 29 standard XAML 30 synchronizing 505 System.Windows.Input 129 Native Extensions for Silverlight See NESL native window, creating 717–730 Navigate method 81, 87, 746, 749 Navigated event 748 NavigateToBookmark method 81 NavigateToString method 89 NavigateUri property 255 Navigating event 748, 752 navigating to other assemblies 753–755 navigation 81 back and forward 737 browser journals 735 browsers 735–737 cancelling 752 custom controls 756–759 fragments See hashtags 736 hashtags 736 history 735–737 navigation application 738 Navigation Application template 738–744 out-of-browser 755–759 Tab-key 249 to pages 744–755 Navigation Application template 738–744 NavigationCacheMode property 752 NavigationContext property 751 NavigationFailed event 748 NavigationService class 744, 746–748 events 748 functions 746 properties 747 NavigationStopped event 748 NESL 839–857 accelerometer 840–849 and AccelerometerJoystick class 842 architecture 839 Install and recompile 840 integrating with the Windows taskbar 849 requires COM automation servers 855 958 nesting layout panels 169 nesting objects 28 Netflix install page 931 Netscape 58 Netscape Plug-in API See NPAPI Netscape Server Application Programming Interface See NSAPI NetTcp protocol 512 NetworkAddressChanged event 489 NetworkCredential constructor 486 NetworkInformation namespace 489 networking client HTTP stack 483–489 stack networks calls, blocking 469 cross-domain access 476–481 operations, debugging 923–928 requests, spread across subdomains 482 NewItemTemplate property 426 NewValue property 269 None stretch option 644 Normal font style 207 normal planar triangles 139 normal vectors 680–687 Normal visual state 330, 334 normals See normal vectors notification toast 106 NotificationWindow class 106 NotificationWindowClose method 107 NPAPI 191 NSAPI 58, 191 NuGet 471, 524 null values 399 nVidia 657 O OBJECT tag 63 object trees 29, 39–42 visual trees 40 objects application object 52–55 data binding 376–378 in XAML 28–29 nesting 28 Settings 143 Observable class 375, 884 INDEX Offset property and Color property 615 where color begins 615 offsets 162 OldValue property 269 OLE Automation 835 OnApplyTemplate method 358 onError 53, 68 event 69 OneTime binding mode 371 OneWay binding mode 372 OnFragmentNavigation event 745 onLoad 68 OnNavigatedFrom event 745 OnNavigatedTo event 745 OnNavigatingFrom event 745 onscreen dimensions vs layout dimensions 813 onscreen information, printing 810–816 onSourceDownloadComplete event 936 onSourceDownloadProgressChanged event 936 Opacity property 129, 622 animation 274, 278 Open file mode value 796 OpenFileDialog class 762 properties 763 safe and secure design 766 OpenType and fractions 220 font support 215 options RenderAtScale 142 selecting from a list 258, 262 OrbitPanel IntelliSense 353 Orbits property 347 OrbitPanel example 345–355, 362 CalculateOrbitSpacing method 352 Children property 346 ControlsLib namespace 353 dependency properties 347 markup 352 MeasureOverride method 350 Orbit property 349 OrbitPanel class 346 possible enhancements 354 project setup 346 properties 347 SortElements method 350, 352 www.it-ebooks.info Order property 430 orientation ClearType 202 horizontal 165 vertical 165 Orientation property 165 OriginalSource property 186, 191 OS X 184 See also Mac Oscillations property 300 out parameter 513 out-of-browser application settings 100 capabilities 98 checking network state 489 comparison with in-browser 95 controlling user experience 102–105 creating applications 100 custom window chrome 109 customizing icons 105 elevated trust 120 end-user experience 98–100 forcing out-of-browser mode 102 host window 107 implementing 97 installation process 99 minimizing and maximizing windows 110 moving windows 111 navigating 755–759 notification toast 106 resizing windows 111 restoring and closing windows 110 restrictions 98 updating 105 Windows integration 98 OutlineColor property 197 OutOfBrowserSettings.xml 100 Icons section 105 Window element 109 overlapping content 163 OverlayBrush property 717 OverlayOpacity property 717 P p-invoke accessing system printer information 857 for API calls 857–865 writing code 860 packaged XAML 63 INDEX Padding property 132, 214, 249 Page class 740, 744–745 navigation-related functions 744 PageMargins property 804–805 pages caching 751 navigating to 744–755 new 740 numbers 827–830 page parameters 750 requesting 520 surfacing commands 894 PageVisual property 804, 806 Panel class 267, 327 animation 276 Children property 347 clipping 354 custom panels 345–355 possible enhancements 354 Panel See OrbitPanel example panels vs controls 355 Paragraph element 233 Parent property 77, 135 parentElement 63 pARGB 635 parts 331 and states model 335 Password property 232 PasswordBox element 232 PasswordChar property 232 passwords 232 Path attribute 478 Path class 604, 779 path geometries 611 PathFigure class 611 PathGeometry class 611 segment types 612 PathSegment class 611 Pause method 287, 619 per-frame rendering callback 137 performance hit 65 Person class 454 PHP 58 pixel processing, combines texture and geometry 652 pixel shaders 624–629, 680 custom effects 628 model 624 pixel shader class 626 profile 624 setting up environment 625 using 628 WPF Pixel Shader Effects library 625 pixels 206 PixelShader class 627 PlaneProjection 155, 157 Platform Invoke See p-invoke Platform property 82 PlatformKeyCode property 184 plug-in See browser plug-in PNG image format 631 support in Silverlight 11 Point class 607, 616, 642 PointAnimation class 276 points 206 Points property 608 policy element 477 policy file, serving 590 polling 576 PolyBezierSegment class 612 Polygon draws closed shape 608 Points property 608 versus Polyline 608 Polygon class 133, 604 See also Polygon Polyline coordinate pairs 607 draws open shape 607 PointCollection 607 versus Polygon 608 Polyline class 604 Polyline class See Polyline PolyLineSegment class 612 PolyQuadraticBezierSegment class 612 pop-up windows 11 pop-ups 712–717 MvvmApplication sample application 877 Popup class 713 Port attribute 478 portable network graphics See PNG position absolute 605 offsets 162 relative 605 Position property 194 POST 520, 544 POSTing to a RESTful service 544 PostScript advantages 800 converting to 807 power of 688 PowerEase class 299 www.it-ebooks.info 959 POX 540 See also XML PreferredMultiSampleCount property 659 preloaders 933–937 default 933 defining the appearance of 934–935 JavaScript 934 monitoring load progress 936 PreparingCellForEdit event 417 Press click mode 254 Pressed visual state 330 primitives 671–678 rendering the sphere 676 TriangleList 672 TriangleStrip 673 Print method 800–801 PrintableArea property 804–805 PrintDocument class 800–804 PrintedPageCount property 801, 803 PRINTER_INFO_2 class 863 printer, setting up application 857 PrinterFallbackSettings class 809 PrinterInformation class 863 PrinterService class 860 printing 799–810 and page margins 804 and trust 802 at different size 813 bitmap-based 808 clipping 815, 825 dpi 805 forcing vector 809 header and footer 827–830 how it works 799–810 in Silverlight large documents 808 letting user cancel 806 line items 820–825 onscreen information 810–816 page breaks 825 page numbers 827–830 rasterization 807 resolution See dpi scaling to fit 814–815 tracking page size 825 two modes 799 visual tree 820–825 printing line items, example 820 960 printing onscreen information 810–816 as is 810 rerooting 812 PrintPage event 800–801, 804–806 report writer example 828 PrintPageEventArgs class 804 processing pixel 652 progress property 937 project structure 659–667 camera 665 renderable scene objects 663 scene 660 project templates, installing 653 projection space 695 transforms 155–159 Projection matrix 696 Prompt method 80 Prompt property 430 property 255 Property attribute 319 property path 36 syntax 287 Property property 269 PropertyChanged event 375 PropertyChangedCallback class 269 PropertyChangedCallback property 268 PropertyChangedEventArgs 376 PropertyMetadata class 268, 348 Protocol attribute 478 PublishDate property 570 Q QuadraticBezierSegment class 612 QuadraticEase class 299 QuarticEase class 299 query string 750 accessing 78 QueryString property 751 QuinticEase class 299 Quota property 794 R RadialGradientBrush class 616 RadioButton class 255, 257 grouping 256 RadiusX property 617 Rectangle 606 INDEX RadiusY property 617 Rectangle 606 RangeAttribute class 452 RangeBase class 356 raster 603, 618, 807 rasterization 138, 144, 807 raytracing 140 Reactive Extensions See Rx ReadObject method 562 ReadOnlyTemplate property 426 ReceiverName property 596 receivers, creating 596 receiving data 495 Rectangle bulging 606 Height property 606 rounded 606 Width property 606 Rectangle class 604 animation 284 comparison with RectangleGeometry 610 Rectangle class See Rectangle RectangleGeometry class 610 comparison with Rectangle 610 redirecting the browser 81 redraw regions 143 referencing events 37 inline properties 32 libraries 30 Silverlight.js utility file 60 Refresh method 746 regions, for hit testing 609 Register method 268, 347 RegisterAttached method 349 registers 626 RegisterScriptableObject method 83 RegularExpressionAttribute class 452 relative position 605 sizing 64 source binding 379 URIs 315–316 Release click mode 254 Remove method 314 RemoveAt method 176 removing resources using DELETE 546 render transforms 148–155 RenderAtScale option 142 www.it-ebooks.info rendering 135–144 cached composition 140–142 content 163 order 139 subpixel rendering 163 user Silverlight control 64–68 Rendering event 93, 138 rendering pipeline 652 rendering process 135–144 cached composition 140–142 clock tick 137 occlusion 139 order 139 per-frame rendering callback 137 rasterization 138–144 steps 136 RenderingEventArgs class 138 RenderingTime property 138 RenderMode property 656 RenderModeChanged event 656 RenderModeReason property 656 reparent See rerooting RepeatBehavior property 281–282 takes precedence over Duration 281 replacing selected text 240 Repository pattern 526 Representational State Transfer See REST request/response pattern 461, 474 simplifying 465 requesting a page 520 RequiredAttribute class 452 rerooting 812 ResourceDictionary 309 Resources attribute 314 property 289, 309, 313 resources animation 289 bundled 315–317 declarative 308–314 dictionaries 310 element 478 loose 314–315 referencing 310, 313–314 removing using DELETE 546 retrieving with absolute URI 315 scoping 310 updating by POSTing 544 INDEX ResourceType property 430 Response property 596 REST any service that isn’t SOAP 520 consuming services 539 GETting from 540 helper libraries 548 Rest# 548 RESTful service adding the Silverlight project 531 creating controller 528 creating using ASP.NET Web API 522–539 decides format of data 541 POSTing data to 544 shared model project 525 testing using a browser 530 Resume method 287 reusable components 308 controls 265 templates 328 RGB 614 aRGB format 614 RxGyBz format 614 RIA Rich Internet Application See RIA rich text 233–245 retrieving as XAML 240 RichTextBox control 12 element 233–245 Right enumeration value 131 right text alignment 211 right-clicking 11 right-hand coordinate system 696 RootVisual 53 RotateTransform 148–149 rotating objects 149 rotation 703 CreateFromYawPitchRoll 704 routed events 37 RoutedEvent property 290 Row property 172 RowDefinitions property 170 RowDetailsTemplate property 414 RowDetailsVisibilityMode property 414 rows and columns adding programmatically 176 removing programmatically 176 RowSpan attached property 172 RSS 566–573 Run flow control element 208 runtime binding 369 loading XAML 44–46 parsing XAML 44 RuntimeVersion attribute 51 Rx 471 S Safari 58, 75, 97 Webkit-based 86 safeguards full-screen mode restriction 731 limits to user input 731 SaveFileDialog class 767–770 and Save As 769 properties and methods 767 SaveToString method 92 ScaleTransform class 148, 150 instead of animation 276 ScaleX property 150 ScaleY property 150 scaling, rotating, translating See SRT scene lighting 681 manages information for 3D 660 renderable objects 663 Scene class 654 AmbientLightColor property 681 loading triangle and its shader 670 main class in 3D system 661 SceneObject instances 663 SetupLights method 681 SceneObject class 664 screen mode normal full-screen mode 731–732 resizing content 732 toggling 732 screenshots 634 ScriptableMember attribute 83 ScriptableType attribute 83 ScriptAlias property 83 scripting and managed code 82 SDK DirectX 625 Expression Blend 897 www.it-ebooks.info 961 SDKStyles.xaml file 742 security and reflection 117 attack 731 safe browsing 791 Seek method 287 segments Arc 612 Bézier 612 Line 612 PolyBezier 612 PolyLine 612 PolyQuadraticBezier 612 QuadraticBezier 612 Select function 238 selected text 237–245 formatting 239 SelectedIndex property 261 SelectedItems property 261 SelectedText property 228 selecting from a list 258, 262 text 228 Selection property 238 SelectionLength property 228 SelectionStart property 228 Selector class 261, 356 sender, creating 597 SenderDomain property 596 sending data 499 Sensor class 844 SensorManager class 844 service calls, factoring 890–892 service proxy 497 service references 495 ServiceError class 516 ServiceReferences.ClientConfig file 511 SetBinding method 370 SetLeft method 162 SetProperty method 77 SetPropertyValue method 389 SetStyleAttribute method 78 Setter class 319 Settings object 143 SetTop method 163 SetValue method 135, 348 Shader Model specification 624 Shader Model 2.0 652 shaders CustomEffect.slfx 653 See also Shader Model simple vertex color 667 vertex 670, 680 962 ShadowDepth property 622 Shape class 604–608 exposes Stretch property 644 shapes circular 606 closed 608 five-pointed star 609 geometric 609 open 608 shared model project 525 SharePoint 487, 566 sharing type definitions 505 visual states 335 Shazzam 625 shearing transform 150 ShortName property 430 Show method 107, 715 ShowGridLines property 171 showing dialog boxes 712–717 pop-ups 712–717 signing applications 121 SilverChat 595 Silverlight accessing the browser window 79 Ajax and ActiveX 58 and H.264 10 and printing and proxies for RESTful services 540 and SOAP services 492 animation 273–302 application 58 application defined 48 application model 48 asynchronous communication restriction 469 BiDi text 12 bitmap API 10 business features ClearType fonts 11 code transparent by default 116 code-behind 870–878 collect handwritten information 194 commands 892–896 communication APIs 489 configuration dialog 67 connecting to Twitter 14–24 connecting to web services 495 INDEX creating a dedicated RSS reader 573 creating an application 16 customizing install experience 931–933 defined development 12–14 dialog boxes 11 differences from WPF 40 DRM 10 entry point 50 every page a UserControl 266 excels at media font support 205 fonts 11 Group Policy settings 123 hosting 16 hosting server 63 improvement over HTML 258, 261 initializing 70 installation 58 integration with a web page 65 JavaScript latest plug-in version 932 layout 144 making it talk 835 media enhancements 10 Media Stream Source API 10 microphones 10 mouse scrolling 11 multitouch support 11 networking APIs 489 networking stack new features 12 occlusion culling at the brush pixel level 140 performance 65 plug-in not installed 930–933 PNG support 11 pop-up windows 11 printing from 799–830 printing in raster mode 805 printing limitations 816 quitting application 53 RichTextBox control 12 right-click support 11 SDK 13, 152, 411 security levels 115 security model 118 security safeguards 731 SOAP 1.1 protocol support 492 startup events 68–70 www.it-ebooks.info supported DOM variants 75 supporting platforms 184 supports Shader Model 652 supports XNA “Reach” profile 652 testing 906–912 text 200 TextBlock and CSS equivalent 204 the HTML DOM 62–64 the web transformation matrix 153 types of applications UIs 16 upgrading 932 use of cookies 482 user initiation and consent 117 user interaction 11 validation versus HTML 5 versus jQuery visual prompts 713 WCF RIA Services webcams 10 within Internet Explorer 58 workflow 370 WPF Silverlight 1.0, migrating to Silverlight 2.0 71 Silverlight 2, validation 434 Silverlight 3, new features 12 Silverlight 4, new features 12 Silverlight application bundled resources 315 content files 316 declarative resources 309 embedded files 317 loose resources 314–315 site of origin 314 storing data on the local filesystem 791–796 Silverlight control 58, 74 creating from JavaScript 61 height 64 integrating with a web property 62 keyboard input 181 width 64 Silverlight Object Model 135 Silverlight plug-in 58 creating from JavaScript 61 default install badge 930 input focus 181 installing 930–933 INDEX Silverlight plug-in (continued) integrating with a web property 62 latest version 932 Netflix install page 931 not installed 930–933 security 791 setting focus via JavaScript 181 upgrading 932 Silverlight Unit Testing Framework 906–910 installing 906 Silverlight.js file 932 Silverlight.js utility file 60 functions 60 referencing 60 Silverlight.net website 60 Silverlight/XAML 663 Silverlight/XNA 3D API 652–654 SilverlightFaultBehavior class 516 SilverlightHost class 55, 84, 732 simple geometries 609–611 simple properties 319 Simple Sandboxing API 115 SimpleTriangle class 668, 670 SineEase class 299 Single Responsibility Principle 887 site of origin 314, 476 Size property 194 SizeChanged event 659 sizing user-controlled 177 sizing precedence order 175 SkewTransform 148, 150 sllauncher.exe 97 SOAP services 492–500 socket-resource element 478 SocketAsyncEventArgs class 592 sockets bidirectional 589 implementation restricted 589 multicast 593–595 opening a connection 591 response, handling 591 TCP 589–593 SocketType 591 SolidColorBrush 209 SolidColorBrush class 613 declared as a resource 309 sorting See DataGrid class SortMemberPath property 417 Source property 87, 315, 369, 639, 747 referencing an image 631 source URI 63 Source-Specific Multicast See SSM SourceFeed property 570 SourceName property 619 spaces, coordinate 695–698 Span element 234 spanning cells 172 special folders, accessing 778 SpecialFolder enumeration 779 Speech API 835 SpeedRatio property 280 impact on duration 280 sphere convert to triangles 674 rendering with primitives 676 texturing 688 Sphere class 673 drawing code 676 tessellation code 675 splash screens 933–937 defining the appearance of 934–935 integrating 936 monitoring load progress 936 splashScreenSource property 936 spline interpolation 294 keyframe types 293 SplineColorKeyFrame class 293 SplineDoubleKeyFrame 293 SplinePointKeyFrame class 293 spoofing 731 spring animation 642 Springiness property 300 SQL Server Express 940 SQL Server, installing AdventureWorks on 939 SSL 497 SSM 593 saves bandwidth 594 stack order 164 StackPanel class 327 element 165–169 layout of invisible elements 130 StandardColors.xaml file 311 star sizing 173 www.it-ebooks.info 963 start and stop angles 354 StartPoint property 615 startup events 68–70 process 49–50 Startup event 52, 937 StartupEventArgs 52 state-based effects 331 states 329 change between 333 manage change between 331 management and transition 329 visual 329–335 See also visual states StaticResource markup extension 309–310 Stop enumeration value 282 method 287, 619 StopLoading method 746 Storyboard class 274, 283–291, 308, 330 controlling 287–289 defined 283 defining as a resource 289 programmatic control 287 triggering in response 290 storyboard control 287–289 storyboarding 283–291 StreamReader 796 StreamResourceInfo class 317 StreamWriter object 795 Stretch enumeration value 132 Stretch property 643–647 Fill option 646 None option 644 Uniform option 645 UniformToFill option 647 stretching 643–647 Fill option 646 None option 644 Uniform option 645 UniformToFill option 647 string-indexed elements, data binding 382 StringLengthAttribute class 452 Stroke 195 Style class 317, 319–323 style setters, value precedence 34 styling 317–323 explicit 321 implicit 322 ink 197 964 styling (continued) reusable templates 328 state-based effects 331 states 329 templates 323–329 transitioning effects 332 visual states 329–335 stylistic sets 217 StylusDevice object 196 property 186, 191 StylusPoint 198 subnavigation, responding to 745 subpixel rendering 163 subsetting 223 Summary property 570 synchronous validation 441–446 syndication feed downloading and processing 568 reading 566 SyndicationFeed class 19, 566 Items collection 569 SyndicationItem class available properties 569 syntax, URIs 753 System.Collections namespace 417 System.ComponentModel namespace 375, 441, 446 System.ComponentModel.DataAnnotations assembly 451 namespace 451, 900 System.Device.Location namespace 836 System.Drawing namespace 614 System.Exception exception 452 System.IO.IsolatedStorage namespace 791 System.Net namespace 462 System.Net.Sockets namespace 593 System.PlatformID 834 System.Runtime.Serialization namespace 495 System.Runtime.Serialization.Json namespace 562 System.ServiceModel namespace 495 System.ServiceModel.Channels namespace 495 System.ServiceModel.Web assembly 562 INDEX System.Speech namespace 835 System.Threading.Tasks namespace 474 System.Windows namespace 329 System.Windows.Browser namespace 75, 81, 83 System.Windows.Controls namespace 177, 411, 744 System.Windows.Controls.Data assembly 411 System.Windows.Controls.dll 263 System.Windows.Controls.Navigation namespace 740 System.Windows.Documents namespace 208 System.Windows.Ink namespace 197 System.Windows.Input namespace 129, 180, 184, 198 System.Windows.Interactivity library 305 System.Windows.Interactivity.dll assembly 897 System.Windows.Interop namespace 833 System.Windows.Markup namespace 44 System.Windows.Media namespace 614 System.Windows.Media.Imaging namespace 632 System.Windows.Messaging 595 System.Windows.Resources namespace 317 T tab navigation 249 TabControl class 262 defining look and feel 264 TabIndex property 249 TabItem, visual tree 262 TabNavigation property 249 TabStripPlacement property 265 tabular format 170 TagName property 77 TargetName 255 TargetName property 274, 277, 284 TargetNullValue 399 TargetProperty property 274, 277, 284 www.it-ebooks.info TargetType property 321 Task class 474 Task Parallel Library See TPL taskbar progress bar states 850 See also Windows TCP sockets 589–593 Template property 250, 323 TemplateBinding markup extension 324 templated properties, value precedence 34 TemplatePart attribute 358 TemplatePartAttribute class 331 templates control 323 custom control default template 359 Navigation Application template 738–744 project 653 reusable 328 styling 323–329 visual states 361 TemplateVisualState attribute 361 TemplateVisualStateAttribute class 330 tessellating a sphere 674 testing 906–912 asynchronous operations 911 custom controls 362 definitions 906 report writer example 819 Silverlight Unit Testing Framework 906–910 ViewModel 910 text 200 alignment 211 ClearType 200 copying to clipboard 231 displaying 204–223 editing 226, 233 entering 233 flow control 208 font properties 204–208 formatting 202 free-form layout 242 handling 226–228 hinting 201, 204 inline styles 234 input method editors 228–230 inserting 240 Italic font style 207 layout 242 965 INDEX text (continued) multiline support 227 Normal font style 207 pixel size 206 point size 206 rendering 203 replacing 240 rich text 233–245 selected 237–245 selecting 228 spacing 212–223 subpixel rendering 200 text properties 209, 212 viewing 226 text hinting 201, 204 animation 202 Text property 226 TextAlignment property 211 TextArea element 227 TextBlock 161, 171 aligning text 211 flow control 208 text wrapping 209 TextBlock class 498 animation 276 using resource brushes 308 TextBlock element 204–224 font properties 204–208 line spacing 212 TextBox 171 data binding 369, 377 TextBox class styles 317 using in a UserControl 265 TextBox element 226–228 multiline support 227 wrapping text 227 TextChanged event 226 TextDecorations property 209 TextHintingMode property 201 TextInput event 229 TextInputStart event 229 TextTrimming property 210 texture applying 687–694 UV coordinates 689 TexturedPlane class 691 TexturedSphere class 682 texturing tasks for project 688 TextWrapping property 209, 227 themes 742 Thickness property 805 three-state checkbox 258 Timeline class 275, 282–284 TimeOfDay property 374 Times New Roman font 205 TimeSpan class 283, 296 TimeSpan structure 280 timestamps directory 772 Title property 567, 717 To property 276, 333 and animation type 279 toast 106 ToggleButton class 256, 258, 356 toolbar, customized 423 toolkits, necessity of 660 ToolkitStyles.xaml file 742 Top enumeration value 132 property 162 TopMost property 108 TopProperty dependency property 134 ToString method 384, 402 TouchDevice property 194 TouchFrameEventArgs class 193 TouchPoints class 193 TPL 9, 474 Transform element 148–155 transformations, multiple 151 TransformGroup 151 transitioning effects 332 transitions elliptical 616 multiple color 616 TranslateTransform 148, 151 transparency model 115, 129 transparent 65 trapezoid 608 Trebuchet font 205 triangle adding to the scene 670 building using vertices 668 triangle list, versus triangle strip 673 triangle strip, versus triangle list 673 TriangleList control winding order 685 primitive 672 TriangleStrip primitive 673 triggering event 290 Triggers property 290 triggers See behaviors TrueType fonts supported within Silverlight 205 trust 476–481 and printing 802 trust mode, elevated 115 www.it-ebooks.info Trusted Certificate Root 121 tweening See interpolation TweetDeck 99 Twitter connecting to 14–24 follow author 13 search API 18 TwitterService class 405 TwitterUser class 404 TwoWay binding mode 372 type definitions, sharing 505 TypeConverter class 343 types base types 355 type converters 342–345 U u-blox 836 UDP multicast sockets 593 UdpAnySourceMulticastClient class 593 UdpSingleSourceMulticast class 593 UIElement 161 class 267 common properties 128–134 keyboard events 183 mouse events 188 transforms 148 UIElement class 128 UIs design composition 29 elements, data binding 378–381 in Silverlight, complex 135 separation from 892–906 virtualization 412 Underline property 209 Unfocused visual state 330 UnhandledException event 53 Uniform stretch option 645 UniformToFill stretch option 647 UpdateSourceTrigger 386 uploading to server 762 UploadStringAsync method 467 UriMapper class 749 UriMappings property 749 URIs 255, 748–751 absolute 315 destination 541 mapping 749, 753 relative 315 syntax 753 966 URL for embedded files 317 user control calling the control 270 defining appearance 266 defining behavior 267 development 266 user data 791 user experience 64–68 controlling out-of-browser experience 102–105 out-of-browser 98–100 user initiation 117 user interaction 11 user Silverlight plug-in rendering 64–68 user-controlled sizing 177 user-initiated clipboard access 118 UserAgent property 82 UserControl data binding 377 keyboard events 183 UserControl class 265–271 customizing 355 UseSprings property 642 using statement 551, 569 cleaning up 526 UV coordinates 626, 689 V ValidateSalaryAndLevelAsync class 450 ValidatesOnDataErrors property 441, 445 ValidatesOnExceptions parameter 438 ValidatesOnExceptions property 441, 445 validation asynchronous 446–451 calling external functions 454–456 client service code 449 combining messages 439 comparison of approaches 457 cross-field 443–445 custom code 439 custom validators 456 data annotations 451–458 displaying errors 440 employee example 434–440, 442, 447–451, 453–457 exception-based 438–440 INDEX handling errors 438 IDataErrorInfo interface 442 in common function 443 in Silverlight 434 input synchronous 441–446 via attributes 452 WCF web service 448 with exceptions and IDataErrorInfo interface 445 ValidationAttribute class 452 ValidationContext class 455 ValidationException exception 452 ValidationResult class 454 Value attribute 319 value converters 395–399, 922 value precedence 34 Value property 293 values, Application.Current.InstallState 102 VCR control 422 Vector3, holds points of data 667 vectors graphics 603 lighting and normal 680–687 printing, forcing 809 verbs, GET 540 Verdana font 205 version 66 vertex shaders 680 vertex See vertices VertexColorEnabled property 681 VertexPositionColor class 669 vertical offset 162 VerticalAlignment property 131 VerticalContentAlignment property 249 vertices 667–671 adding triangle to a scene 670 building a triangle 668 color 669 creating a simple triangle 668 define a point in 3D space 671 indexed 684 VideoBrush class 619 View 880 and ViewModel relationship 884 definition 880 View-specific entities 898–902 View-to-ViewModel ratio 884 www.it-ebooks.info view frustum 695 View matrix 696 view space 695 View-Model-ViewModel pattern View-specific entities 898 View-specific entities and ViewModel 898–902 ViewModel 880 and View relationship 884 and View-specific entities 898–902 as interface 903 base class 883 compared to codebehind 887 data access 890–892 definition 880 implementation 882–887 list page 884 locators 903 naming 884 ownership 882 service calls 890–892 testing 910 View-to-ViewModel ratio 884 ViewModel class 392 ViewModel pattern See ModelView-ViewModel pattern viewport 638, 641–643 defined 641 managing 641 setting the size 641 ViewportOrigin property 642 ViewportWidth property 641 views, adding 740 virtual filesystem See filesystem virtual PC 490 virtualization 147 visibility modes All 416 Collapsed 415 Column 416 Row 416 VisibleWhenSelected 415 Visibility property 130 visual parts 331 tree 135 visual state groups CommonStates 330 FocusStates 330 visual states 329–335, 360 change between 333 Checked 330 Collapsed 360, 362 967 INDEX visual states (continued) Expanded 360, 362 in control template 361 MouseOver 332, 334 Normal 334 sharing 335 transition 330 Visual Studio 51, 523, 688, 836 adding breakpoints to code 916 build actions 316–317 creating service references 495 generates test certificate 121 keeping the web server port constant 463 NuGet package manager 471 Visual Studio 2010 15 downloading 13 signing a XAP 121 visual trees 40, 260 TabItem 262 traversing with VisualTreeHelper 41 VisualState class 332, 335 Control enters 331 VisualStateGroup class 332 VisualStateManager class 329–335, 360 effects 331 parts and states model 329 VisualStateTransition class 332 VisualTransition class 335 VisualTreeHelper class 41 W W3C 75 WCF duplex services 576–589 error handling 513 RIA Services vs ASP.NET for services 497 web service for validation 448 WCF service and complex data types 500–511 creating Silverlightenabled 501 WCF service implementation example 818 Web Platform Installer See WebPI web properties 74 integrating the Silverlight control 62 Web Service Description Language See WSDL web services and code-behind 871 and LINQ 872 MvvmApplication sample application 872 WebBrowser control 87–92 must have a size 94 WebBrowserBrush control 92 webcam and microphone access 118 webcams 10 WebClient class 55, 465, 541 properties and methods 467 simple event-based approach 542 WebKit 58, 97 WebPI 523 WebRequest class for networking 462 WebRequestCreator class 483 websites 10rem.net 13 Channel 13 helpful 13 Silverlight Cream 13 Silverlight TV 13 Whack-a-Mole 296 White Screen of Death See WSOD Width property 145, 173, 179, 318 Rectangle 606 Wilcox, Jeff 122 Win32 API interface 860–865 window closing, minimizing, and maximizing 729 creating native 717–730 customizing chrome 723 moving 725 required shape 728 resizing 725 setting state 720 Window class 108, 718 Content property 719 Window property 79 Windows taskbar 849 Windows Aero 723 Windows Communication Foundation See WCF Windows Forms colors 614 compared to XAML 27 www.it-ebooks.info Windows Logo key 184 Windows modifier key 185 Windows Presentation Foundation See WPF Windows Workflow Foundation See WF WindowState property 108 WindowState, possible values 720 WindowStyle, values 724 Wireshark 928 World matrix 696 world space 695 World Wide Web Consortium See W3C World-View-Projection matrix See WVP WPF 4, and FontStyle options 208 commands 892–896 data binding 370 differences from Silverlight 40 layout 144 supports pixel shaders 624 TextDecorations property 209 Visibility enumeration 131 WPF Pixel Shader Effects library 625 WrapPanel, in Silverlight toolkit 167 WriteableBitmap class 632, 634 creating Mandelbrot fractals 637 direct pixel access 635 WriteObject method 562 WSDL 493 creating service references 495 WSOD 59 WVP 696 X X property 151 x:Key attribute 309, 321 XAML alternate default namespace 30 and CLR objects 17 basics 27–39 binding breakpoints 922 CLR namespaces 30 colors 344 commands 38 compared to Windows Forms 27 968 XAML (continued) CompositionMode 659 constructor rules 28 data binding 369–371 declaring value converters 395 defining a Line 605 defining an Ellipse 606 dependency properties 33–35 event handlers 37 events 36–38 extensions 43 from rich text 240 inline 63 loading at runtime 44–46 loose 63 Name vs x:Name 29 namespaces 29–32 objects 28–29 overlay to obscure DrawingSurface 659 parsing at runtime 44 properties 32, 36 INDEX runtime parsing 44 setting DataContext 377 standard namespaces 30 Testing RESTful services 531 XAML breakpoints 922 XAML files, editing 27 XAML markup extensions 338–342 XamlParseException 310 XamlReader 342 XamlReader class 44 XAP 48, 50 decrease file size 51 sign 120 XDocument class, resolving 21 XML 550 XmlReader class, reading XML 566 XmlSerializer class 554 XmlSerializerNamespaces class 557 XmlWriterSettings class 556 www.it-ebooks.info XNA “Reach” profile 652 and BasicEffect 670 Color class 663 stock effects 680 XNA Game Studio 4.0 3D core libraries 652 XNA Studio 653 Y Y property 151 Z z-ordering 659 ZIndex property 164 zoom in or out 150 ZoomAboutLogicalPoint method 639 zooming 639–641 SILVERLIGHT/.NET Silverlight IN ACTION Pete Brown T his hands-on guide explores Silverlight from the ground up, covering every feature in rich, practical detail It is readable and the coverage is comprehensive You’ll master networking, MVVM, and more, with dozens of code samples you can use in Visual Studio or the free Visual Web Developer Express Silverlight in Action teaches you how to build desktop-quality applications you can deploy on the web Beginners will appreciate the progression from simple examples to full applications that employ good design and coding practices Seasoned NET developers will love how the sample code embraces and extends what they already know SEE INSERT As entertaining as it is “educational Pete covers Silverlight like no one else! ” —Joe Suchy, ATC Transportation The go-to source for “ real Silverlight answers and examples ” Hands down THE best “reference for everything Silverlight ” must-have book for every “ASilverlight developer ” —Dave Campbell, WynApse What’s Inside ● 2D and 3D graphics and animation Business application services, rules, and validation The MVVM pattern and testing ● free appendixes (200 pages) available online ● ● A background in C# or VB.NET is helpful, but no knowledge of Silverlight or XAML is required This book is a revised edition of Silverlight in Action Pete Brown leads Microsoft’s Silverlight/XAML Developer Community team He’s been a Silverlight MVP, an INETA speaker, and successful RIA Architect To download a free eBook plus additional content in PDF, ePub and Kindle formats, owners of this book should visit manning.com/Silverlight5inAction MANNING $59.99 / Can $62.99 [INCLUDING eBOOK] www.it-ebooks.info —Michael Crump, Telerik —Dave Davis BlueMetal Architects Inc ... Atom 54 9 22.1 Parsing plain old XML LINQ to XML 22.2 55 0 ■ 55 0 XmlSerializer 55 4 Working with JSON 55 8 JsonObject and JsonArray 22.3 55 9 ■ Working with RSS and Atom Reading syndication feeds 56 6... Understanding your binding source 373 Binding to a property 374 Binding to an object 376 Binding to a UI element 378 Binding to an indexed element 381 Binding to a keyed (string indexed) element 382 Binding... caching 56 ■ ■ ■ ■ 3.2 Creating the Silverlight plug -in 58 Using the object tag 59 Using the Silverlight. js utility file Creating an instance of the Silverlight plug -in 61 60 ■ 3.3 Integrating

Ngày đăng: 06/03/2019, 11:32

Từ khóa liên quan

Mục lục

  • Silverlight 5-front

  • brief contents

  • contents

  • preface

  • acknowledgments

  • about this book

    • Audience

    • The bits: what you need

    • Roadmap

      • Part 1 Core Silverlight

      • Part 2 Creating the user interface

      • Part 3 Working with data and services

      • Part 4 2D and 3D graphics

      • Part 5 Making the most of the platform

      • Part 6 Best practices

      • Appendixes

    • Code conventions and downloads

    • Author Online

    • About the author

    • About the title

  • about the cover illustration

  • Part 1 Core Silverlight

    • 1 Introducing Silverlight

      • 1.1 A Silverlight primer

        • 1.1.1 Silverlight and the web

        • 1.1.2 Silverlight and WPF

        • 1.1.3 Types of Silverlight applications

      • 1.2 A brief history of Silverlight

        • 1.2.1 Features for business and client applications

        • 1.2.2 Media and graphics enhancements

        • 1.2.3 User interaction

        • 1.2.4 Text

      • 1.3 Getting started with Silverlight development

        • 1.3.1 Setting up your development environment

        • 1.3.2 Helpful sites

      • 1.4 Building your first Silverlight web application

        • 1.4.1 Project setup

        • 1.4.2 User interface

        • 1.4.3 Calling Twitter search

        • 1.4.4 Parsing the results and binding the ListBox

        • 1.4.5 Making the ListBox contents more meaningful

      • 1.5 Summary

    • 2 XAML and the property system

      • 2.1 XAML basics

        • 2.1.1 Objects

        • 2.1.2 Namespaces

        • 2.1.3 Properties

        • 2.1.4 Dependency properties

        • 2.1.5 Attached properties

        • 2.1.6 Events

        • 2.1.7 Commands

      • 2.2 Object trees and namescope

        • 2.2.1 Object trees

        • 2.2.2 Namescope

      • 2.3 XAML type converters

      • 2.4 Loading XAML at runtime

      • 2.5 Summary

    • 3 The application model and the plug-in

      • 3.1 The Silverlight application model

        • 3.1.1 Application startup process

        • 3.1.2 XAP

        • 3.1.3 The application manifest file

        • 3.1.4 The Silverlight application object

        • 3.1.5 Application dependencies

        • 3.1.6 Assembly caching

      • 3.2 Creating the Silverlight plug-in

        • 3.2.1 Using the object tag

        • 3.2.2 Using the Silverlight.js utility file

        • 3.2.3 Creating an instance of the Silverlight plug-in

      • 3.3 Integrating the Silverlight plug-in

        • 3.3.1 Relating the Silverlight application to the HTML DOM

        • 3.3.2 Clarifying the initial experience

        • 3.3.3 Handling plug-in events

        • 3.3.4 Sending initialization parameters

      • 3.4 Summary

    • 4 Working with HTML and browsers

      • 4.1 Silverlight and the HTML DOM

      • 4.2 Working with the web page from managed code

        • 4.2.1 Navigating web page contents

        • 4.2.2 Working with element properties

        • 4.2.3 Handling CSS information

        • 4.2.4 Accessing the query string

      • 4.3 Working with the hosting browser window

        • 4.3.1 Prompting the user

        • 4.3.2 Navigating the browser window

        • 4.3.3 Discovering the browser properties

      • 4.4 Bridging the scripting and managed code worlds

        • 4.4.1 Calling managed code from JavaScript

        • 4.4.2 Using JavaScript from managed code

      • 4.5 Hosting HTML in Silverlight

        • 4.5.1 Hosting the WebBrowser control

        • 4.5.2 Using the WebBrowserBrush

      • 4.6 Summary

    • 5 Out-of-browser applications

      • 5.1 Implementation specifics

        • 5.1.1 Process and hosting

        • 5.1.2 Capabilities and restrictions

      • 5.2 The end-user experience

      • 5.3 Creating out-of-browser applications

        • 5.3.1 The out-of-browser settings file

        • 5.3.2 Controlling the experience

        • 5.3.3 Customizing icons

        • 5.3.4 Updating

      • 5.4 Alerting the user with notification toast

      • 5.5 Controlling the host window

        • 5.5.1 Basic window properties

        • 5.5.2 Changing window chrome

        • 5.5.3 Minimizing, maximizing, restoring, and closing

        • 5.5.4 Moving a window

        • 5.5.5 Resizing

      • 5.6 Summary

    • 6 The security model and elevated trust

      • 6.1 Code classifications and the transparency model

      • 6.2 User initiation and consent

      • 6.3 Elevated trust

        • 6.3.1 Creating elevated trust applications

        • 6.3.2 Enabling in-browser elevated trust applications

        • 6.3.3 Detecting elevated trust mode

      • 6.4 Summary

  • Part 2 Creating the user interface

    • 7 Rendering, layout, and transforming

      • 7.1 The UIElement and FrameworkElement

        • 7.1.1 Properties

        • 7.1.2 Methods

      • 7.2 The rendering process

        • 7.2.1 Clock tick

        • 7.2.2 Per-frame rendering callback

        • 7.2.3 Rasterization

      • 7.3 The layout system

        • 7.3.1 Multipass layout—measuring and arranging

        • 7.3.2 The LayoutInformation class

        • 7.3.3 Performance considerations

      • 7.4 Render transforms

        • 7.4.1 RotateTransform

        • 7.4.2 ScaleTransform

        • 7.4.3 SkewTransform

        • 7.4.4 TranslateTransform

        • 7.4.5 TransformGroup

        • 7.4.6 CompositeTransform

        • 7.4.7 MatrixTransform

      • 7.5 3D projection transforms

        • 7.5.1 PlaneProjection

        • 7.5.2 Matrix3dProjection

      • 7.6 Summary

    • 8 Panels

      • 8.1 Canvas

        • 8.1.1 Setting the offsets

        • 8.1.2 Setting the stack order

      • 8.2 The StackPanel

      • 8.3 The WrapPanel

        • 8.3.1 Vertical wrapping

        • 8.3.2 Horizontal wrapping

      • 8.4 The Grid

        • 8.4.1 Arranging Grid content

        • 8.4.2 Positioning Grid content

        • 8.4.3 Spanning cells

        • 8.4.4 Sizing it up

        • 8.4.5 Working with the grid programmatically

        • 8.4.6 Customizing cell boundaries

      • 8.5 Summary

    • 9 Human input

      • 9.1 Capturing the keyboard

        • 9.1.1 Understanding focus

        • 9.1.2 Handling keyboard events

        • 9.1.3 Dealing with modifier keys

      • 9.2 Mouse input

        • 9.2.1 Mouse movement events

        • 9.2.2 Mouse button events

        • 9.2.3 Using the mouse wheel

      • 9.3 Using multitouch

      • 9.4 Collecting ink drawings

        • 9.4.1 Creating the InkPresenter

        • 9.4.2 Collecting ink

        • 9.4.3 Styling the ink

      • 9.5 Summary

    • 10 Text fundamentals

      • 10.1 The text system

        • 10.1.1 Subpixel text rendering

        • 10.1.2 Text hinting

        • 10.1.3 Text formatting

        • 10.1.4 Text rendering

      • 10.2 Displaying text

        • 10.2.1 Font properties

        • 10.2.2 Flow control

        • 10.2.3 Text properties

        • 10.2.4 Spacing

      • 10.3 OpenType font support

        • 10.3.1 Ligatures

        • 10.3.2 Stylistic sets

        • 10.3.3 Font capitals

        • 10.3.4 Fractions and numbers

        • 10.3.5 Variants, superscript, and subscript

      • 10.4 Embedding fonts

      • 10.5 Summary

    • 11 Editing plain and rich text

      • 11.1 Handling basic text input

        • 11.1.1 Enabling multiline text support

        • 11.1.2 Mastering text selection

      • 11.2 Understanding input method editors

      • 11.3 Copying text with the Clipboard API

      • 11.4 Collecting sensitive data

      • 11.5 Entering and displaying rich text

        • 11.5.1 Formatting and inline elements

        • 11.5.2 Working with selected text

      • 11.6 Multicolumn and free-form linked text

        • 11.6.1 Multicolumn text

        • 11.6.2 Free-form text layout

      • 11.7 Summary

    • 12 Control basics and UserControls

      • 12.1 Control

        • 12.1.1 Appearance

        • 12.1.2 Tab navigation and control state

        • 12.1.3 Templating

      • 12.2 ContentControl

        • 12.2.1 The ContentPresenter

      • 12.3 Button controls

        • 12.3.1 The Button

        • 12.3.2 The HyperlinkButton

        • 12.3.3 The RadioButton

        • 12.3.4 The CheckBox

      • 12.4 ItemsControls

        • 12.4.1 The ListBox

        • 12.4.2 The ComboBox

        • 12.4.3 The TabControl

      • 12.5 Creating UserControls

        • 12.5.1 Defining the appearance

        • 12.5.2 Defining behavior of a control

        • 12.5.3 Calling the control

      • 12.6 Summary

    • 13 Animation and behaviors

      • 13.1 Animating a value over time

      • 13.2 Mastering the timeline

        • 13.2.1 What type of property are you animating?

        • 13.2.2 Where are you starting from and where are you going?

        • 13.2.3 How long should the animation run?

      • 13.3 Storyboards

        • 13.3.1 Understanding the storyboard

        • 13.3.2 Storyboard target

        • 13.3.3 Controlling the Storyboard

        • 13.3.4 Resources

      • 13.4 Keyframing

      • 13.5 Interpolation

        • 13.5.1 Linear interpolation

        • 13.5.2 Spline interpolation

        • 13.5.3 Discrete interpolation

        • 13.5.4 KeyTime

      • 13.6 Easing functions

        • 13.6.1 Using easing functions

        • 13.6.2 Creating a custom easing function

      • 13.7 Behaviors, triggers, and actions

        • 13.7.1 Using existing behaviors

        • 13.7.2 Creating your own behavior

      • 13.8 Summary

    • 14 Resources, styles, and control templates

      • 14.1 Being resourceful

        • 14.1.1 Declarative resources

        • 14.1.2 Accessing loose resources

        • 14.1.3 Bundled resources

      • 14.2 Giving your elements style

        • 14.2.1 Defining the look

        • 14.2.2 Explicitly keyed style definitions

        • 14.2.3 Implicit style definitions

      • 14.3 Creating templates

        • 14.3.1 Building a control template

        • 14.3.2 Creating reusable templates

      • 14.4 Dealing with visual states

        • 14.4.1 Understanding the components

        • 14.4.2 Leveraging the VisualStateManager

      • 14.5 Sharing your visual states

      • 14.6 Summary

    • 15 Extensions, converters, custom controls, and panels

      • 15.1 Markup extensions

        • 15.1.1 Creating a simple custom markup extension

        • 15.1.2 Creating a parameterized markup extension

      • 15.2 Custom type converters

        • 15.2.1 Creating the converter

        • 15.2.2 Using the converter

      • 15.3 Creating a custom panel

        • 15.3.1 Project setup

        • 15.3.2 The OrbitPanel class

        • 15.3.3 Properties

        • 15.3.4 Custom layout

        • 15.3.5 Enhancements

      • 15.4 Creating a custom control

        • 15.4.1 Choosing the base type

        • 15.4.2 Properties

        • 15.4.3 The control template contract

        • 15.4.4 The default template

        • 15.4.5 Visual states

        • 15.4.6 Visual states in template

      • 15.5 Summary

  • Part 3 Working with data and services

    • 16 Binding

      • 16.1 Binding basics

        • 16.1.1 Mastering the binding syntax

        • 16.1.2 Choosing a binding mode

      • 16.2 Understanding your binding source

        • 16.2.1 Binding to a property

        • 16.2.2 Binding to an object

        • 16.2.3 Binding to a UI element

        • 16.2.4 Binding to an indexed element

        • 16.2.5 Binding to a keyed (string indexed) element

        • 16.2.6 Binding to an entire collection

        • 16.2.7 Deciding when to update binding

      • 16.3 Binding to dynamic properties

        • 16.3.1 ICustomTypeProvider overview

        • 16.3.2 Creating the helper classes

        • 16.3.3 Using the helper class

      • 16.4 Customizing the display

        • 16.4.1 Formatting values

        • 16.4.2 Converting values during binding

        • 16.4.3 Providing default fallback values

        • 16.4.4 Handling null values

      • 16.5 Creating explicit data templates

        • 16.5.1 Using a DataTemplate with a ContentControl

        • 16.5.2 Rendering an ItemsControl with a DataTemplate

      • 16.6 Creating implicit data templates

      • 16.7 Summary

    • 17 Data controls: DataGrid and DataForm

      • 17.1 The DataGrid

        • 17.1.1 Displaying your data

        • 17.1.2 Editing grid data

        • 17.1.3 Sorting items

      • 17.2 The DataForm

        • 17.2.1 Displaying your data

        • 17.2.2 Binding to lists of data

        • 17.2.3 Customizing display

        • 17.2.4 Customizing edit, add, and display templates

        • 17.2.5 Finer control over editing and committing data

      • 17.3 Annotating for display

        • 17.3.1 The Display attribute

        • 17.3.2 The Editable attribute

      • 17.4 Summary

    • 18 Input validation

      • 18.1 The validation example source and UI

      • 18.2 Exception-based property validation

        • 18.2.1 Handling exception validation errors

        • 18.2.2 Custom validation code

        • 18.2.3 Validation error display

      • 18.3 Synchronous validation with IDataErrorInfo

        • 18.3.1 The IDataErrorInfo interface

        • 18.3.2 Simple validation with IDataErrorInfo

        • 18.3.3 Cross-field validation with IDataErrorInfo

        • 18.3.4 Combining exceptions and IDataErrorInfo

      • 18.4 Asynchronous validation with INotifyDataErrorInfo

        • 18.4.1 The INotifyDataErrorInfo interface

        • 18.4.2 Implementing the interface

        • 18.4.3 Binding support

        • 18.4.4 Building the WCF web service

        • 18.4.5 Adding the client service code

        • 18.4.6 Property modifications

      • 18.5 Annotating for validation

        • 18.5.1 Validation attributes

        • 18.5.2 Annotating your entity

        • 18.5.3 Calling external validation functions

        • 18.5.4 Creating custom validators

      • 18.6 Comparison of validation approaches

      • 18.7 Summary

    • 19 Networking basics

      • 19.1 The web request/response pattern

        • 19.1.1 WebRequest and HttpWebRequest

        • 19.1.2 WebResponse and HttpWebResponse

      • 19.2 Simplifying the request/response pattern with WebClient

        • 19.2.1 String operations

        • 19.2.2 Stream operations

      • 19.3 Asynchronous communication

        • 19.3.1 When async methods attack

        • 19.3.2 Saving your sanity with Rx

        • 19.3.3 Simplifying with tasks

      • 19.4 Trust and cross-domain network access

        • 19.4.1 Structuring the cross-domain file

        • 19.4.2 Other cross-domain policy files

        • 19.4.3 Locating your cross-domain policy

      • 19.5 The browser HTTP stack

        • 19.5.1 Connection count limit

        • 19.5.2 Cookies

        • 19.5.3 Caching

      • 19.6 The client HTTP stack

        • 19.6.1 Manually creating the client stack

        • 19.6.2 Automatically using the client stack

        • 19.6.3 Automatically setting the HTTP Referer and other headers

        • 19.6.4 Authentication credentials

        • 19.6.5 Managing cookies with the CookieContainer

        • 19.6.6 When to use the client stack

      • 19.7 Checking the network state

      • 19.8 Summary

    • 20 Working with SOAP services

      • 20.1 Introducing ASP.NET SOAP services using ASP.NET

        • 20.1.1 Silverlight-compatible SOAP services

        • 20.1.2 Service references

        • 20.1.3 Receiving data with the proxy

        • 20.1.4 Sending data using the proxy

      • 20.2 Using WCF services and complex data types

        • 20.2.1 Creating the Silverlight-enabled WCF service

        • 20.2.2 Sharing type definitions

        • 20.2.3 Adding the service reference

        • 20.2.4 Using the service

      • 20.3 Using the configuration file

      • 20.4 Error handling with WCF

        • 20.4.1 Using an out parameter

        • 20.4.2 Exposing exception information for debugging

        • 20.4.3 Error handling with WCF SOAP faults

      • 20.5 Summary

    • 21 RESTful services with the ASP.NET Web API

      • 21.1 Creating a RESTful service using the ASP.NET Web API

        • 21.1.1 Solution setup

        • 21.1.2 Creating the services

        • 21.1.3 Testing the service using the browser

        • 21.1.4 Adding the Silverlight project

      • 21.2 Consuming REST services

        • 21.2.1 REST service GET operations

        • 21.2.2 Updating resources by POSTing to the service

        • 21.2.3 Removing resources using DELETE

      • 21.3 Summary

    • 22 Working with XML, JSON, RSS, and Atom

      • 22.1 Parsing plain old XML

        • 22.1.1 LINQ to XML

        • 22.1.2 XmlSerializer

      • 22.2 Working with JSON

        • 22.2.1 JsonObject and JsonArray

        • 22.2.2 DataContractJsonSerializer

      • 22.3 Working with RSS and Atom

        • 22.3.1 Reading syndication feeds

        • 22.3.2 Working with feed items

      • 22.4 Summary

    • 23 Duplex, sockets, and local connections

      • 23.1 WCF polling duplex services

        • 23.1.1 Creating the project and callback contract

        • 23.1.2 Creating the service

        • 23.1.3 Creating the service logic

        • 23.1.4 Managing client subscriptions

        • 23.1.5 Using the duplex service

      • 23.2 Connecting to sockets

        • 23.2.1 Serving the policy file

        • 23.2.2 Opening the connection

        • 23.2.3 Handling the response

      • 23.3 Multicast sockets

        • 23.3.1 Any-Source Multicast/Internet Standard Multicast

        • 23.3.2 Source-Specific Multicast

      • 23.4 Connecting to other local Silverlight applications

        • 23.4.1 Creating the receiver

        • 23.4.2 Creating the sender

        • 23.4.3 Putting it all together

      • 23.5 Summary

  • Part 4 2D and 3D graphics

    • 24 Graphics and effects

      • 24.1 Shapes

        • 24.1.1 Lines

        • 24.1.2 Rectangle

        • 24.1.3 Ellipse

        • 24.1.4 Polyline

        • 24.1.5 Polygon

      • 24.2 Geometry

        • 24.2.1 Simple geometries

        • 24.2.2 Path geometries

        • 24.2.3 Composite geometries

      • 24.3 Brushes

        • 24.3.1 SolidColorBrush

        • 24.3.2 LinearGradientBrush

        • 24.3.3 RadialGradientBrush

        • 24.3.4 ImageBrush

        • 24.3.5 VideoBrush

      • 24.4 Effects

        • 24.4.1 Using built-in effects

        • 24.4.2 Creating custom pixel shaders

      • 24.5 Summary

    • 25 Working with images

      • 25.1 Basic imaging

      • 25.2 Creating images at runtime

        • 25.2.1 Creating from existing images

        • 25.2.2 Creating from UI elements

        • 25.2.3 A Mandelbrot fractal generator

      • 25.3 Deep Zoom

        • 25.3.1 Showing an image

        • 25.3.2 Zooming in and out

        • 25.3.3 Managing the viewport

        • 25.3.4 Deploying multiscale images

      • 25.4 Dealing with dead space

        • 25.4.1 Filling the space

        • 25.4.2 Uniform sizing

        • 25.4.3 Fill the area

        • 25.4.4 UniformToFill

      • 25.5 Summary

    • 26 Introduction to 3D

      • 26.1 3D—a natural way of interacting with information

      • 26.2 The Silverlight/XNA 3D API

        • 26.2.1 Rendering pipeline

        • 26.2.2 Project templates

      • 26.3 Detecting capabilities with the GraphicsDeviceManager

      • 26.4 Using the DrawingSurface

      • 26.5 Project structure: the scene and objects

        • 26.5.1 The scene

        • 26.5.2 Renderable scene objects

        • 26.5.3 The camera

      • 26.6 Vertices

        • 26.6.1 Building a triangle using vertices

        • 26.6.2 Adding the triangle to the scene

      • 26.7 Primitives

        • 26.7.1 The TriangleList primitive

        • 26.7.2 The TriangleStrip primitive

        • 26.7.3 Tessellating a sphere

        • 26.7.4 Rendering the sphere with primitives

      • 26.8 Summary

    • 27 3D lighting, texturing, and animation

      • 27.1 Lighting and normal vectors

        • 27.1.1 Lighting the scene

        • 27.1.2 Sphere normal vectors

        • 27.1.3 Indexed vertices

      • 27.2 Applying a texture

        • 27.2.1 The ContentManager

        • 27.2.2 Texturing the sphere

        • 27.2.3 Adding and texturing a background

      • 27.3 Coordinate spaces and matrices

        • 27.3.1 The three coordinate space conversion matrices

        • 27.3.2 The Matrix class

      • 27.4 Keyframe animation

        • 27.4.1 The KeyFrame and KeyframeAnimation classes

        • 27.4.2 Using animation

      • 27.5 Summary

  • Part 5 Making the most of the platform

    • 28 Pop-ups, windows, and full-screen applications

      • 28.1 Showing pop-ups and child windows

        • 28.1.1 The Popup control

        • 28.1.2 Displaying a dialog box with the ChildWindow control

      • 28.2 Creating native windows

        • 28.2.1 Creating a normal window

        • 28.2.2 Customizing window chrome

      • 28.3 Running in full screen

        • 28.3.1 Normal full-screen mode

        • 28.3.2 Elevated trust full-screen mode

      • 28.4 Summary

    • 29 Navigation

      • 29.1 Browser navigation background

        • 29.1.1 Browser journals

        • 29.1.2 Anchor hashtags

        • 29.1.3 Back and forth

      • 29.2 The Navigation Application template

        • 29.2.1 Creating a navigation application

        • 29.2.2 Adding a new page

        • 29.2.3 Changing the application theme

      • 29.3 Navigating to pages

        • 29.3.1 The Page class

        • 29.3.2 The NavigationService class

        • 29.3.3 Frames and URIs

        • 29.3.4 Caching pages

        • 29.3.5 Navigating to pages in other assemblies

      • 29.4 Navigation out of the browser

        • 29.4.1 Providing custom navigation controls

      • 29.5 Summary

    • 30 Working with files and directories

      • 30.1 Using the file open and save dialogs

        • 30.1.1 Working with the OpenFileDialog

        • 30.1.2 Saving files with the SaveFileDialog

      • 30.2 Working with directories

        • 30.2.1 Getting directory timestamps

        • 30.2.2 Checking for directory existence

        • 30.2.3 Getting the directory root

        • 30.2.4 Creating and deleting directories

        • 30.2.5 Listing directory contents

        • 30.2.6 Accessing special folders

      • 30.3 Working with individual files

        • 30.3.1 Creating a file

        • 30.3.2 Writing to a file

        • 30.3.3 Reading from a file

        • 30.3.4 Getting and setting file metadata

        • 30.3.5 File utility functions

      • 30.4 Storing data in isolated storage

        • 30.4.1 IsolatedStorageFile: the virtual filesystem

        • 30.4.2 Reading and writing files: the isolated storage way

      • 30.5 Summary

    • 31 Printing

      • 31.1 How Silverlight printing works

        • 31.1.1 The PrintDocument class

        • 31.1.2 The PrintPage Event

        • 31.1.3 Converting to PostScript

        • 31.1.4 Rasterization

        • 31.1.5 Forcing bitmap printing

        • 31.1.6 Forcing vector printing

      • 31.2 Printing onscreen information

        • 31.2.1 Printing the content as is

        • 31.2.2 Reparenting the elements to fit

        • 31.2.3 Scaling content to fit

      • 31.3 Multipage printing dedicated trees

        • 31.3.1 Prerequisites

        • 31.3.2 Printing line items

        • 31.3.3 Adding multipage support

        • 31.3.4 Adding a header and footer

      • 31.4 Summary

    • 32 COM, Native Extensions, and p-invoke

      • 32.1 COM automation

        • 32.1.1 Detecting COM automation availability

        • 32.1.2 Using COM automation to make Silverlight talk

        • 32.1.3 Accessing GPS data using COM automation

        • 32.1.4 Automating Excel

      • 32.2 Native Extensions for Silverlight

        • 32.2.1 Accessing an accelerometer

        • 32.2.2 Integrating with the Windows taskbar

        • 32.2.3 Runtime automation server installation

      • 32.3 P-invoke for API calls

        • 32.3.1 Setting up the printer application

        • 32.3.2 The Win32 API interface

      • 32.4 Summary

  • Part 6 Best practices

    • 33 Structuring and testing with the MVVM pattern

      • 33.1 Project setup and traditional code-behind approach

        • 33.1.1 Project and service setup

        • 33.1.2 A typical code-behind solution

      • 33.2 Model-View-ViewModel basics

        • 33.2.1 Myths about MVVM Model-View-ViewModel

        • 33.2.2 Keep it simple: a basic ViewModel implementation

      • 33.3 Factoring out reusable code

        • 33.3.1 Business rules and logic

        • 33.3.2 Data access and service calls

      • 33.4 Better separation from the UI

        • 33.4.1 Using commands

        • 33.4.2 Using the CallMethodAction behavior

        • 33.4.3 View-specific entities and ViewModels

        • 33.4.4 Interfaces, IoC, and ViewModel locators

      • 33.5 Testing MVVM applications

        • 33.5.1 Introduction to the Silverlight Unit Testing Framework

        • 33.5.2 Testing the ViewModel

        • 33.5.3 Testing asynchronous operations

      • 33.6 Summary

    • 34 Debugging your application

      • 34.1 Debugging basics

        • 34.1.1 Using the Debug class

        • 34.1.2 IDE breakpoints

        • 34.1.3 The good old MessageBox

      • 34.2 Binding debugging

        • 34.2.1 Viewing binding errors in the output window

        • 34.2.2 Debugging with custom value converters

        • 34.2.3 Using XAML breakpoints

      • 34.3 Troubleshooting network operations

        • 34.3.1 Installing Fiddler

        • 34.3.2 Monitoring and logging traffic

        • 34.3.3 Inspecting individual requests

      • 34.4 Summary

    • 35 The install experience and preloaders

      • 35.1 Handling the ‘Silverlight not installed’ scenarios

        • 35.1.1 Creating your own install experience

      • 35.2 Using a custom preloader

        • 35.2.1 Creating the appearance

        • 35.2.2 Integrating the custom splash screen

        • 35.2.3 Monitoring the load progress

      • 35.3 Summary

  • appendix A: Database, connection, and data model setup

    • A.1 Install the AdventureWorks database

      • A.1.1 Installing on a dedicated SQL Server instance

      • A.1.2 Installing on SQL Server Express

    • A.2 Database connection and entities

      • A.2.1 Choosing the entities to create

  • index

    • Symbols

    • Numerics

    • A

    • B

    • C

    • D

    • E

    • F

    • G

    • H

    • I

    • J

    • K

    • L

    • M

    • N

    • O

    • P

    • Q

    • R

    • S

    • T

    • U

    • V

    • W

    • X

    • Y

    • Z

  • Silverlight 5-back

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

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

Tài liệu liên quan