Silverlight 2 Recipes: A Problem-Solution Approach

Book description

Microsoft .NET architect evangelist Jit Ghosh presents a practical companion guide to developing rich, interactive web applications with Silverlight 2. Common problems, issues, and every-day scenarios are tackled with a detailed discussion of the solution and ready-made code recipes that will save you hours of coding time.

The recipes included in Silverlight 2 Recipes: A Problem-Solution Approach have been carefully selected and tested with the professional developer in mind. You'll find clearly and succinctly stated problems, well-architected solutions, and ample discussion of the code and context so you can see immediately how the solution will support your project.

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 Plugin 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 2 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 2 coverage, and time-saving expert advice, all in Silverlight 2 Recipes: A Problem-Solution Approach.

Table of contents

  1. Copyright
  2. Foreword
  3. About the Authors
  4. About the Technical Reviewer
  5. Acknowledgments
  6. Introduction
    1. Who This Book Is For
    2. How This Book Is Structured
    3. Prerequisites
    4. Downloading The Code
    5. Contacting the Authors
  7. 1. A Quick Tour of Silverlight 2 Development: The Mechanics of Silverlight
    1. 1.1. Setting Up the Silverlight 2 Environment
      1. 1.1.1. Problem
      2. 1.1.2. Solution
      3. 1.1.3. How It Works
    2. 1.2. Integrating the Silverlight 2 SDK Documentation
      1. 1.2.1. Problem
      2. 1.2.2. Solution
      3. 1.2.3. How It Works
    3. 1.3. Understanding the Structure of a Silverlight Solution
      1. 1.3.1. Problem
      2. 1.3.2. Solution
      3. 1.3.3. How It Works
      4. 1.3.4. The Code
    4. 1.4. Understanding the Developer/Designer Workflow
      1. 1.4.1. Problem
      2. 1.4.2. Solution
      3. 1.4.3. How It Works
    5. 1.5. Understanding the Basics of Expression Blend 2 SP1
      1. 1.5.1. Problem
      2. 1.5.2. Solution
      3. 1.5.3. How It Works
      4. 1.5.4. The Code
    6. 1.6. Accessing Source Control
      1. 1.6.1. Problem
      2. 1.6.2. Solution
      3. 1.6.3. How It Works
    7. 1.7. Running Silverlight 2 on a Mac
      1. 1.7.1. Problem
      2. 1.7.2. Solution
      3. 1.7.3. How It Works
    8. 1.8. Running Silverlight 2 on Linux
      1. 1.8.1. Problem
      2. 1.8.2. Solution
      3. 1.8.3. How It Works
  8. 2. Application Design and Programming Model: The Mechanics of Silverlight Applications
    1. 2.1. Adding a Custom Class
      1. 2.1.1. Problem
      2. 2.1.2. Solution
      3. 2.1.3. How It Works
      4. 2.1.4. The Code
    2. 2.2. Adding a Custom Control
      1. 2.2.1. Problem
      2. 2.2.2. Solution
      3. 2.2.3. How It Works
      4. 2.2.4. The Code
    3. 2.3. Using the FindName Method
      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. Dynamically Loading XAML from JavaScript
      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. Dynamically Loading XAML from Managed Code
      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. Persisting Data on the Client
      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. Opening a Local File from a Silverlight Application
      1. 2.7.1. Problem
      2. 2.7.2. Solution
      3. 2.7.3. How It Works
      4. 2.7.4. The Code
    8. 2.8. Accessing XML Data with an XmlReader
      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. Accessing XML Data with LINQ
      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 Unhandled Exceptions
      1. 2.10.1. Problem
      2. 2.10.2. Solution
      3. 2.10.3. How It Works
    11. 2.11. Executing Work on a Background Thread with Updates
      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. Updating the UI from a Background Thread
      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. Managing XAML Resources
      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 Embedded Resources
      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. Creating Silverlight Ruby, Python, or JScript
      1. 2.15.1. Problem
      2. 2.15.2. Solution
      3. 2.15.3. How It Works
      4. 2.15.4. The Code
  9. 3. Developing User Experiencest
    1. 3.1. Importing 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
      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 with a Canvas
      1. 3.3.1. Problem
      2. 3.3.2. Solution
      3. 3.3.3. How It Works
      4. 3.3.4. The Code
    4. 3.4. Positioning UI Elements with a StackPanel
      1. 3.4.1. Problem
      2. 3.4.2. Solution
      3. 3.4.3. How It Works
      4. 3.4.4. The Code
    5. 3.5. Positioning UI Elements with a Grid
      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. Using Shapes to Draw
      1. 3.6.1. Problem
      2. 3.6.2. Solution
      3. 3.6.3. How It Works
    7. 3.7. Using Paths to Draw
      1. 3.7.1. Problem
      2. 3.7.2. Solution
      3. 3.7.3. How It Works
      4. 3.7.4. The Code
      5. 3.7.5. The Code
    8. 3.8. Using Geometries to Draw
      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. Providing Scrollable Content
      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. Applying a Border to Elements
      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. Using Simple Animations with Objects
      1. 3.11.1. Problem
      2. 3.11.2. Solution
      3. 3.11.3. How It Works
      4. 3.11.4. The Code
    12. 3.12. Animating UI Elements with Keyframes
      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. Transforming an Object
      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. Creating a Simple Cartoon Scene
      1. 3.14.1. Problem
      2. 3.14.2. Solution
      3. 3.14.3. How It Works
      4. 3.14.4. The Code
      5. 3.14.5. The Code
    15. 3.15. Handling Keyboard Input
      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. Working with Ink
      1. 3.16.1. Problem
      2. 3.16.2. Solution
      3. 3.16.3. How It Works
      4. 3.16.4. The Code
  10. 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
      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
      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
      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
      4. 4.4.4. The Code
    5. 4.5. Validating Input for Bound Data
      1. 4.5.1. Problem
      2. 4.5.2. Solution
      3. 4.5.3. How It Works
      4. 4.5.4. The Code
  11. 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
      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
      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
      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
      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
      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
      4. 5.10.4. The Code
    11. 5.11. Creating a Custom Control
      1. 5.11.1. Problem
      2. 5.11.2. Solution
      3. 5.11.3. How It Works
      4. 5.11.4. The Code
    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
  12. 6. Browser Integration
    1. 6.1. Hosting Silverlight in HTML on Any Platform
      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. Hosting Silverlight in ASP.NET
      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. Setting Focus for Keyboard Input
      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. Implementing a Full-Screen UI
      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 JavaScript Method from Managed Code
      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. Calling a Managed Code Method from JavaScript
      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. Exchanging Data between Multiple Plug-ins
      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. Embedding Silverlight within a Vista Gadget
      1. 6.8.1. Problem
      2. 6.8.2. Solution
      3. 6.8.3. How It Works
      4. 6.8.4. The Code
  13. 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
      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
      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
      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
      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
      4. 7.6.4. The Code
    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
  14. 8. Integrating Rich Media
    1. 8.1. Adding Video to a Page
      1. 8.1.1. Problem
      2. 8.1.2. Solution
      3. 8.1.3. How It Works
      4. 8.1.4. The Code
    2. 8.2. Creating a Complete Video Player
      1. 8.2.1. Problem
      2. 8.2.2. Solution
      3. 8.2.3. How It Works
      4. 8.2.4. The Code
    3. 8.3. Adding Streaming Media Support
      1. 8.3.1. Problem
      2. 8.3.2. Solution
      3. 8.3.3. How It Works
      4. 8.3.4. The Code
    4. 8.4. Using Playlists to Package Media
      1. 8.4.1. Problem
      2. 8.4.2. Solution
      3. 8.4.3. How It Works
      4. 8.4.4. The Code
    5. 8.5. Using Markers to Display Timed Content
      1. 8.5.1. Problem
      2. 8.5.2. Solution
      3. 8.5.3. How It Works
      4. 8.5.4. The Code

Product information

  • Title: Silverlight 2 Recipes: A Problem-Solution Approach
  • Author(s):
  • Release date: December 2008
  • Publisher(s): Apress
  • ISBN: 9781590599778