You are previewing Silverlight Recipes: A Problem-Solution Approach, Second Edition.
O'Reilly logo
Silverlight Recipes: A Problem-Solution Approach, Second Edition

Book Description

Silverlight Recipes: A Problem-Solution Approach, Second Edition is your practical companion to developing rich, interactive web applications with Microsoft's latest technology. This book tackles common problems and scenarios that on-the-job developers face every day by revealing code and detailed solutions. You'll quickly be able to integrate real-world, functioning code into your applications—and save hours of coding time.

The recipes included in Silverlight Recipes have been carefully selected and tested with the professional developer in mind. You'll find problems stated clearly and succinctly, artful solutions explored, and ample discussion of the code and context so you're immediately clear how the solution will support your project. You'll also discover the innovations presented in Silverlight 4 and how to effectively employ them.

Enjoy practical coverage of Silverlight development in many projects and contexts, including:

  • Designing complete, rich, interactive user experiences

  • Manipulating content and the runtime environment through the Silverlight Plug-in Runtime API

  • Consuming, transforming, and displaying content in your Silverlight web application through XML, LINQ-based data access, and isolated storage

  • Building custom controls for your Silverlight project

  • Integrating rich media, including audio and video, to create a very dynamic user interface and experience

  • Using new Silverlight features, including .NET Framework integration, the use of dynamic languages like Python and Ruby in Silverlight development, and digital rights management support

Find instant solutions, comprehensive Silverlight coverage, and time-saving expert advice, all in one book.

Table of Contents

  1. Copyright
  2. About the Authors
  3. About the Technical Reviewers
  4. Acknowledgments
  5. Introduction
    1. Who This Book Is For
    2. How This Book Is Structured
    3. Prerequisites
    4. Downloading the Code
    5. Contacting the Authors
  6. 1. A Quick Tour of Silverlight 4 Development
    1. 1.1. Getting Up to Speed with Silverlight
      1. 1.1.1. Silverlight 3 Highlights
        1. 1.1.1.1. Major Media Enhancements
        2. 1.1.1.2. Enhanced User Experience Rendering Capabilities
        3. 1.1.1.3. Rich Internet Applications and Line-of-Business Enhancements
        4. 1.1.1.4. WCF RIA Services Data Support Improvements
        5. 1.1.1.5. Browser Support
        6. 1.1.1.6. Out-of-Browser Capabilities
      2. 1.1.2. Silverlight 4
        1. 1.1.2.1. Business Application Development
        2. 1.1.2.2. Developer Tools
        3. 1.1.2.3. Interactive User Experiences
        4. 1.1.2.4. Out-of-Browser Programming Model
      3. 1.1.3. Silverlight and Visual Studio 2010
    2. 1.2. Setting Up the Silverlight 4 Environment
      1. 1.2.1. Problem
      2. 1.2.2. Solution
      3. 1.2.3. How It Works
    3. 1.3. Installing Additional Silverlight-Related Services and Controls
      1. 1.3.1. Problem
      2. 1.3.2. Solution
      3. 1.3.3. How It Works
    4. 1.4. Understanding the Structure of a Silverlight Solution
      1. 1.4.1. Problem
      2. 1.4.2. Solution
      3. 1.4.3. How It Works
      4. 1.4.4. The Code
    5. 1.5. Understanding the Developer/Designer Workflow
      1. 1.5.1. Problem
      2. 1.5.2. Solution
      3. 1.5.3. How It Works
        1. 1.5.3.1. The Tools
        2. 1.5.3.2. The Process
    6. 1.6. Understanding the Basics of Expression Blend 4
      1. 1.6.1. Problem
      2. 1.6.2. Solution
      3. 1.6.3. How It Works
      4. 1.6.4. The Code
    7. 1.7. Accessing Source Control
      1. 1.7.1. Problem
      2. 1.7.2. Solution
      3. 1.7.3. How It Works
    8. 1.8. Running Silverlight 4 on a Mac
      1. 1.8.1. Problem
      2. 1.8.2. Solution
      3. 1.8.3. How It Works
    9. 1.9. Running Silverlight on Linux
      1. 1.9.1. Problem
      2. 1.9.2. Solution
      3. 1.9.3. How It Works
  7. 2. Application Design and Programming Model
    1. 2.1. The Mechanics of Silverlight Applications
    2. 2.2. Leverage and Locate Controls and Classes
      1. 2.2.1. Problem
      2. 2.2.2. Solution
      3. 2.2.3. How It Works
        1. 2.2.3.1. Add a Custom Control
        2. 2.2.3.2. Find a Control
    3. 2.3. Dynamically Loading XAML
      1. 2.3.1. Problem
      2. 2.3.2. Solution
      3. 2.3.3. How It Works
      4. 2.3.4. The Code
    4. 2.4. Persisting Data on the Client
      1. 2.4.1. Problem
      2. 2.4.2. Solution
      3. 2.4.3. How It Works
      4. 2.4.4. The Code
    5. 2.5. Opening a Local File from a Silverlight Application
      1. 2.5.1. Problem
      2. 2.5.2. Solution
      3. 2.5.3. How It Works
      4. 2.5.4. The Code
    6. 2.6. Accessing XML Data
      1. 2.6.1. Problem
      2. 2.6.2. Solution
      3. 2.6.3. How It Works
      4. 2.6.4. The Code
    7. 2.7. Managing Unhandled Exceptions
      1. 2.7.1. Problem
      2. 2.7.2. Solution
      3. 2.7.3. How It Works
    8. 2.8. Executing Work on a Background Thread with Updates
      1. 2.8.1. Problem
      2. 2.8.2. Solution
      3. 2.8.3. How It Works
      4. 2.8.4. The Code
    9. 2.9. Updating the UI from a Background Thread
      1. 2.9.1. Problem
      2. 2.9.2. Solution
      3. 2.9.3. How It Works
      4. 2.9.4. The Code
    10. 2.10. Managing XAML Resources
      1. 2.10.1. Problem
      2. 2.10.2. Solution
      3. 2.10.3. How It Works
      4. 2.10.4. The Code
    11. 2.11. Managing Embedded Resources
      1. 2.11.1. Problem
      2. 2.11.2. Solution
      3. 2.11.3. How It Works
      4. 2.11.4. The Code
    12. 2.12. Creating Silverlight Using Ruby, Python, or JScript
      1. 2.12.1. Problem
      2. 2.12.2. Solution
      3. 2.12.3. How It Works
      4. 2.12.4. The Code
    13. 2.13. Creating Application Services
      1. 2.13.1. Problem
      2. 2.13.2. Solution
      3. 2.13.3. How It Works
      4. 2.13.4. The Code
    14. 2.14. Managing Resources in Large Projects
      1. 2.14.1. Problem
      2. 2.14.2. Solution
      3. 2.14.3. How It Works
      4. 2.14.4. The Code
    15. 2.15. Save a File Anywhere on the User's System
      1. 2.15.1. Problem
      2. 2.15.2. Solution
      3. 2.15.3. How It Works
      4. 2.15.4. The Code
  8. 3. Developing User Experiences
    1. 3.1. Importing Art from Expression Design
      1. 3.1.1. Problem
      2. 3.1.2. Solution
      3. 3.1.3. How It Works
    2. 3.2. Working with Color and Gradients in Blend
      1. 3.2.1. Problem
      2. 3.2.2. Solution
      3. 3.2.3. How It Works
      4. 3.2.4. The Code
    3. 3.3. Positioning UI Elements
      1. 3.3.1. Problem
      2. 3.3.2. Solution
      3. 3.3.3. How It Works
        1. 3.3.3.1. Canvas
        2. 3.3.3.2. StackPanel
        3. 3.3.3.3. Grid
      4. 3.3.4. The Code
        1. 3.3.4.1. Code for Canvas
        2. 3.3.4.2. Code for StackPanel
        3. 3.3.4.3. Code for the Grid
    4. 3.4. Drawing with Shapes, Paths, and Geometries
      1. 3.4.1. Problem
      2. 3.4.2. Solution
      3. 3.4.3. How It Works
        1. 3.4.3.1. Drawing with Shapes
        2. 3.4.3.2. Drawing with Path Objects
        3. 3.4.3.3. Drawing with Geometries
      4. 3.4.4. The Code
        1. 3.4.4.1. Drawing with Paths
        2. 3.4.4.2. Drawing with Geometries
    5. 3.5. Providing Scrollable Content
      1. 3.5.1. Problem
      2. 3.5.2. Solution
      3. 3.5.3. How It Works
      4. 3.5.4. The Code
    6. 3.6. Applying a Border to Elements
      1. 3.6.1. Problem
      2. 3.6.2. Solution
      3. 3.6.3. How It Works
      4. 3.6.4. The Code
    7. 3.7. Using Simple Animations with Objects
      1. 3.7.1. Problem
      2. 3.7.2. Solution
      3. 3.7.3. How It Works
      4. 3.7.4. The Code
    8. 3.8. Animating UI Elements with Keyframes
      1. 3.8.1. Problem
      2. 3.8.2. Solution
      3. 3.8.3. How It Works
      4. 3.8.4. The Code
    9. 3.9. Transforming an Object
      1. 3.9.1. Problem
      2. 3.9.2. Solution
      3. 3.9.3. How It Works
      4. 3.9.4. The Code
    10. 3.10. Creating a Simple Cartoon Scene
      1. 3.10.1. Problem
      2. 3.10.2. Solution
      3. 3.10.3. How It Works
      4. 3.10.4. The Code
    11. 3.11. Handling Keyboard Input
      1. 3.11.1. Problem
      2. 3.11.2. Solution
      3. 3.11.3. How It Works
        1. 3.11.3.1.
          1. 3.11.3.1.1. For Macintosh-specific key codes, refer to
      4. 3.11.4. The Code
    12. 3.12. Working with Ink
      1. 3.12.1. Problem
      2. 3.12.2. Solution
      3. 3.12.3. How It Works
      4. 3.12.4. The Code
    13. 3.13. Adding 3-D Effects to UI Elements
      1. 3.13.1. Problem
      2. 3.13.2. Solution
      3. 3.13.3. How It Works
      4. 3.13.4. The Code
    14. 3.14. Dynamically Creating Bitmaps
      1. 3.14.1. Problem
      2. 3.14.2. Solution
      3. 3.14.3. How It Works
      4. 3.14.4. The Code
    15. 3.15. Improving Graphic Animation and Video Performance
      1. 3.15.1. Problem
      2. 3.15.2. Solution
      3. 3.15.3. How It Works
      4. 3.15.4. The Code
    16. 3.16. Improve Animation with Custom Easing Functions
      1. 3.16.1. Problem
      2. 3.16.2. Solution
      3. 3.16.3. How It Works
      4. 3.16.4. The Code
    17. 3.17. Adding Pixel Shader Visual Effects
      1. 3.17.1. Problem
      2. 3.17.2. Solution
      3. 3.17.3. How It Works
      4. 3.17.4. The Code
    18. 3.18. Create and Work with Design-Time Data in Expression Blend
      1. 3.18.1. Problem
      2. 3.18.2. Solution
      3. 3.18.3. How It Works
      4. 3.18.4. The Code
    19. 3.19. Reuse Application Interactivity with Behaviors
      1. 3.19.1. Problem
      2. 3.19.2. Solution
      3. 3.19.3. How It Works
      4. 3.19.4. The Code
    20. 3.20. Customizing the Right-Click Context Menu
      1. 3.20.1. Problem
      2. 3.20.2. How it Works
      3. 3.20.3. The Code
    21. 3.21. Accessing the Clipboard
      1. 3.21.1. Problem
      2. 3.21.2. How it Works
      3. 3.21.3. The Code
    22. 3.22. Using Right-to-Left Text
      1. 3.22.1. Problem
      2. 3.22.2. How it Works
      3. 3.22.3. The Code
    23. 3.23. Prototype Application Design
      1. 3.23.1. Problem
      2. 3.23.2. Solution
      3. 3.23.3. How It Works
      4. 3.23.4. The Code
  9. 4. Data Binding
    1. 4.1. Binding Application Data to the UI
      1. 4.1.1. Problem
      2. 4.1.2. Solution
      3. 4.1.3. How It Works
        1. 4.1.3.1. Binding Expression
        2. 4.1.3.2. Dependency Properties
        3. 4.1.3.3. Associating the Data Source
      4. 4.1.4. The Code
    2. 4.2. Binding Using a DataTemplate
      1. 4.2.1. Problem
      2. 4.2.2. Solution
      3. 4.2.3. How It Works
        1. 4.2.3.1. Declaring a DataTemplate
        2. 4.2.3.2. Using a DataTemplate
      4. 4.2.4. The Code
    3. 4.3. Receiving Change Notifications for Bound Data
      1. 4.3.1. Problem
      2. 4.3.2. Solution
      3. 4.3.3. How It Works
        1. 4.3.3.1. Change Notification for Noncollection Types
        2. 4.3.3.2. Change Notification for Collection Types
      4. 4.3.4. The Code
    4. 4.4. Converting Values During Data Binding
      1. 4.4.1. Problem
      2. 4.4.2. Solution
      3. 4.4.3. How It Works
        1. 4.4.3.1. Implementing Value Conversion
      4. 4.4.4. The Code
    5. 4.5. Binding Across Elements
      1. 4.5.1. Problem
      2. 4.5.2. Solution
      3. 4.5.3. How It Works
        1. 4.5.3.1. Binding to Another Element
        2. 4.5.3.2. Binding to Self
        3. 4.5.3.3. Binding to the TemplatedParent
      4. 4.5.4. The Code
    6. 4.6. Validating Input for Bound Data
      1. 4.6.1. Problem
      2. 4.6.2. Solution
      3. 4.6.3. How It Works
        1. 4.6.3.1. Validation Error Notification
        2. 4.6.3.2. Getting Error Information
        3. 4.6.3.3. Getting a Validation Error Summary
      4. 4.6.4. The Code
    7. 4.7. Controlling Updates
      1. 4.7.1. Problem
      2. 4.7.2. Solution
      3. 4.7.3. How It Works
      4. 4.7.4. The Code
    8. 4.8. Providing reasonable defaults for bound data
      1. 4.8.1. Problem
      2. 4.8.2. Solution
      3. 4.8.3. How It Works
        1. 4.8.3.1. Null Value Replacement
        2. 4.8.3.2. Fallback value
        3. 4.8.3.3. String Formatting
      4. 4.8.4. The Code
  10. 5. Controls
    1. 5.1. A Word About the Samples
    2. 5.2. Customizing a Control's Basic Appearance
      1. 5.2.1. Problem
      2. 5.2.2. Solution
      3. 5.2.3. How It Works
        1. 5.2.3.1. Style Scoping
      4. 5.2.4. The Code
    3. 5.3. Replacing the Default UI of a Control
      1. 5.3.1. Problem
      2. 5.3.2. Solution
      3. 5.3.3. How It Works
        1. 5.3.3.1. Control Template Syntax
        2. 5.3.3.2. Setting the Template
        3. 5.3.3.3. Using Expression Blend to Design a Template
        4. 5.3.3.4. Template Bindings
        5. 5.3.3.5. Content Model and Presenter Controls
        6. 5.3.3.6. Visual State Management
      4. 5.3.4. The Code
    4. 5.4. Customizing the Default ListBoxItem UI
      1. 5.4.1. Problem
      2. 5.4.2. Solution
      3. 5.4.3. How It Works
      4. 5.4.4. The Code
    5. 5.5. Displaying Information in a Pop-up
      1. 5.5.1. Problem
      2. 5.5.2. Solution
      3. 5.5.3. How It Works
        1. 5.5.3.1. Creating and Initializing the Pop-up
        2. 5.5.3.2. Positioning the Pop-up
        3. 5.5.3.3. Creating Pop-up Content
      4. 5.5.4. The Code
    6. 5.6. Displaying Row Details in a DataGrid
      1. 5.6.1. Problem
      2. 5.6.2. Solution
      3. 5.6.3. How It Works
      4. 5.6.4. The Code
    7. 5.7. Applying Custom Templates to a DataGrid Cell
      1. 5.7.1. Problem
      2. 5.7.2. Solution
      3. 5.7.3. How It Works
      4. 5.7.4. The Code
    8. 5.8. Creating Custom Column Types for a DataGrid
      1. 5.8.1. Problem
      2. 5.8.2. Solution
      3. 5.8.3. How It Works
        1. 5.8.3.1. The GenerateElement() Method
        2. 5.8.3.2. The GenerateEditingElement() Method
        3. 5.8.3.3. The PrepareCellForEdit() Method
        4. 5.8.3.4. The CancelCellEdit() Method
      4. 5.8.4. The Code
    9. 5.9. Creating a Composite User Control
      1. 5.9.1. Problem
      2. 5.9.2. Solution
      3. 5.9.3. How It Works
        1. 5.9.3.1. User Control Structure
        2. 5.9.3.2. XAML Loading
        3. 5.9.3.3. Dependency Properties
      4. 5.9.4. The Code
    10. 5.10. Creating a Custom Layout Container
      1. 5.10.1. Problem
      2. 5.10.2. Solution
      3. 5.10.3. How It Works
        1. 5.10.3.1. Motivation and Mechanics
        2. 5.10.3.2. The MeasureOverride() Method
        3. 5.10.3.3. The ArrangeOverride() Method
      4. 5.10.4. The Code
        1. 5.10.4.1. Using the WrapPanel
    11. 5.11. Creating a Custom Control
      1. 5.11.1. Problem
      2. 5.11.2. Solution
      3. 5.11.3. How It Works
        1. 5.11.3.1. Custom Control Structure
        2. 5.11.3.2. TemplateBinding vs. RelativeSource Binding to TemplatedParent
      4. 5.11.4. The Code
        1. 5.11.4.1. Using the Control
    12. 5.12. Defining a Custom Visual State
      1. 5.12.1. Problem
      2. 5.12.2. Solution
      3. 5.12.3. How It Works
      4. 5.12.4. The Code
    13. 5.13. Controlling ScrollViewer Scroll Behavior
      1. 5.13.1. Problem
      2. 5.13.2. Solution
      3. 5.13.3. How It Works
        1. 5.13.3.1. The VisualTreeHelper class
      4. 5.13.4. The Code
    14. 5.14. Customizing the Binding Validation User Interface
      1. 5.14.1. Problem
      2. 5.14.2. Solution
      3. 5.14.3. How It Works
        1. 5.14.3.1. Validation Error Tooltip
        2. 5.14.3.2. The ValidationSummary Control
      4. 5.14.4. The Code
    15. 5.15. Control Behavior in Expression Blend
      1. 5.15.1. Problem
      2. 5.15.2. Solution
      3. 5.15.3. How It Works
        1. 5.15.3.1. Property Attributes
          1. 5.15.3.1.1. CategoryAttribute
          2. 5.15.3.1.2. DescriptionAttribute
          3. 5.15.3.1.3. EditorBrowsableAttribute
        2. 5.15.3.2. Designer-Unsafe Code
        3. 5.15.3.3. Including Sample Data
      4. 5.15.4. The Code
    16. 5.16. Enhancing the Design Experience with Behaviors and Triggers
      1. 5.16.1. Problem
      2. 5.16.2. Solution
      3. 5.16.3. How It Works
        1. 5.16.3.1. Behavior
        2. 5.16.3.2. Triggers and Actions
      4. 5.16.4. The Code
  11. 6. Browser Integration
    1. 6.1. Host Silverlight on Any Technology
      1. 6.1.1. Problem
      2. 6.1.2. Solution
      3. 6.1.3. How It Works
      4. 6.1.4. The Code
    2. 6.2. Setting Focus for Keyboard Input
      1. 6.2.1. Problem
      2. 6.2.2. Solution
      3. 6.2.3. How It Works
      4. 6.2.4. The Code
    3. 6.3. Implementing a Full-Screen UI
      1. 6.3.1. Problem
      2. 6.3.2. Solution
      3. 6.3.3. How It Works
      4. 6.3.4. The Code
    4. 6.4. Calling a JavaScript Method from Managed Code
      1. 6.4.1. Problem
      2. 6.4.2. Solution
      3. 6.4.3. How It Works
      4. 6.4.4. The Code
    5. 6.5. Calling a Managed Code Method from JavaScript
      1. 6.5.1. Problem
      2. 6.5.2. Solution
      3. 6.5.3. How It Works
      4. 6.5.4. The Code
    6. 6.6. Exchanging Data Among Multiple Plug-ins
      1. 6.6.1. Problem
      2. 6.6.2. Solution
      3. 6.6.3. How It Works
      4. 6.6.4. The Code
    7. 6.7. Layering HTML over the Silverlight Plug-in
      1. 6.7.1. Problem
      2. 6.7.2. Solution
      3. 6.7.3. How It Works
      4. 6.7.4. The Code
    8. 6.8. Hosting HTML in a Silverlight Application
      1. 6.8.1. Problem
      2. 6.8.2. Solution
      3. 6.8.3. How It Works
      4. 6.8.4. The Code
    9. 6.9. Painting a Silverlight Element with HTML
      1. 6.9.1. Problem
      2. 6.9.2. Solution
      3. 6.9.3. How It Works
      4. 6.9.4. The Code
    10. 6.10. Taking Advantage of the Navigation Framework
      1. 6.10.1. Problem
      2. 6.10.2. Solution
      3. 6.10.3. How It Works
      4. 6.10.4. The Code
    11. 6.11. Embedding Silverlight within a Windows Gadget
      1. 6.11.1. Problem
      2. 6.11.2. Solution
      3. 6.11.3. How It Works
      4. 6.11.4. The Code
    12. 6.12. Embedding Silverlight in an Internet Explorer 8 Web Slice
      1. 6.12.1. Problem
      2. 6.12.2. Solution
      3. 6.12.3. How It Works
      4. 6.12.4. The Code
  12. 7. Networking and Web Service Integration
    1. 7.1. A Quick Word about the Samples
    2. 7.2. Consuming a WCF Service
      1. 7.2.1. Problem
      2. 7.2.2. Solution
      3. 7.2.3. How It Works
        1. 7.2.3.1. Invoking a Service Operation
        2. 7.2.3.2. Configuring a WCF Service for Silverlight
      4. 7.2.4. The Code
    3. 7.3. Exchanging XML Messages over HTTP
      1. 7.3.1. Problem
      2. 7.3.2. Solution
      3. 7.3.3. How It Works
        1. 7.3.3.1. Using HttpWebRequest/HttpWebResponse in Silverlight
          1. 7.3.3.1.1. Using GET
          2. 7.3.3.1.2. Using POST
          3. 7.3.3.1.3. Handling Asynchronous Invocation
        2. 7.3.3.2. Configuring WCF to Use Non-SOAP Endpoints
      4. 7.3.4. The Code
    4. 7.4. Using JSON Serialization over HTTP
      1. 7.4.1. Problem
      2. 7.4.2. Solution
      3. 7.4.3. How It Works
        1. 7.4.3.1. JSON
        2. 7.4.3.2. Using the DataContractJsonSerializer Type
        3. 7.4.3.3. Configuring WCF to Use JSON
      4. 7.4.4. The Code
    5. 7.5. Accessing Resources over HTTP
      1. 7.5.1. Problem
      2. 7.5.2. Solution
      3. 7.5.3. How It Works
        1. 7.5.3.1. Downloading/Uploading Resources
        2. 7.5.3.2. Reading/Writing Remote Streams
        3. 7.5.3.3. WebClient and HTTP Endpoints
        4. 7.5.3.4. Canceling Long-Running Operations
      4. 7.5.4. The Code
    6. 7.6. Using Sockets to Communicate over TCP
      1. 7.6.1. Problem
      2. 7.6.2. Solution
      3. 7.6.3. How It Works
        1. 7.6.3.1. The Sockets API in Silverlight
        2. 7.6.3.2. Cross-Domain Policy and Port Requirements
      4. 7.6.4. The Code
        1. 7.6.4.1. Running the Sample Code
        2. 7.6.4.2. The Client
        3. 7.6.4.3. The Chat Server
        4. 7.6.4.4. The Policy Server
    7. 7.7. Enabling Cross-Domain Access
      1. 7.7.1. Problem
      2. 7.7.2. Solution
      3. 7.7.3. How It Works
      4. 7.7.4. The Code
    8. 7.8. Exchanging Data between Silverlight Applications
      1. 7.8.1. Problem
      2. 7.8.2. Solution
      3. 7.8.3. How It Works
        1. 7.8.3.1. Receiver Registration
        2. 7.8.3.2. Receiving Messages
        3. 7.8.3.3. Sending Messages
        4. 7.8.3.4. Request-Response
      4. 7.8.4. The Code
  13. 8. Building Out Of Browser Silverlight Applications
    1. 8.1. Building a Silverlight application to run outside the browser
      1. 8.1.1. Problem
      2. 8.1.2. Solution
      3. 8.1.3. How It Works
        1. 8.1.3.1. Preparing the Application
        2. 8.1.3.2. Installing the Application
        3. 8.1.3.3. Customizing the Installation Flow
        4. 8.1.3.4. Sensing Network Availability
        5. 8.1.3.5. Updating Locally Installed Applications
      4. 8.1.4. The Code
    2. 8.2. Controlling the Application Window
      1. 8.2.1. Problem
      2. 8.2.2. Solution
      3. 8.2.3. How It Works
        1. 8.2.3.1. Window Attributes
        2. 8.2.3.2. Resizing and moving a Window
      4. 8.2.4. The Code
    3. 8.3. Using COM Interoperability and File System Access
      1. 8.3.1. Problem
      2. 8.3.2. Solution
      3. 8.3.3. How It Works
        1. 8.3.3.1. COM Interoperability
        2. 8.3.3.2. Instantiating a COM object
        3. 8.3.3.3. Handling a COM event
        4. 8.3.3.4. File System Access
      4. 8.3.4. The Code
        1. 8.3.4.1. Windows Image Acquisition
        2. 8.3.4.2. The Application Code
        3. 8.3.4.3. Saving Images to the disk
        4. 8.3.4.4. Taskbar Notification
  14. 9. Building LOB Applications
    1. 9.1. Silverlight LOB Enhancements
    2. 9.2. Data Access Enhancements
      1. 9.2.1. WCF Data Services
      2. 9.2.2. WCF RIA Services
    3. 9.3. Accessing RESTful Data using OData
      1. 9.3.1. Problem
      2. 9.3.2. Solution
      3. 9.3.3. How It Works
      4. 9.3.4. The Code
    4. 9.4. Using Visual Studio 2010 WCF Data Services Tooling
      1. 9.4.1. Problem
      2. 9.4.2. Solution
      3. 9.4.3. How It Works
      4. 9.4.4. The Code
    5. 9.5. Implementing CRUD Operations in WCF Data Services
      1. 9.5.1. Problem
      2. 9.5.2. Solution
      3. 9.5.3. How It Works
      4. 9.5.4. The Code
    6. 9.6. Using Visual Studio 2010 WCF RIA Data Services Tooling
      1. 9.6.1. Problem
      2. 9.6.2. Solution
      3. 9.6.3. How It Works
      4. 9.6.4. The Code
    7. 9.7. Taking Advantage of the Business Application Template
      1. 9.7.1. Problem
      2. 9.7.2. Solution
      3. 9.7.3. How It Works
      4. 9.7.4. The Code
    8. 9.8. Databinding in XAML
      1. 9.8.1. Problem
      2. 9.8.2. Solution
      3. 9.8.3. How It Works
      4. 9.8.4. The Code
    9. 9.9. Navigating RIA LOB Data
      1. 9.9.1. Problem
      2. 9.9.2. Solution
      3. 9.9.3. How It Works
      4. 9.9.4. The Code
    10. 9.10. Implementing CRUD Operations in RIA Services
      1. 9.10.1. Problem
      2. 9.10.2. Solution
      3. 9.10.3. How It Works
      4. 9.10.4. The Code
    11. 9.11. Data Validation through Data Annotation
      1. 9.11.1. Problem
      2. 9.11.2. Solution
      3. 9.11.3. How It Works
      4. 9.11.4. The Code
    12. 9.12. Printing in a Silverlight LOB Application
      1. 9.12.1. Problem
      2. 9.12.2. Solution
      3. 9.12.3. How It Works
      4. 9.12.4. The Code
  15. 10. Integrating Rich Media
    1. 10.1. Adding Video to a Page
      1. 10.1.1. Problem
      2. 10.1.2. Solution
      3. 10.1.3. How It Works
        1. 10.1.3.1. Using MediaElement
        2. 10.1.3.2. VideoBrush
      4. 10.1.4. The Code
    2. 10.2. Creating a Complete Video Player
      1. 10.2.1. Problem
      2. 10.2.2. Solution
      3. 10.2.3. How It Works
        1. 10.2.3.1. Acquiring Media
        2. 10.2.3.2. Controlling Media Play
        3. 10.2.3.3. MediaElement States
        4. 10.2.3.4. Seeking Within the Media
        5. 10.2.3.5. Volume
      4. 10.2.4. The Code
        1. 10.2.4.1. Installing the Sample Code
        2. 10.2.4.2. The Player Code
        3. 10.2.4.3. The MediaSlider Custom Control
        4. 10.2.4.4. The MediaButtonsPanel Custom Control
    3. 10.3. Adding Streaming Media Support
      1. 10.3.1. Problem
      2. 10.3.2. Solution
      3. 10.3.3. How It Works
        1. 10.3.3.1. Network Considerations
        2. 10.3.3.2. Windows Media Services
        3. 10.3.3.3. Setting Up WMS 2008
        4. 10.3.3.4. Setting Up Publishing Points
      4. 10.3.4. The Code
        1. 10.3.4.1. Changes to the Player
    4. 10.4. Using Playlists to Package Media
      1. 10.4.1. Problem
      2. 10.4.2. Solution
      3. 10.4.3. How It Works
        1. 10.4.3.1. Server-Side Playlists
        2. 10.4.3.2. Client-Side Playlists
      4. 10.4.4. The Code
    5. 10.5. Using Markers to Display Timed Content
      1. 10.5.1. Problem
      2. 10.5.2. Solution
      3. 10.5.3. How It Works
        1. 10.5.3.1. Encoding Markers Using Expression Encoder 3
        2. 10.5.3.2. MediaElement and Markers
      4. 10.5.4. The Code
    6. 10.6. Displaying and Seeking Using SMPTE Timecodes
      1. 10.6.1. Problem
      2. 10.6.2. Solution
      3. 10.6.3. How It Works
        1. 10.6.3.1. Frame Rate
        2. 10.6.3.2. Timecodes
        3. 10.6.3.3. Timecodes and Silverlight
      4. 10.6.4. The Code
    7. 10.7. Building a Managed Decoder for Silverlight
      1. 10.7.1. Problem
      2. 10.7.2. Solution
      3. 10.7.3. How It Works
        1. 10.7.3.1. Silverlight, Containers, and Codecs
        2. 10.7.3.2. MediaStreamSource
        3. 10.7.3.3. Initializing the Media Stream
        4. 10.7.3.4. Sampling
        5. 10.7.3.5. Stream Switching
        6. 10.7.3.6. Seeking
      4. 10.7.4. The Code
        1. 10.7.4.1. The Recorder
        2. 10.7.4.2. The Custom MediaStreamSource
    8. 10.8. Using a WebCam
      1. 10.8.1. Problem
      2. 10.8.2. Solution
      3. 10.8.3. How It Works
        1. 10.8.3.1. Webcam and Microphone as devices
        2. 10.8.3.2. Video and Audio Format Choices
        3. 10.8.3.3. Starting Device Capture
        4. 10.8.3.4. Capturing a still image
      4. 10.8.4. The Code
    9. 10.9. Processing Raw WebCam Output
      1. 10.9.1. Problem
      2. 10.9.2. Solution
      3. 10.9.3. How It Works
        1. 10.9.3.1. VideoSink and AudioSink
      4. 10.9.4. The Code
  16. 11. Integrating Microsoft IIS Smooth Streaming
    1. 11.1. Setting up Smooth Streaming
      1. 11.1.1. Problem
      2. 11.1.2. Solution
      3. 11.1.3. How It Works
        1. 11.1.3.1. IIS Media Services
        2. 11.1.3.2. Setting Up IIS7
        3. 11.1.3.3. The Silverlight Client/Smooth Streaming Server Data Exchange
        4. 11.1.3.4. Testing the Smooth Streaming Presentation
      4. 11.1.4. The Code
    2. 11.2. Using the SmoothStreamingMediaElement
      1. 11.2.1. Problem
      2. 11.2.2. Solution
      3. 11.2.3. How It Works
        1. 11.2.3.1. The IIS Smooth Streaming Player Development Kit
      4. 11.2.4. The Code
    3. 11.3. Adding Metadata Streams
      1. 11.3.1. Problem
      2. 11.3.2. Solution
      3. 11.3.3. How It Works
        1. 11.3.3.1. Streams and Tracks
      4. 11.3.4. The Code
        1. 11.3.4.1. Injecting the Metadata and Content
        2. 11.3.4.2. Using Metadata at Playback
    4. 11.4. Merging Data from External Manifests
      1. 11.4.1. Problem
      2. 11.4.2. Solution
      3. 11.4.3. How It Works
      4. 11.4.4. The Code
        1. 11.4.4.1. Creating the External Manifests
        2. 11.4.4.2. Merging the Manifests at Runtime
    5. 11.5. Scheduling Additional Clips
      1. 11.5.1. Problem
      2. 11.5.2. Solution
      3. 11.5.3. How It Works
      4. 11.5.4. The Code
    6. 11.6. Varying Playback Speeds
      1. 11.6.1. Problem
      2. 11.6.2. Solution
      3. 11.6.3. How It Works
      4. 11.6.4. The Code
    7. 11.7. Combining Streams Using Composite Manifests
      1. 11.7.1. Problem
      2. 11.7.2. Solution
      3. 11.7.3. How It Works
      4. 11.7.4. The Code