SmartSellTM - The New Way to Sell Online

We won't be beaten by anyone. Guaranteed

Silverlight 4 Unleashed
By

Rating
Product Details

Table of Contents

Foreword xxiiiIntroduction 11 Three Years of Silverlight 7Discovering Silverlight 4 7Learning Silverlight Is Betting on the Future 8How Can They Be So Fast? 9How About Compatibility with Older Versions? 9Cross-Browser and Cross-Platform Compatibility 10Windows and Macintosh 11Linux 12Alternatives to Silverlight 12In the Web Browser 12Out of the Browser 13Legacy Technologies 14A Short History of Silverlight 15Silverlight 1.0 16Silverlight 2 16Silverlight 3 16And Silverlight 4 17Previewing the Future of Silverlight 17Installing Silverlight 4 as a User 18Opening a Silverlight 4 Application 19What to Do If Silverlight Is Not Installed? 19Exploring Silverlight 4 Demos 19Deep Zooming the Matterhorn 19Getting Involved Socially with Sobees 20Navigating with Bing Maps Streetside and PhotoSynth 21Visualizing Information with the Pivot Viewer 23Drawing on the Web with Fantasia 25How Can You Get Involved? 25Summary 262 Setting Up and Discovering Your Environment 27Installing Visual Studio 27Visual Studio 2010 27Visual Web Developer Express 28Installing the Silverlight Tools for Visual Studio 28Verifying the Installation 29Inspecting the Application 31Unpacking an XAP File 32Using the Visual Studio Designer 32Implementing Hello Silverlight 33Checking the Properties Editor 34Adding Some Text 36Using Design Time Width and Height 39Saving the Application 40Installing Expression Blend 40Creating a New Silverlight Application 40Opening Hello Silverlight 41Adding an Effect 42Creating a Pulse Animation 44Triggering the Storyboard 45Testing the Application 46Summary 473 Extending Your Application with Controls 49Extending XAML 49Mapping a Prefix to a CLR Namespace 49Why Is a Prefix Not Always Needed? 52Adding a Namespace to Any Element 52Defining Your Own URI and Mapping CLR Namespaces 52What's a Control? 53User Controls 53Custom Controls 63Summary 734 Investigating Existing Controls 75Reviewing the Basics 75Show Me Some Code! 76Changes in Existing Controls 77Mouse Wheel Support 77Localizing for Right-to-Left Languages 77Getting a Control Template's Current State 78Adding SelectedValue and SelectedValuePath 79Adding Command and CommandParameter 79Presenting and Editing Text with the RichTextBox 84Zooming with the Viewbox 85Opening a ChildWindow 87Finding More Information 90Where to Find Additional Controls? 90Do You Really Need a Control? 90The Silverlight Toolkit 91Installing the Silverlight Toolkit 92Third-Party Providers 101Summary 1025 Understanding Dependency Properties 103Inheriting DependencyObject 104Threading 104Accessing a Dependency Property's Value 105Using a DependencyObject as Data Item 105Registering Dependency Properties 108Defining Metadata 109Initializing Dependency Objects 111Understanding Attached Properties 114Using Attached Properties for Values 114Registering an Attached Property 115Using Custom Attached Properties in XAML 118Implementing an Attached Behavior 118Building on Attached Behaviors with Blend Behaviors 122Adding a New Property with Snippets 123Installing the Snippets for Silverlight 123Using the Snippets 124Calculating a Dependency Property's Value 124Getting the Property's Base Value 126Reading the Local Value 126Summary 1276 Working with Data: Binding, Grouping, Sorting, and Filtering 129Diving into Data Bindings 130Understanding a Binding's Elements 130Understanding the Namescope 132Setting the Source 133Refining the Path 136Flowing in Two Directions 138Converting the Values 138Changing the Format 139Handling Special Cases 141Property Trigger 142Validating Input 142Using the Visual Studio Binding Dialog 146Using the Expression Blend Binding Dialog 148Debugging Data Bindings 149Checking the Output Tab 149Creating a Test Converter 150Grouping, Filtering, and Sorting Data 151Working with the CollectionViewSource 151Using a PagedCollectionView 154Binding Directly to the Source 154Summary 1557 Understanding the Model-View-ViewModel Pattern 157About Design Patterns 157Separating the Concerns 158Why Is Separation Good? 158Classic Separation Patterns 158History of MVVM 159Developing Expression Blend 160Presentation Model for WPF and Silverlight 160Architecture of MVVM 160Translating to Silverlight 161Two Kinds of View-models 162Binding the View to the View-model 163Understanding the Data Context 163Inheriting the Data Context 164Binding to the View 164Building a Sample Application 168The Model's Interface 168Building a CustomerViewModel 170Calling the Service in the MainViewModel 172Binding to Results 174Testing the Application 177Bridging the Separation 178Implementing a ViewModelBase Class 178Using Commands 180Sending Messages 183Using an MVVM Framework 184What Could Be Better? 184Summary 1848 Using Data Controls 187Filtering and Paging with the PagedCollectionView 188Preparing the Sample 188Building the PagedCollectionView 190Filtering Data 192Paging Through Data 194Optimizing Data Handling 195Implementing Custom Sorting 195Adding a DataPager Control 196Customizing the Display 197Validating Data Input 197Using Interface-Based Validation 198Validating with Data Annotations 201Validating Before or After the Data Is Set 203Validating on the Client and on the Server 203Reviewing the DataGrid 204Using the DataGrid with Automatic Columns 204Choosing Between DataGrid and ListBox 208Editing Data in the DataForm 208Adding a Description 210Validating the Input 211Committing Changes Manually 211Defining Fields Manually 212Getting More Information 213Making a Simple Property Editor 213Summary 2149 Connecting to the Web 215Getting Information from Cross-Domain Servers 216Checking Whether a Policy File Exists 216Working Around Cross-Domain Restrictions 217Placing Simple Calls 218Informing the User 218Learning with a Sample 219Downloading Strings 219Detecting Errors, Checking the Result 223Opening a Resource for Reading 224Uploading a String 225Opening a Resource for Writing 227Accessing Headers 231Sending Complex Messages 231Posting a File to the Server with HttpWebRequest 231Discovering the New Networking Stack 234Using the Client HTTP Stack 235Using Other HTTP Methods 236Using the CookieContainer 236Handling Responses 237Handling XML Responses 238Handling JSON Responses 238Communicating with WCF 239Setting Up a Service 239Connecting the Client Application 241Updating the Code on the Server 244Publishing the Service 244Summary 24510 Creating Resources, Styles, and Templates 247Working with Resources in XAML 248Using Local Resources 248Merging Dictionaries 249From the Same Assembly 250From a Different Assembly 251Resolving Resources 254Working with Resources in Blend 256Merging a Resource Dictionary 256Creating New Resources 257Selecting a Resource for a Property 257Using the Resources Panel 257Cleaning Up Unused Resources 259Using the Pistachio Tool 259Styling a Control 260Using Implicit Styles 261Creating a Hierarchy of Styles 263Creating a New Style in Blend 264Templating a Control 265Copying a Template in Blend 265Creating a Custom Easing Function 269Making a Control in Blend 270Applying a Theme 271Summary 27211 Mastering Expression Blend 273What Is Blend, Exactly? 274Working as a Tool for Integrators 274Editing XAML Markup 274When Should You Use User Controls? 274Making an Application Blend 275Why Is Some Code Not Executed? 275Why Does Some Code Fail? 275Detecting the Cause of an Exception 276Isolating Code in Design Mode 278Creating Design Time Data in Blend 280Understanding the Design-Time Data Context 288Using Blend Behaviors 289Behavior, Trigger, or Action? 292Adding a Blend Behavior in Code 293Creating a New Blend Behavior 293Finding More Information 300Summary 30012 Sketching User Experience 301Sketching as a Discovery Process 301Using Sketching and Wireframing Tools 302Other Kinds of Sketching 303Discovering SketchFlow 304Creating a New SketchFlow Application 305Checking the Panels 305Creating and Connecting Screens 305Building the UI 308Creating a Component Screen 309Using Sketch Controls 310Exploring the Sketch Controls 313Creating States and Transitions 318Building an Animation 321Deploying the SketchFlow Application 323Running the Prototype 323Giving Feedback 324Importing and Managing User Feedback 325Importing and Exporting 325Importing from Photoshop and Illustrator 326Importing from PowerPoint 326Exporting to Word 326Integrating and Collaborating 327Integrating into SharePoint 327Integrating into Team Foundation Server 327Summary 32813 Creating Line-of-Business Applications 329Preparing the Server-Side 331Prerequisites 332Preparing the Server-Side Application 332Creating the Silverlight Client 333Bringing the Client and the Server Together 334Adding a Domain Service 334Inspecting the Domain Service Class 335Inspecting the Metadata 336Creating a New Server-Side Query 336Working with the Visual Designer 338Understanding the DomainDataSource 339Calling a Query with Parameter 339Sorting the Data 341Adding a Pager 341Refactoring the Application to MVVM 342Adding a View-model 342Adapting the XAML Markup 345Customizing the Columns 346Localizing the User Interface 347Adding a RelayCommand Class 348Executing the CRUD Operations in Code 348Displaying Messages from the View-model 351Deleting an Order 354Validating the Values 357Filtering the Data 360Showing Feedback While Processing 362Sharing Code 363Summary 36314 Enhancing Line-of-Business Applications and Running Out of the Browser 365Enhancing LOB Applications 365Adding Paging 365Showing Errors 369Reconciling Data 371Copying and Pasting Rows 373Printing 373Taking Silverlight Out of the Browser 382Setting Up the Application 383Uninstalling the Application 384Debugging the OOB Application 385Looking Under the Hood 386Changing the Settings 387Updating the Application 391Installing from the Code 393Saving Files 395Working Offline 398Summary 39915 Developing Navigation Applications and Silverlight for Windows Phone 7 401Navigating with Silverlight 401Should You Always Use a Navigation Application? 404Creating a New Navigation Application 404Accessing Navigation Information 412Providing Custom Navigation 413Adding Navigation to a Non-Navigation Application 414Developing with Silverlight for Windows Phone 7 415Getting Hardware 416Targeting a Specific Audience 416Developing for Windows Phone 7 416Developing for a Uniform Hardware Platform 417Designing for the Phone 418Installing the Tools 419Selling Your Applications 420Building Compatible Applications for the Desktop and the Phone 420Continuing the Exploration 432Summary 43216 Using Effects and Recording Media 435Creating Effects with Pixel Shaders 435Writing, Finding, and Compiling Shader Files 436Creating and Modifying Shaders with Shazzam 437Integrating Shaders in the Application 438Adding Properties and Animating Shaders 440Using Shaders for Transitions in the VSM 443Accessing the Webcam and the Microphone 443Getting the List of Devices 444Enabling Access 448Displaying the Video Output 448Detecting Whether Other Applications Use the Device 449Capturing Audio 450Converting to a WAV File 450Creating a Sink 450Using the SaveFileDialog 452Using the Sink and Adding Commands 454Wiring the Commands 456Testing Audio Recording 457Writing to a Bitmap 457Saving the Picture to a PNG File 459Manipulating Pixels 460Extending WriteableBitmap 462Using the Open File Dialog 464Learning About News in Media 465Summary 46617 New Transforms, Right Click, HTML Browser, WebBrowserBrush, and Isolated Storage 467Transforming Elements in a Projection 467Setting Additional Properties 469Using a Matrix3DProjection 470Animating the PlaneProjection 470Composing Transforms 472Handling the Right-Click Event 473Handling a Routed Event 473Displaying a Context Menu 476Hosting an HTML Browser (Out-of-the-Browser Only) 478Understanding the Limitations 479Building a Simple Web Browser 480Loading HTML Content from Memory 484Invoking JavaScript 485Writing and Reading in the Isolated Storage 485Saving to the Isolated Storage 485Reading from the Isolated Storage 492Deleting Files 495Using the IsolatedStorageSettings 496Trusting the Isolated Storage or Not 499Painting with HTML 499Summary 50118 Drag and Drop, Full Screen, Clipboard, COM Interop, Duplex Polling, Notification Windows, and Splash Screens 503Dragging and Dropping 503Dragging Files on the Silverlight Application 504Drag-and-Drop Restrictions 505Working in Full Screen 507Getting Keyboard Support in Full-Screen Mode(Elevated Permissions) 507Using Full Screen on a Monitor While Working on Another 509Copying to and from the Clipboard 510Working with COM (Elevated Permissions) 512Understanding the Restrictions 512Communicating with Microsoft Office 512Communicating over Duplex Polling 519Implementing the Server-Side Service 519Unregistering a Client 524Configuring the Service 524Implementing the Client 525Unsubscribing and Resubscribing 528Testing the Application 529Displaying Notification Windows 530Understanding the Restrictions 530Adding a Notification Window 531Queuing Notification Windows 533Interacting with the Main Window 533Creating a Custom Splash Screen 534Summary 53719 Authentication, Event to Command Binding, Random Animations, Multitouch, Local Communication, and Bing Maps Control 539Logging In with Authentication 539Creating a New Website 540Adding and Managing Users 541Configuring the Authentication Web Service 542Checking the Access 544Adding References to the Services 544Implementing the Client 545Binding an Event to a Command 547Executing a Command When a TextBox Loses Focus 548Building Random Animations 554Creating the Base Animation in Blend 554Randomizing the Animation 555Implementing Multitouch in Silverlight 557Getting the Right Computer 558Investigating Existing Elements 559Using Multitouch Libraries 560Scaling, Rotating, and Translating 560Implementing a Multitouch Application 561Using Multitouch in Windows Phone 7 Applications 563Finding More Information 563Enabling Local Communication 563Understanding the Restrictions 564Building a Receiver 564Building a Sender 565Testing the Application 567Mapping with the Bing Maps Control 567Adding the Map 568Getting Location Information and Marking It 569Getting More Information 571Summary 57120 Building Extensible and Maintainable Applications 573Inverting Dependencies with Unity 573Refactoring to Smaller and Simpler Classes 575Setting Up the Services 578Calling the Setup Method and Wiring Up 582Discovering More About Unity 583Composing an Application with MEF 583Exporting and Importing 584Downloading on Demand 594What About Prism? 603Using an MVVM Framework 604Discovering the Components 604Sending Messages 604Summary 60721 Optimizing Performance 609Improving the XAP Download Time 609Loading Content on Demand 611Caching Common Assemblies 615Virtualizing the User Interface 616Virtualizing the ItemsControl 617Unvirtualizing the ListBox 619Simplifying the DataTemplate 619Creating Items in Batches 620Working in Threads 621Accelerating the User Interface 624Enabling Hardware Acceleration in the Browser 624Enabling Hardware Acceleration Out of the Browser 628Accelerating with Care 629Accelerating in the Windows Phone 7 630Using a Code Profiler 630Avoiding Memory Leaks 631Saving an Object on the Stack or the Heap 631Collecting Garbage and Leaking Memory 632Living a Shorter Life 635Unregistering Event Handlers 635Disposing Objects 637Using Weak References 637Finding a Leak 638Summary 63922 Advanced Development Techniques 641Using New C# and NET Features 641Using Modern Programming Syntax 641Creating Extension Methods 645Consuming Dynamic Objects 646Using Named/Optional Parameters 646Localizing Applications 647Adding a Resource File 647Making an Application Localizable 648Using Tools 651Downloading Resource Applications on Demand 652Encrypting and Decrypting 652Understanding the Encryption/Decryption Mechanism 652Multithreading 653What Is a Thread? 653Using the ThreadPool 654Dispatching Back to the UI Thread 657Creating and Using a BackgroundWorker 660Locking Critical Resources 663Enhancing Multithreaded Code 666Unit Testing the Application 667Installing a Unit Test Framework 668Adding Functionality with TDD 668Using Code Coverage 673Unit Testing Windows Phone 7 Applications 673Summary 674Conclusion 675Index 677

About the Author

Laurent Bugnion works as a senior user-experience integrator for IdentityMine, one of the leading companies committed to redefining the user experience and a Microsoft Gold Partner dedicated to easing the adoption and optimal use of Microsoft presentation technologies, including Windows Presentation Foundation (WPF), Silverlight, Windows Phone 7, Surface, and Windows 7. Originally an electronics engineer, Laurent achieved postgrad credentials in software engineering in 1999. Before IdentityMine, he worked for Siemens for 13 years, introducing WPF and other .NET 3.5 technologies worldwide. His responsibilities involved developing with the previously mentioned technologies, training and coaching his colleagues, coordinating and integrating the graphic-design work, and fostering relationships with Microsoft. Before that, he wrote embedded C/C++, and then moved to desktop computers in Java, JavaScript, and eventually .NET (desktop and ASP.NET). Privately, he codes in Silverlight, WPF, and ASP.NET. He blogs on http://blog.galasoft.ch and writes on http://www.galasoft.ch, where he publishes articles, prototypes, and demos related to the previously mentioned technologies. In 2008, he earned an MCTS for WPF. (In October of that same year, his book Silverlight 2 Unleashed was published.) This year, 2010, is his fourth year as a Microsoft MVP (Silverlight), and he was selected this year as Silverlight MVP of the year. Laurent is based in Zurich, Switzerland, where he lives with his wife, Chi Meei, and his two daughters, Alise and Laeticia.

Ask a Question About this Product More...
Write your question below:
Look for similar items by category
Home » Books » Computers » Internet » General
Home » Books » Computers » Programming » General
How Fishpond Works
Fishpond works with suppliers all over the world to bring you a huge selection of products, really great prices, and delivery included on over 25 million products that we sell. We do our best every day to make Fishpond an awesome place for customers to shop and get what they want — all at the best prices online.
Webmasters, Bloggers & Website Owners
You can earn a 5% commission by selling Silverlight 4 Unleashed on your website. It's easy to get started - we will give you example code. After you're set-up, your website can earn you money while you work, play or even sleep! You should start right now!
Authors / Publishers
Are you the Author or Publisher of a book? Or the manufacturer of one of the millions of products that we sell. You can improve sales and grow your revenue by submitting additional information on this title. The better the information we have about a product, the more we will sell!
Item ships from and is sold by Fishpond World Ltd.
Back to top