Silverlight 4 Unleashed 1267208945, 9780672333361, 0672333368

Book annotation not available for this title.Title:Silverlight 4 UnleashedAuthor:Bugnion, LaurentPublisher:Pearson P T R

211 57 9MB

English Pages 710 [737] Year 2010

Report DMCA / Copyright

DOWNLOAD PDF FILE

Table of contents :
Cover......Page 1
Table of Contents......Page 5
Foreword......Page 24
Introduction......Page 26
Discovering Silverlight 4......Page 32
Learning Silverlight Is Betting on the Future......Page 33
How About Compatibility with Older Versions?......Page 34
Cross-Browser and Cross-Platform Compatibility......Page 35
Windows and Macintosh......Page 36
In the Web Browser......Page 37
Out of the Browser......Page 38
Legacy Technologies......Page 39
A Short History of Silverlight......Page 40
Silverlight 3......Page 41
Previewing the Future of Silverlight......Page 42
Installing Silverlight 4 as a User......Page 43
Deep Zooming the Matterhorn......Page 44
Getting Involved Socially with Sobees......Page 45
Navigating with Bing Maps Streetside and PhotoSynth......Page 46
Visualizing Information with the Pivot Viewer......Page 48
How Can You Get Involved?......Page 50
Summary......Page 51
Visual Studio 2010......Page 52
Installing the Silverlight Tools for Visual Studio......Page 53
Verifying the Installation......Page 54
Inspecting the Application......Page 56
Using the Visual Studio Designer......Page 57
Implementing Hello Silverlight......Page 58
Checking the Properties Editor......Page 59
Adding Some Text......Page 61
Using Design Time Width and Height......Page 64
Creating a New Silverlight Application......Page 65
Opening Hello Silverlight......Page 66
Adding an Effect......Page 67
Creating a Pulse Animation......Page 69
Triggering the Storyboard......Page 70
Testing the Application......Page 71
Summary......Page 72
Mapping a Prefix to a CLR Namespace......Page 74
Defining Your Own URI and Mapping CLR Namespaces......Page 77
User Controls......Page 78
Custom Controls......Page 88
Summary......Page 98
Reviewing the Basics......Page 100
Show Me Some Code!......Page 101
Localizing for Right-to-Left Languages......Page 102
Getting a Control Template's Current State......Page 103
Adding Command and CommandParameter......Page 104
Presenting and Editing Text with the RichTextBox......Page 109
Zooming with the Viewbox......Page 110
Opening a ChildWindow......Page 112
Do You Really Need a Control?......Page 115
The Silverlight Toolkit......Page 116
Installing the Silverlight Toolkit......Page 117
Third-Party Providers......Page 126
Summary......Page 127
5 Understanding Dependency Properties......Page 128
Threading......Page 129
Using a DependencyObject as Data Item......Page 130
Registering Dependency Properties......Page 133
Defining Metadata......Page 134
Initializing Dependency Objects......Page 136
Using Attached Properties for Values......Page 139
Registering an Attached Property......Page 140
Implementing an Attached Behavior......Page 143
Building on Attached Behaviors with Blend Behaviors......Page 147
Installing the Snippets for Silverlight......Page 148
Calculating a Dependency Property's Value......Page 149
Reading the Local Value......Page 151
Summary......Page 152
6 Working with Data: Binding, Grouping, Sorting, and Filtering......Page 154
Understanding a Binding's Elements......Page 155
Understanding the Namescope......Page 157
Setting the Source......Page 158
Refining the Path......Page 161
Converting the Values......Page 163
Changing the Format......Page 164
Handling Special Cases......Page 166
Validating Input......Page 167
Using the Visual Studio Binding Dialog......Page 171
Using the Expression Blend Binding Dialog......Page 173
Checking the Output Tab......Page 174
Creating a Test Converter......Page 175
Working with the CollectionViewSource......Page 176
Binding Directly to the Source......Page 179
Summary......Page 180
About Design Patterns......Page 182
Classic Separation Patterns......Page 183
History of MVVM......Page 184
Architecture of MVVM......Page 185
Translating to Silverlight......Page 186
Two Kinds of View-models......Page 187
Understanding the Data Context......Page 188
Binding to the View......Page 189
The Model's Interface......Page 193
Building a CustomerViewModel......Page 195
Calling the Service in the MainViewModel......Page 197
Binding to Results......Page 199
Testing the Application......Page 202
Implementing a ViewModelBase Class......Page 203
Using Commands......Page 205
Sending Messages......Page 208
Summary......Page 209
8 Using Data Controls......Page 212
Preparing the Sample......Page 213
Building the PagedCollectionView......Page 215
Filtering Data......Page 217
Paging Through Data......Page 219
Implementing Custom Sorting......Page 220
Adding a DataPager Control......Page 221
Validating Data Input......Page 222
Using Interface-Based Validation......Page 223
Validating with Data Annotations......Page 226
Validating on the Client and on the Server......Page 228
Using the DataGrid with Automatic Columns......Page 229
Editing Data in the DataForm......Page 233
Adding a Description......Page 235
Committing Changes Manually......Page 236
Defining Fields Manually......Page 237
Making a Simple Property Editor......Page 238
Summary......Page 239
9 Connecting to the Web......Page 240
Checking Whether a Policy File Exists......Page 241
Working Around Cross-Domain Restrictions......Page 242
Informing the User......Page 243
Downloading Strings......Page 244
Detecting Errors, Checking the Result......Page 248
Opening a Resource for Reading......Page 249
Uploading a String......Page 250
Opening a Resource for Writing......Page 252
Posting a File to the Server with HttpWebRequest......Page 256
Discovering the New Networking Stack......Page 259
Using the Client HTTP Stack......Page 260
Using the CookieContainer......Page 261
Handling Responses......Page 262
Handling JSON Responses......Page 263
Setting Up a Service......Page 264
Connecting the Client Application......Page 266
Publishing the Service......Page 269
Summary......Page 270
10 Creating Resources, Styles, and Templates......Page 272
Using Local Resources......Page 273
Merging Dictionaries......Page 274
From the Same Assembly......Page 275
From a Different Assembly......Page 276
Resolving Resources......Page 279
Merging a Resource Dictionary......Page 281
Using the Resources Panel......Page 282
Using the Pistachio Tool......Page 284
Styling a Control......Page 285
Using Implicit Styles......Page 286
Creating a Hierarchy of Styles......Page 288
Creating a New Style in Blend......Page 289
Copying a Template in Blend......Page 290
Creating a Custom Easing Function......Page 294
Making a Control in Blend......Page 295
Applying a Theme......Page 296
Summary......Page 297
11 Mastering Expression Blend......Page 298
When Should You Use User Controls?......Page 299
Why Does Some Code Fail?......Page 300
Detecting the Cause of an Exception......Page 301
Isolating Code in Design Mode......Page 303
Creating Design Time Data in Blend......Page 305
Understanding the Design-Time Data Context......Page 313
Using Blend Behaviors......Page 314
Behavior, Trigger, or Action?......Page 317
Creating a New Blend Behavior......Page 318
Summary......Page 325
Sketching as a Discovery Process......Page 326
Using Sketching and Wireframing Tools......Page 327
Other Kinds of Sketching......Page 328
Discovering SketchFlow......Page 329
Creating and Connecting Screens......Page 330
Building the UI......Page 333
Creating a Component Screen......Page 334
Using Sketch Controls......Page 335
Exploring the Sketch Controls......Page 338
Creating States and Transitions......Page 343
Building an Animation......Page 346
Running the Prototype......Page 348
Giving Feedback......Page 349
Importing and Exporting......Page 350
Exporting to Word......Page 351
Integrating into Team Foundation Server......Page 352
Summary......Page 353
13 Creating Line-of-Business Applications......Page 354
Preparing the Server-Side......Page 356
Preparing the Server-Side Application......Page 357
Creating the Silverlight Client......Page 358
Adding a Domain Service......Page 359
Inspecting the Domain Service Class......Page 360
Creating a New Server-Side Query......Page 361
Working with the Visual Designer......Page 363
Calling a Query with Parameter......Page 364
Adding a Pager......Page 366
Adding a View-model......Page 367
Adapting the XAML Markup......Page 370
Customizing the Columns......Page 371
Localizing the User Interface......Page 372
Executing the CRUD Operations in Code......Page 373
Displaying Messages from the View-model......Page 376
Deleting an Order......Page 379
Validating the Values......Page 382
Filtering the Data......Page 385
Showing Feedback While Processing......Page 387
Summary......Page 388
Adding Paging......Page 390
Showing Errors......Page 394
Reconciling Data......Page 396
Printing......Page 398
Taking Silverlight Out of the Browser......Page 407
Setting Up the Application......Page 408
Uninstalling the Application......Page 409
Debugging the OOB Application......Page 410
Looking Under the Hood......Page 411
Changing the Settings......Page 412
Updating the Application......Page 416
Installing from the Code......Page 418
Saving Files......Page 420
Working Offline......Page 423
Summary......Page 424
Navigating with Silverlight......Page 426
Creating a New Navigation Application......Page 429
Accessing Navigation Information......Page 437
Providing Custom Navigation......Page 438
Adding Navigation to a Non-Navigation Application......Page 439
Developing with Silverlight for Windows Phone 7......Page 440
Developing for Windows Phone 7......Page 441
Developing for a Uniform Hardware Platform......Page 442
Designing for the Phone......Page 443
Installing the Tools......Page 444
Building Compatible Applications for the Desktop and the Phone......Page 445
Summary......Page 457
Creating Effects with Pixel Shaders......Page 460
Writing, Finding, and Compiling Shader Files......Page 461
Creating and Modifying Shaders with Shazzam......Page 462
Integrating Shaders in the Application......Page 463
Adding Properties and Animating Shaders......Page 465
Accessing the Webcam and the Microphone......Page 468
Getting the List of Devices......Page 469
Displaying the Video Output......Page 473
Detecting Whether Other Applications Use the Device......Page 474
Creating a Sink......Page 475
Using the SaveFileDialog......Page 477
Using the Sink and Adding Commands......Page 479
Wiring the Commands......Page 481
Writing to a Bitmap......Page 482
Saving the Picture to a PNG File......Page 484
Manipulating Pixels......Page 485
Extending WriteableBitmap......Page 487
Using the Open File Dialog......Page 489
Learning About News in Media......Page 490
Summary......Page 491
Transforming Elements in a Projection......Page 492
Setting Additional Properties......Page 494
Animating the PlaneProjection......Page 495
Composing Transforms......Page 497
Handling a Routed Event......Page 498
Displaying a Context Menu......Page 501
Hosting an HTML Browser (Out-of-the-Browser Only)......Page 503
Understanding the Limitations......Page 504
Building a Simple Web Browser......Page 505
Loading HTML Content from Memory......Page 509
Saving to the Isolated Storage......Page 510
Reading from the Isolated Storage......Page 517
Deleting Files......Page 520
Using the IsolatedStorageSettings......Page 521
Painting with HTML......Page 524
Summary......Page 526
Dragging and Dropping......Page 528
Dragging Files on the Silverlight Application......Page 529
Drag-and-Drop Restrictions......Page 530
Getting Keyboard Support in Full-Screen Mode (Elevated Permissions)......Page 532
Using Full Screen on a Monitor While Working on Another......Page 534
Copying to and from the Clipboard......Page 535
Communicating with Microsoft Office......Page 537
Implementing the Server-Side Service......Page 544
Configuring the Service......Page 549
Implementing the Client......Page 550
Unsubscribing and Resubscribing......Page 553
Testing the Application......Page 554
Understanding the Restrictions......Page 555
Adding a Notification Window......Page 556
Interacting with the Main Window......Page 558
Creating a Custom Splash Screen......Page 559
Summary......Page 562
Logging In with Authentication......Page 564
Creating a New Website......Page 565
Adding and Managing Users......Page 566
Configuring the Authentication Web Service......Page 567
Adding References to the Services......Page 569
Implementing the Client......Page 570
Binding an Event to a Command......Page 572
Executing a Command When a TextBox Loses Focus......Page 573
Creating the Base Animation in Blend......Page 579
Randomizing the Animation......Page 580
Implementing Multitouch in Silverlight......Page 582
Getting the Right Computer......Page 583
Investigating Existing Elements......Page 584
Scaling, Rotating, and Translating......Page 585
Implementing a Multitouch Application......Page 586
Enabling Local Communication......Page 588
Building a Receiver......Page 589
Building a Sender......Page 590
Mapping with the Bing Maps Control......Page 592
Adding the Map......Page 593
Getting Location Information and Marking It......Page 594
Summary......Page 596
Inverting Dependencies with Unity......Page 598
Refactoring to Smaller and Simpler Classes......Page 600
Setting Up the Services......Page 603
Calling the Setup Method and Wiring Up......Page 607
Composing an Application with MEF......Page 608
Exporting and Importing......Page 609
Downloading on Demand......Page 619
What About Prism?......Page 628
Sending Messages......Page 629
Summary......Page 632
Improving the XAP Download Time......Page 634
Loading Content on Demand......Page 636
Caching Common Assemblies......Page 640
Virtualizing the User Interface......Page 641
Virtualizing the ItemsControl......Page 642
Simplifying the DataTemplate......Page 644
Creating Items in Batches......Page 645
Working in Threads......Page 646
Enabling Hardware Acceleration in the Browser......Page 649
Enabling Hardware Acceleration Out of the Browser......Page 653
Accelerating with Care......Page 654
Using a Code Profiler......Page 655
Saving an Object on the Stack or the Heap......Page 656
Collecting Garbage and Leaking Memory......Page 657
Unregistering Event Handlers......Page 660
Using Weak References......Page 662
Finding a Leak......Page 663
Summary......Page 664
Using Modern Programming Syntax......Page 666
Creating Extension Methods......Page 670
Using Named/Optional Parameters......Page 671
Adding a Resource File......Page 672
Making an Application Localizable......Page 673
Using Tools......Page 676
Understanding the Encryption/Decryption Mechanism......Page 677
What Is a Thread?......Page 678
Using the ThreadPool......Page 679
Dispatching Back to the UI Thread......Page 682
Creating and Using a BackgroundWorker......Page 685
Locking Critical Resources......Page 688
Enhancing Multithreaded Code......Page 691
Unit Testing the Application......Page 692
Adding Functionality with TDD......Page 693
Unit Testing Windows Phone 7 Applications......Page 698
Summary......Page 699
Conclusion......Page 700
A......Page 702
B......Page 704
C......Page 705
D......Page 714
E......Page 716
G......Page 718
H......Page 719
I......Page 720
L......Page 721
M......Page 722
O......Page 724
P......Page 725
Q–R......Page 727
S......Page 728
T......Page 731
U......Page 732
V......Page 733
W......Page 734
X–Z......Page 735

Silverlight 4 Unleashed
 1267208945, 9780672333361, 0672333368

  • 0 0 0
  • Like this paper and download? You can publish your own PDF file online for free in a few minutes! Sign Up
File loading please wait...
Recommend Papers