You are previewing Beginning Silverlight 4 in C#.
O'Reilly logo
Beginning Silverlight 4 in C#

Book Description

The growing popularity of Web 2.0 applications is increasing user expectations for high-quality web site design, presentation, and functionality. It is into this climate that Microsoft is releasing Silverlight 4, the third and latest iteration of its cross-browser web presentation technology. Beginning Sliverlight 4 brings you to the cutting-edge of Web 2.0 application design and includes plenty of practical guidance to get you started straightaway.

Silverlight design tools have important differences compared to those used to create Ajax and JavaScript functionality. Robert Lair takes you on a tour of all the tools, including:

  • Microsoft Expression Design, which plays an important part in creating Silverlight assets.

  • Microsoft Expression Blend, which is used to build user interaction for Silverlight elements.

  • Microsoft Visual Studio, which manages the interaction between designers and developers, providing the coding environment for "nuts and bolts" wiring.

Once you've mastered the basics, you'll move on to gaining a more in-depth knowledge of some of the new features introduced with Silverlight 4, including H.264 protected content, right-click event handling, a new printing API, and support for the Managed Extensibility Framework.

Table of Contents

  1. Copyright
  2. About the Author
  3. About the Technical Reviewer
  4. Acknowledgments
  5. Introduction
    1. Who Should Read This Book
    2. How This Book Is Organized
  6. 1. Welcome to Silverlight 4
    1. 1.1. The Evolution of the User Interface
    2. 1.2. Rich Internet Application Solutions
    3. 1.3. What Is Silverlight?
    4. 1.4. Benefits of Silverlight
      1. 1.4.1. Cross-Platform/Cross-Browser Support
      2. 1.4.2. Cross-Platform Version of the .NET Framework
      3. 1.4.3. Use of Familiar Technologies
      4. 1.4.4. Small Runtime and Simple Deployment
    5. 1.5. The Silverlight Development Environment
    6. 1.6. New Features in Silverlight 4
      1. 1.6.1. Improved Performance
    7. 1.7. Summary
  7. 2. Introduction to Visual Studio 2010
    1. 2.1. What Is Visual Studio?
    2. 2.2. What's New in Visual Studio 2010?
      1. 2.2.1. Support for Multiple Monitors
      2. 2.2.2. Zoom Support for Source Editor
        1. 2.2.2.1. Improved IntelliSense
        2. 2.2.2.2. Add References Performance
        3. 2.2.2.3. Reference Highlighting
        4. 2.2.2.4. Box Selection
        5. 2.2.2.5. Call Hierarchy Window
        6. 2.2.2.6. Code Generation
      3. 2.2.3. Extension Manager
    3. 2.3. Building Your First Silverlight Application in Visual Studio
      1. 2.3.1. Try It Out: Hello World in Silverlight 4
      2. 2.3.2. Hosting Your Silverlight Application: Web Site or Web Application?
        1. 2.3.2.1. Using a Visual Studio Web Site
        2. 2.3.2.2. Using a Visual Studio Web Application Project
    4. 2.4. Summary
  8. 3. Layout Management in Silverlight
    1. 3.1. Layout Management
    2. 3.2. The Canvas Panel
      1. 3.2.1. Try It Out: Using the Canvas Panel
      2. 3.2.2. Filling the Entire Browser Window with Your Application
    3. 3.3. The StackPanel Control
      1. 3.3.1. Try It Out: Using the StackPanel Control
      2. 3.3.2. Try It Out: Nesting StackPanel Controls
    4. 3.4. The Grid Control
      1. 3.4.1. Try It Out: Using the Grid Control
      2. 3.4.2. Try It Out: Nesting a Grid and Spanning a Column
    5. 3.5. The WrapPanel Control
      1. 3.5.1. Try It Out: Using the WrapPanel Control
    6. 3.6. The DockPanel Control
      1. 3.6.1. Try It Out: Using the DockPanel Control
    7. 3.7. Summary
  9. 4. Silverlight Controls
    1. 4.1. Setting Control Properties
      1. 4.1.1. Attribute Syntax
      2. 4.1.2. Element Syntax
      3. 4.1.3. Type-Converter-Enabled Attributes
      4. 4.1.4. Attached Properties
    2. 4.2. Nesting Controls Within Controls
    3. 4.3. Handling Events in Silverlight
      1. 4.3.1. Try It Out: Declaring an Event in XAML
      2. 4.3.2. Try It Out: Declaring an Event Handler in Managed Code
    4. 4.4. The Border Control
    5. 4.5. User Input Controls
      1. 4.5.1. Try It Out: Working with the TextBox Control
      2. 4.5.2. Try It Out: Working with the RadioButton and CheckBox Controls
    6. 4.6. Extended Controls
      1. 4.6.1. Adding an Extended Control
      2. 4.6.2. Try It Out: Using the GridSplitter
    7. 4.7. Summary
  10. 5. Data Binding and Silverlight List Controls
    1. 5.1. Data Binding
      1. 5.1.1. The Binding Class
      2. 5.1.2. Try It Out: Simple Data Binding in Silverlight
    2. 5.2. Element to Element Binding
      1. 5.2.1. Try It Out: Element to Element Binding
    3. 5.3. The DataGrid Control
      1. 5.3.1. Try It Out: Building a Simple DataGrid
      2. 5.3.2. The Columns Collection
        1. 5.3.2.1. DataGridTextColumn
        2. 5.3.2.2. DataGridCheckBoxColumn
        3. 5.3.2.3. DataGridTemplateColumn
      3. 5.3.3. Try It Out: Building a DataGrid with Custom Columns
    4. 5.4. The ListBox Control
      1. 5.4.1. Default and Custom ListBox Items
      2. 5.4.2. Try It Out: Building a ListBox with Custom Content
    5. 5.5. New Data Binding Features in Silverlight 4
      1. 5.5.1. Data Binding and String Formatting
      2. 5.5.2. TargetNullValue and FallBackValue Extensions
    6. 5.6. Summary
  11. 6. Silverlight Toolkit
    1. 6.1. Overview of the Silverlight Toolkit
      1. 6.1.1.
        1. 6.1.1.1. Mature/SDK Quality Band
        2. 6.1.1.2. Stable
        3. 6.1.1.3. Preview
        4. 6.1.1.4. Experimental
      2. 6.1.2. Installing the Toolkit
    2. 6.2. Toolkit Controls
      1. 6.2.1. Accordion
      2. 6.2.2. Try It Out: Working with the Accordion Control
    3. 6.3. AutoCompleteBox
      1. 6.3.1. TabControl
    4. 6.4. ViewBox
    5. 6.5. Modal Windows
      1. 6.5.1. Try It Out: Using the Modal Child Window
    6. 6.6. Summary
  12. 7. Data Access and Networking
    1. 7.1. Data Access in Silverlight Applications
    2. 7.2. Accessing Data Through Web Services
      1. 7.2.1. Try It Out: Accessing Data Through a WCF Service
    3. 7.3. Accessing Services from Other Domains
    4. 7.4. Accessing Data Through Sockets
    5. 7.5. Summary
  13. 8. Navigation Framework
    1. 8.1. Frame and Page Object
      1. 8.1.1. Try It Out: Creating a Silverlight Navigation Application
    2. 8.2. Benefits of the Navigation Framework
      1. 8.2.1. Deep Linking
    3. 8.3. The NavigationService Object
      1. 8.3.1. Try it Out: Using the NavigationService Object
    4. 8.4. Passing Data to Navigation Pages
      1. 8.4.1. Try it Out: Passing Data to Navigation Pages
    5. 8.5. Uri Mapping
      1. 8.5.1. Try it Out: Uri Mapping and the Navigation Framework
    6. 8.6. Silverlight Navigation Application Template
      1. 8.6.1. Try it Out: Using the Silverlight Navigation Application Template
    7. 8.7. Using Multiple Frames
      1. 8.7.1. Try it Out: Using Multiple Frames
    8. 8.8. Summary
  14. 9. Isolated Storage in Silverlight
    1. 9.1. Working with Isolated Storage
      1. 9.1.1. Using the Isolated Storage API
        1. 9.1.1.1. IsolatedStorageFile
        2. 9.1.1.2. IsolatedStorageFileStream
        3. 9.1.1.3. IsolatedStorageSettings
      2. 9.1.2. Try It Out: Creating a File Explorer for Isolated Storage
        1. 9.1.2.1. Creating the Application Layout
        2. 9.1.2.2. Coding the File Explorer
        3. 9.1.2.3. Testing the File Explorer
    2. 9.2. Managing Isolated Storage
      1. 9.2.1. Viewing and Clearing Isolated Storage
      2. 9.2.2. Try It Out: Increasing the Isolated Storage Quota
    3. 9.3. Summary
  15. 10. System Integration and Device Support
    1. 10.1. Notification (Toast) API
      1. 10.1.1. Try It Out: Implementing Toast Notifications.
    2. 10.2. Webcam/Microphone Access
      1. 10.2.1.
        1. 10.2.1.1. CaptureDeviceConfiguration Class
        2. 10.2.1.2. CaptureSource Class
      2. 10.2.2. Try It Out: Accessing a User's Web Camera and Microphone
    3. 10.3. Working with Captured Streams
    4. 10.4. COM Interoperability
      1. 10.4.1. Try It Out: Executing an EXE
    5. 10.5. Dropping Files on a Silverlight Application
      1. 10.5.1. Drop Event
      2. 10.5.2. Try It Out: Enabling an Application As a Drop Target
    6. 10.6. Summary
  16. 11. Introduction to Expression Blend
    1. 11.1. Key Features in Expression Blend
      1. 11.1.1. Visual XAML Editor
      2. 11.1.2. Visual Studio 2010 Integration
      3. 11.1.3. Split-View Mode
      4. 11.1.4. Visual State Manager and Template Editing Support
      5. 11.1.5. World-Class Timeline
      6. 11.1.6. Try It Out: Working with Projects in Expression Blend
    2. 11.2. Exploring the Workspace
      1. 11.2.1. Toolbox
      2. 11.2.2. Project Panel
      3. 11.2.3. Properties Panel
      4. 11.2.4. Objects and Timeline Panel
    3. 11.3. Laying Out an Application with Expression Blend
      1. 11.3.1. Working with the Grid Control in Expression Blend
      2. 11.3.2. Try It Out: Editing a Layout Grid with Expression Blend
    4. 11.4. Summary
  17. 12. Styling in Silverlight
    1. 12.1. Inline Properties
      1. 12.1.1. Try It Out: Setting Inline Properties with Visual Studio
      2. 12.1.2. Try It Out: Setting Inline Properties with Expression Blend
    2. 12.2. Silverlight Styles
      1. 12.2.1. Try It Out: Using Styles As Static Resources
      2. 12.2.2. Defining Styles at the Application Level
      3. 12.2.3. Merged Resource Dictionaries
      4. 12.2.4. Silverlight Style Hierarchy
      5. 12.2.5. Inheriting Styles Using BasedOn
      6. 12.2.6. Implicit Styles
    3. 12.3. Summary
  18. 13. Transformations and Animation
    1. 13.1. Introduction to Silverlight Animation
      1. 13.1.1. Silverlight Storyboards
      2. 13.1.2. Types of Animations in Silverlight
    2. 13.2. Programmatically Controlling Animations
    3. 13.3. Using Expression Blend to Create Animations
      1. 13.3.1. Viewing a Storyboard in the Expression Blend Timeline
      2. 13.3.2. Try It Out: Creating an Animation with Expression Blend
    4. 13.4. Creating Transformations in Silverlight
      1. 13.4.1. Transformation Types
        1. 13.4.1.1. ScaleTransform
        2. 13.4.1.2. SkewTransform
        3. 13.4.1.3. RotateTransform
        4. 13.4.1.4. TranslateTransform
      2. 13.4.2. Try It Out: Using Expression Blend to Transform Silverlight Objects
    5. 13.5. Summary
  19. 14. Custom Controls
    1. 14.1. When to Write Custom Controls
    2. 14.2. Silverlight Control Model
      1. 14.2.1. Parts and States Model
      2. 14.2.2. Dependency Properties
    3. 14.3. Creating Custom Controls in Silverlight
      1. 14.3.1. Implementing Custom Functionality
      2. 14.3.2. Try It Out: Building a Custom Control
        1. 14.3.2.1. Setting Up the Control Project
        2. 14.3.2.2. Defining Properties and States
        3. 14.3.2.3. Defining the Control's Appearance
        4. 14.3.2.4. Handling Control Events
        5. 14.3.2.5. Compiling and Testing the Control
    4. 14.4. Summary
  20. 15. Printing in Silverlight
    1. 15.1. The Printing API
      1. 15.1.1.
        1. 15.1.1.1. PrintDocument Events
        2. 15.1.1.2. Determining Print Content
      2. 15.1.2. Try It Out: Implementing Simple Printing
    2. 15.2. Printing Custom Content
      1. 15.2.1. Try It Out: Implementing a Custom Print
    3. 15.3. Additional Printing Customization
      1. 15.3.1. Try It Out: Handling the BeginPrint and EndPrint Events
    4. 15.4. Summary
  21. 16. Deployment
    1. 16.1. Deploying Silverlight Applications
      1. 16.1.1. XAP Files
      2. 16.1.2. Hosting Silverlight Content
    2. 16.2. Application Library Caching
      1. 16.2.1. Try It Out: Exploring Assembly Caching
    3. 16.3. Full Screen Pinning
    4. 16.4. Out of Browser Support
      1. 16.4.1. Customizing the Install Application Dialog
      2. 16.4.2. Out of Browser API
      3. 16.4.3. Removing Installed Applications
    5. 16.5. Elevated Trust Applications
    6. 16.6. Summary