You are previewing Introducing Microsoft® Silverlight™ 2, Second Edition, Second Edition.
O'Reilly logo
Introducing Microsoft® Silverlight™ 2, Second Edition, Second Edition

Book Description

Get a jump on the next release of Silverlight with early insights from a Technical Evangelist on the Microsoft Silverlight team. This guide describes how you can simplify the development and deployment of rich interactive applications (RIAs) by using Silverlight 2 tools with Microsoft Visual Studio® 2008 and the Microsoft .NET Framework. RIAs are Web applications with the features and functionality of full desktop applications. Processing tasks are performed on the client, but data is stored on the server. With Silverlight, RIAs install quickly via a small, on-demand plug-in. This book demonstrates how you can easily use existing skills and tools to deliver next-generation user interfaces and media experiences. You ll discover how to begin building different types of Silverlight-based solutions, generate Silverlight applications dynamically on the server, create an XAML service, and more. The book also features a companion Web site with code samples in Microsoft Visual C#® and Visual Basic®.

Key Book Benefits:

 Delivers practical, grounded advice from a member of the Silverlight team, including an insider s view of the evolution of this Web presentation technology  Describes how Silverlight 2 will simplify development and deployment of RIAs with the .NET Framework and Visual Studio 2008  Provides context about the relationships among Silverlight and the various .NET Framework 3.0 and 3.5 technologies  Places RIAs in context for both Web and Windows-based developers  Features a companion Web site with code samples in Visual C# and Visual Basic

Table of Contents

  1. Introducing Microsoft® Silverlight™ 2, Second Edition
  2. Dedication
  3. A Note Regarding Supplemental Files
  4. Acknowledgments
  5. Introduction
    1. Why Silverlight?
    2. Who This Book Is For
    3. What This Book Is About
    4. System Requirements
    5. The Companion Web Site
    6. Support for This Book
    7. Questions and Comments
    8. About the Author
  6. I. Introducing Silverlight 2
    1. 1. Introducing Silverlight 2
      1. Silverlight and User Experience
      2. Silverlight Architecture
      3. Silverlight and XAML
      4. Silverlight and the Expression Suite
        1. Silverlight and Expression Design
        2. Silverlight and Expression Blend
          1. Exploring the Silverlight 1 Site Project
          2. The Default Web Page
      5. Silverlight and Expression Encoder
      6. Summary
    2. 2. Using Expression Blend with Silverlight 2
      1. Getting Started with Expression Blend
        1. Creating a Silverlight 2 Application
          1. The Default Page
          2. The Default App.xaml and Code-Behind Files
          3. Executing the Application
      2. The Expression Blend IDE
        1. The Tools Pane
        2. The Interaction Pane
        3. The Design Surface
        4. The Project Pane
        5. The Properties Pane
      3. Using Blend to Build Silverlight Applications
        1. Layout
          1. Using a Grid
          2. Using Canvas
          3. Using StackPanel
          4. Using the ScrollViewer
          5. The Border Control
        2. Placing and Customizing Visual Elements
        3. Placing and Customizing Controls
        4. Using Blend to Design Animations
      4. Summary
    3. 3. Using Visual Studio with Silverlight 2
      1. Installing the Visual Studio Tools for Silverlight
      2. Using Visual Studio to Build a Silverlight Application
        1. Creating a Silverlight Application in Visual Studio 2008
        2. The Silverlight Control Project
          1. Understanding the Silverlight Project Properties
          2. The Properties Files
          3. References
          4. The App.xaml and App.xaml.cs Files
          5. The Page.xaml and Page.xaml.cs Files
        3. The Web Project
      3. Building a Silverlight 2 Game
        1. Creating the UI in XAML
        2. Writing the Game Code
          1. Initializing the Data Structures
          2. Creating the Puzzle Pieces
          3. Shuffling the Pieces
          4. Drawing the Board
          5. Handling User Control
          6. Checking Winning Condition
      4. Summary
    4. 4. XAML Basics
      1. XAML Layout Properties
      2. XAML Brushes
        1. SolidColorBrush
        2. LinearGradientBrush
          1. Changing the Gradient Direction
          2. Adding Gradient Stops
        3. RadialGradientBrush
          1. Setting the Focal Point
          2. Changing the SpreadMethod
          3. Setting the Radius of the RadialGradientBrush
        4. Using ImageBrush
          1. Stretching the Image
          2. Aligning the Image
        5. VideoBrush
      3. XAML Visual Properties
        1. Using XAML Dimension and Position Properties
        2. Using Opacity
        3. Cursor Behavior
        4. Controlling Stroke
          1. Setting Stroke Width
          2. Setting Stroke Dash
          3. Controlling Line Joins
      4. Shapes in XAML
        1. Using the Ellipse Object
        2. Using the Rectangle Object
        3. Using the Line Object
        4. Using Paths and Geometries
          1. The ArcSegment Object
          2. The LineSegment Object
          3. The PolyLineSegment Object
          4. The BezierSegment Object
          5. The PolyBezierSegment Object
          6. The QuadraticBezierSegment Object
          7. The PolyQuadraticBezierSegment Object
          8. Compound Path Segments
        5. Using the GeometryGroup Object
        6. The Path Language
      5. Clipping and Geometries in XAML
      6. XAML Controls in Silverlight
        1. The Canvas Element
        2. The Image Element
        3. The Glyphs Element
        4. The TextBlock Element
          1. Runs and Line Breaks
      7. Summary
    5. 5. XAML Transformation and Animation
      1. Transformations
        1. Rotating with the RotateTransform Property
        2. Scaling with the ScaleTransform Property
        3. Moving an Object with the TranslateTransform Property
        4. Skewing an Object with the SkewTransform Property
        5. Simulating 3D Perspective with SkewTransform
        6. Defining Your Own Transforms with MatrixTransform
        7. Combining Transformations
      2. Animation
        1. Using Triggers and Event Triggers
        2. Using BeginStoryboard and Storyboard
        3. Defining the Animation Parameters
          1. Targeting the Animation
          2. Setting the Duration
          3. Setting the Begin Time
          4. Using the SpeedRatio Property
          5. Using the AutoReverse Property
          6. Setting the RepeatBehavior Property
          7. Animating a Value with DoubleAnimation
          8. Animating a Color with ColorAnimation
          9. Animating a Point with PointAnimation
        4. Using Key Frames
          1. Using Linear Key Frames
          2. Using Discrete Key Frames
          3. Using Spline Key Frames
      3. Animation and Expression Blend
      4. Summary
    6. 6. The Silverlight Browser Control
      1. Hosting Silverlight in the Browser
      2. Using the Object Tag Directly
      3. Responding to Page Load Events
        1. Handling Parameters
        2. User Context
      4. Responding to Page Error Events
        1. The Default Event Handler
        2. Using Your Own Error Handler
        3. Silverlight Control Properties
          1. Direct Properties
          2. Content Properties
          3. Settings Properties
        4. Silverlight Control Methods
          1. The createFromXaml Method
          2. The createFromXamlDownloader Method
          3. The createObject Method
          4. The findName Method
        5. The Downloader Object
          1. Downloader Object Properties
          2. Downloader Object Methods
          3. Downloader Object Events
          4. Using the Downloader Object
      5. Programming UI Elements
        1. UI Element Methods
          1. The AddEventListener and RemoveEventListener Methods
          2. The findName Method
          3. Accessing the Control with the GetHost Method
          4. Accessing a Parent Element with the getParent Method
          5. Using the GetValue and SetValue Methods
          6. Using SetFontSource
        2. UI Element Events
        3. Implementing Drag and Drop
      6. Summary
  7. II. Programming Silverlight 2
    1. 7. Silverlight Controls: Presentation and Layout
      1. The Button Control
      2. The CheckBox Control
      3. The HyperlinkButton Control
      4. The Image Control
      5. The ListBox Control
      6. The RadioButton Control
      7. The TextBlock Control
      8. The TextBox Control
      9. Common Properties, Events, and Methods
        1. Handling Focus
        2. Handling the Mouse
          1. Using the Mouse Events for Drag and Drop
        3. Using the Keyboard
      10. Summary
    2. 8. Silverlight Controls: Advanced Controls
      1. The DataGrid Control
      2. The Calendar and DatePicker Controls
      3. The RepeatButton and ToggleButton Controls
      4. The ScrollViewer Control
      5. The Slider Control
      6. The WatermarkedTextBox Control
      7. Summary
    3. 9. Building Your Own Silverlight Control
      1. Creating the Project
        1. Adding the Control Template
        2. Writing the Control Code
      2. Building Silverlight Class Libraries
      3. Summary
    4. 10. Building Connected Applications with Silverlight
      1. Connecting Applications with XAML
        1. Silverlight and PHP
          1. Your First PHP Page
          2. PHP and XAML Case Study
            1. Building the Server-Side Database
            2. Building an XAML Template
            3. Generating XAML from PHP and MySQL
            4. Building a PHP Page to Deliver Silverlight
        2. Silverlight and Java
          1. Building an XAML Source Servlet
          2. Delivering Silverlight from JSP
      2. Building Connectivity Using JavaScript
        1. Using AJAX
          1. Building the Time Server
          2. Building the Time Client
      3. Using ASP.NET AJAX and Web Services
        1. Connectivity and Data in .NET
          1. The WebClient Class
          2. The WebRequest Class
        2. Using SyndicatedFeed to Access RSS and ATOM
        3. Silverlight and WCF
      4. Summary
    5. 11. Media, Ink, and Deep Zoom
      1. The MediaElement Control
        1. Video
        2. Audio
        3. Using the MediaElement Control
          1. Simple Video Playback with the MediaElement Control
        4. Controlling the Size of the MediaElement Control
        5. Controlling How the Media Is Stretched
        6. Controlling Video Opacity
        7. Using Transformations with the MediaElement Control
        8. Writing Content on Video
        9. Clipping Media with Geometries
        10. Determining Automatic Playback Behavior
        11. Controlling Audio
      2. Programming the MediaElement
        1. Providing Basic Video Controls
        2. Managing Buffering and Download
        3. Managing Current Video State
        4. Managing Playback Position
        5. Using Media Timeline Markers
      3. Painting Video Using the VideoBrush
      4. The InkPresenter Control
        1. An Example of Ink Annotation in Silverlight
        2. Silverlight Ink Classes for JavaScript Programmers
          1. The StrokeCollection Type
            1. StrokeCollection Properties
            2. StrokeCollection Methods
          2. The Stroke Type
            1. Stroke Properties
            2. Stroke Methods
          3. The StylusPointCollection Type
            1. StylusPointCollection Properties
            2. StylusPointCollection Methods
          4. The StylusPoint Type
            1. StylusPoint Properties
          5. Mouse Event Arguments and Ink
            1. MouseEventArgs Properties
            2. MouseEventArgs Methods
        3. Programming for Ink in Silverlight
      5. Deep Zoom with the MultiScaleImage Control
        1. Using the Deep Zoom Composer
        2. Building Your First Deep Zoom Project
        3. Using the Mouse and Logical Coordinates in Deep Zoom
        4. Creating the Zoom Functionality with the Mouse Wheel
        5. Collections in Deep Zoom
      6. Summary
    6. 12. Styles and Templates in Silverlight 2
      1. Understanding Styling
        1. Creating a Style
        2. Changing the Style Scope
      2. Templates
      3. Summary
    7. 13. Silverlight ASP.NET Controls
      1. The Silverlight Server Control
        1. Using the Frame Rate Counter
        2. Setting the Maximum Frame Rate
        3. Enabling Access to HTML
        4. Using Redraw Regions
        5. Setting the PluginBackground Property
        6. Managing Plug-in Installation
        7. Using Stretch Mode
        8. Using Windowless Mode
        9. Silverlight Server Control Events
      2. The Silverlight MediaPlayer ASP.NET Control
        1. MediaPlayer Tasks
        2. Interacting with Media
      3. Summary
    8. 14. Using Dynamic Languages in Silverlight 2
      1. Your First Silverlight IronPython Application
      2. Using Ruby and JavaScript
        1. Using Ruby
        2. Using Dynamic JavaScript
      3. A More Complex Example
      4. Summary
  8. Index
  9. About the Author
  10. Copyright