You are previewing Professional Silverlight® 4.
O'Reilly logo
Professional Silverlight® 4

Book Description

Everything .NET developers need to take advantage of Silverlight 4

Silverlight 4 is a major new release of Microsoft's flagship product for building rich, interactive applications that combine animation, graphics, audio, and video. This book, by seasoned Wrox authors and Silverlight experts, gives professional Web developers all the tools necessary to build RIAs using the new Silverlight capabilities. You will gain a complete, thorough understanding of both core and advanced platform concepts, with examples in C#.

Professional Silverlight 4 prepares Web developers to take full advantage of the newest release of the most popular platform for developing rich interactive applications.

Coverage Includes:

  • Introduction to Silverlight

  • Building Applications with Visual Studio

  • Building Applications with Expression Blend 4

  • Working with the Navigation Framework

  • Controlling Layout with Panels

  • Working with Visual Controls

  • Accessing Data

  • WCF RIA Services

  • Out-of-Browser Experiences

  • Networking Applications

  • Building Line of Business Applications

  • Application Architecture

  • DOM Interaction

  • Securing Your Applications

  • Accessing Audio and Video Devices

  • Working with File I/O

  • Using Graphics and Visuals

  • Working with Animations in Silverlight

  • Working with Text

  • Making It Richer with Media

  • Styling and Themes

Table of Contents

  1. Copyright
  2. ABOUT THE AUTHORS
  3. ABOUT THE CONTRIBUTORS
  4. ABOUT THE TECHNICAL EDITORS
  5. CREDITS
  6. ACKNOWLEDGMENTS
  7. INTRODUCTION
    1. WHO THIS BOOK IS FOR
    2. WHAT THIS BOOK COVERS
    3. WHAT YOU NEED TO USE THIS BOOK
    4. CONVENTIONS
    5. SOURCE CODE
    6. ERRATA
    7. P2P.WROX.COM
  8. 1. Introduction to Silverlight
    1. 1.1. WHAT IS SILVERLIGHT?
    2. 1.2. SILVERLIGHT VERSIONS EXPLAINED
    3. 1.3. APPLICATION DEVELOPMENT SCENARIOS
    4. 1.4. GETTING THE SILVERLIGHT PLUG-IN
    5. 1.5. GETTING THE SILVERLIGHT SDK
    6. 1.6. BUILDING SILVERLIGHT APPLICATIONS
    7. 1.7. SILVERLIGHT 4 TOUR
      1. 1.7.1. XAML
      2. 1.7.2. .NET Framework Support
      3. 1.7.3. Graphics and Animations
      4. 1.7.4. Page Layout and Design
      5. 1.7.5. User Interface Controls
      6. 1.7.6. Using Media in Silverlight
        1. 1.7.6.1. Adding Video to Web Pages
        2. 1.7.6.2. Supported Audio and Video Formats
      7. 1.7.7. Local Data Storage
      8. 1.7.8. Out-of-Browser Experiences
      9. 1.7.9. Local Filesystem Access
      10. 1.7.10. Navigation Framework
      11. 1.7.11. Annotation and Ink
      12. 1.7.12. Accessing the Network
      13. 1.7.13. Data Binding
      14. 1.7.14. Printing
      15. 1.7.15. Drag-and-Drop
      16. 1.7.16. Clipboard Access
      17. 1.7.17. Deep Zoom Graphics
    8. 1.8. SUMMARY
  9. 2. Building Applications with Visual Studio
    1. 2.1. CREATING A BASIC SILVERLIGHT APPLICATION
      1. 2.1.1. Using Silverlight Designer for Visual Studio
        1. 2.1.1.1. Using the Properties Pane
      2. 2.1.2. Creating Silverlight Project and Web Application Project Files
      3. 2.1.3. Using the Silverlight Design Surface
      4. 2.1.4. Understanding the XAP File
      5. 2.1.5. Caching Assemblies
      6. 2.1.6. Adding Class Definition and Partial Classes
        1. 2.1.6.1. Adding Events to a Partial Class
    2. 2.2. UNDERSTANDING THE APPLICATION LIFE CYCLE
    3. 2.3. DEBUGGING SILVERLIGHT APPLICATIONS
      1. 2.3.1. Attaching to a Process to Debug
      2. 2.3.2. Attaching to a Remote Macintosh Process
    4. 2.4. CONFIGURING SILVERLIGHT MIME TYPES
      1. 2.4.1. Adding MIME Support to IIS
    5. 2.5. SUMMARY
  10. 3. Building Applications with Expression Blend 4
    1. 3.1. LEARNING EXPRESSION BLEND BASICS
      1. 3.1.1. IDE Tour
        1. 3.1.1.1. Toolbar
        2. 3.1.1.2. Project Explorer
        3. 3.1.1.3. Object Explorer
        4. 3.1.1.4. Design Surface
        5. 3.1.1.5. Properties Pane
          1. 3.1.1.5.1. Brushes
          2. 3.1.1.5.2. Appearance
          3. 3.1.1.5.3. Layout
          4. 3.1.1.5.4. Common Properties
          5. 3.1.1.5.5. Miscellaneous Settings
        6. 3.1.1.6. Transform(s)
        7. 3.1.1.7. The States Tab
      2. 3.1.2. Creating Your Own Silverlight Project
        1. 3.1.2.1. Expression Blend Startup Dialog
        2. 3.1.2.2. New Project in Expression Blend
    2. 3.2. USING EXPRESSION BLEND BEHAVIORS
      1. 3.2.1. Implementing Behaviors
      2. 3.2.2. Consuming Behaviors
    3. 3.3. USING THE VISUAL STATE MANAGER
      1. 3.3.1. Creating a Control Template(s)
      2. 3.3.2. Customizing Visual States
    4. 3.4. IMPORTING DESIGN ASSETS
      1. 3.4.1. Importing PhotoShop (PSD) Assets
      2. 3.4.2. Importing Illustrator (AI) Files
      3. 3.4.3. Importing Fonts and Images Assets
    5. 3.5. USING THE EXPRESSION SUITE
      1. 3.5.1. Expression Encoder
      2. 3.5.2. Deep Zoom Composer
    6. 3.6. SUMMARY
  11. 4. Working with the Navigation Framework
    1. 4.1. USING THE NAVIGATION TEMPLATE
    2. 4.2. CREATING PARAMETERIZED QUERY STRINGS
      1. 4.2.1. Using the Frame Class
        1. 4.2.1.1. Frame Class Methods
        2. 4.2.1.2. Frame Class Properties
        3. 4.2.1.3. Frame Class Events
    3. 4.3. USING A CUSTOM MENU CONTROL
    4. 4.4. ADDING NAVIGATION ANIMATIONS
    5. 4.5. SUMMARY
  12. 5. Controlling Layout with Panels
    1. 5.1. MEASURE, THEN ARRANGE
    2. 5.2. ELEMENT SIZING CHARACTERISTICS
      1. 5.2.1. Height and Width
      2. 5.2.2. Alignment
      3. 5.2.3. Margin and Padding
        1. 5.2.3.1. Margin
        2. 5.2.3.2. Padding
    3. 5.3. USING LAYOUT PANELS
      1. 5.3.1. Canvas
      2. 5.3.2. StackPanel
      3. 5.3.3. VirtualizingStackPanel
      4. 5.3.4. Grid
      5. 5.3.5. WrapPanel
      6. 5.3.6. DockPanel
      7. 5.3.7. Finding Third-Party Panels
    4. 5.4. CREATING CUSTOM PANELS
    5. 5.5. SILVERLIGHT PLUG-IN SIZING
    6. 5.6. SUMMARY
  13. 6. Working with Visual Controls
    1. 6.1. WHERE TO FIND CONTROLS
    2. 6.2. USING TEXT DISPLAY CONTROLS
      1. 6.2.1. TextBlock
      2. 6.2.2. Label
    3. 6.3. USING INPUT EDITOR CONTROLS
      1. 6.3.1. Text
        1. 6.3.1.1. TextBox
        2. 6.3.1.2. PasswordBox
        3. 6.3.1.3. AutoCompleteBox
        4. 6.3.1.4. RichTextBox
      2. 6.3.2. Using Numeric Editor Controls
        1. 6.3.2.1. Slider
        2. 6.3.2.2. NumericUpDown
        3. 6.3.2.3. Rating
      3. 6.3.3. Dates and Time
        1. 6.3.3.1. Calendar and GlobalCalendar
        2. 6.3.3.2. DatePicker and TimePicker
        3. 6.3.3.3. TimeUpDown
    4. 6.4. USING LISTS AND ITEMS CONTROLS
      1. 6.4.1. DataGrid
        1. 6.4.1.1. Data Binding
        2. 6.4.1.2. Grid Columns
        3. 6.4.1.3. Sorting
        4. 6.4.1.4. Data Grouping
        5. 6.4.1.5. Column Resizing
        6. 6.4.1.6. Column Freezing
        7. 6.4.1.7. Column Moving
        8. 6.4.1.8. Row Details
      2. 6.4.2. DataForm
      3. 6.4.3. ListBox, ComboBox, and TabControl
      4. 6.4.4. DataPager
      5. 6.4.5. Accordion
      6. 6.4.6. TreeView
    5. 6.5. USING BUTTON CONTROLS
      1. 6.5.1. Button
      2. 6.5.2. HyperlinkButton
      3. 6.5.3. ToggleButton
    6. 6.6. USING THE GRIDSPLITTER CONTROL
    7. 6.7. USING THE IMAGE CONTROL
    8. 6.8. USING DATA VISUALIZATION CONTROLS
      1. 6.8.1. TreeMap
      2. 6.8.2. Chart
    9. 6.9. USING OTHER MISCELLANEOUS CONTROLS
      1. 6.9.1. ViewBox
      2. 6.9.2. BusyIndicator
      3. 6.9.3. Expander
      4. 6.9.4. ValidationSummary
      5. 6.9.5. Tooltip
      6. 6.9.6. ScrollViewer
    10. 6.10. CREATING CUSTOM CONTROLS
      1. 6.10.1. Template Parts
      2. 6.10.2. Visual States
    11. 6.11. SUMMARY
  14. 7. Accessing Data
    1. 7.1. PROCESSING XML DATA
      1. 7.1.1. LINQ to XML
      2. 7.1.2. Using an XmlReader
    2. 7.2. BINDING A USER INTERFACE TO DATA
      1. 7.2.1. Establishing a Data-Binding Connection
        1. 7.2.1.1. Valid Binding Target Types
        2. 7.2.1.2. Specifying the Source Object
        3. 7.2.1.3. Selecting a Property from the Source Object
        4. 7.2.1.4. Binding to Collections with ItemsControl
          1. 7.2.1.4.1. Specifying an ItemTemplate
          2. 7.2.1.4.2. Providing a Custom ItemsPanel
        5. 7.2.1.5. Using a Relative Source Binding
        6. 7.2.1.6. Element-to-Element Binding
      2. 7.2.2. Handling Data Updates
        1. 7.2.2.1. Working with the INotifyPropertyChanged Interface
        2. 7.2.2.2. Using Collection Update Notifications
        3. 7.2.2.3. Using OneTime Bindings
        4. 7.2.2.4. Using OneWay Bindings
        5. 7.2.2.5. Using TwoWay Bindings
        6. 7.2.2.6. Validating Data
          1. 7.2.2.6.1. Handling Binding Exceptions
          2. 7.2.2.6.2. Using Visual States That Reflect Validation Errors
      3. 7.2.3. Converting Data Types
        1. 7.2.3.1. Using the IValueConverter Interface
        2. 7.2.3.2. Adding the Converter to a Binding
        3. 7.2.3.3. Using the ConverterParameter Property
    3. 7.3. WORKING WITH SERVICES
      1. 7.3.1. Building an ASP.NET Web Service
        1. 7.3.1.1. Looking at the Base Web Service Class File
        2. 7.3.1.2. Exposing Data as SOAP
          1. 7.3.1.2.1. Using the WebService Attribute
          2. 7.3.1.2.2. Using the WebMethod Attribute
        3. 7.3.1.3. Working with the XML Web Service Interface
      2. 7.3.2. Consuming a Simple XML Web Service
        1. 7.3.2.1. Adding a Web Reference
        2. 7.3.2.2. Invoking the Web Service from the Client Application
      3. 7.3.3. Working with Windows Communication Foundation (WCF)
        1. 7.3.3.1. Understanding the Larger Move to SOA
        2. 7.3.3.2. Understanding WCF
        3. 7.3.3.3. Building a WCF Service
          1. 7.3.3.3.1. Creating the Services Framework
          2. 7.3.3.3.2. Working with the Interface
          3. 7.3.3.3.3. Utilizing the Interface
          4. 7.3.3.3.4. Reviewing the Service
        4. 7.3.3.4. Building a Silverlight Consumer
          1. 7.3.3.4.1. Changing Configuration Files
          2. 7.3.3.4.2. Consuming the Service Interface
      4. 7.3.4. Working with REST-Based Services
        1. 7.3.4.1. Creating a WCF Data Service
          1. 7.3.4.1.1. Adding Your Entity Data Model
          2. 7.3.4.1.2. Creating the Service
          3. 7.3.4.1.3. Consuming the WCF Data Service in Silverlight
    4. 7.4. SUMMARY
  15. 8. WCF RIA Services
    1. 8.1. UNDERSTANDING WCF RIA SERVICES
    2. 8.2. BUILDING A SIMPLE RIA SERVICES APPLICATION
      1. 8.2.1. Reviewing the Business Application Solution
      2. 8.2.2. Building an Entity Data Model
      3. 8.2.3. Building a Domain Service
        1. 8.2.3.1. Adding the Domain Service Class
        2. 8.2.3.2. Reviewing the Operations
      4. 8.2.4. Connecting the Silverlight Client to Your Domain Service
        1. 8.2.4.1. Connecting the Two Solutions
        2. 8.2.4.2. Working with the Domain Context
      5. 8.2.5. Connecting to the Domain Service through XAML
        1. 8.2.5.1. Creating Your Entity Data Model
        2. 8.2.5.2. Creating the Domain Service
        3. 8.2.5.3. Creating Customers.xaml
        4. 8.2.5.4. Reviewing the Behavior of the Results
      6. 8.2.6. Filtering Results
    3. 8.3. SUMMARY
  16. 9. Out-of-Browser Experiences
    1. 9.1. CREATING AN OUT-OF-BROWSER APPLICATION
      1. 9.1.1. Out-of-Browser Application Features
      2. 9.1.2. Configuring an Out-of-Browser Application in Visual Studio
      3. 9.1.3. Installing an Out-of-Browser Application
      4. 9.1.4. Uninstalling an Out-of-Browser Application
      5. 9.1.5. Updating an Out-of-Browser Application
    2. 9.2. INSTALLING TRUSTED APPLICATIONS
      1. 9.2.1. Accessing the Filesystems
      2. 9.2.2. Using COM Automation
      3. 9.2.3. Support for Window Customization
      4. 9.2.4. Adding Digital Signatures
    3. 9.3. INSTALLING A LOCAL SILVERLIGHT APPLICATION
    4. 9.4. SUMMARY
  17. 10. Networking Applications
    1. 10.1. THE WEBCLIENT CLASS
      1. 10.1.1. Using OpenReadAsync()
      2. 10.1.2. Downloading Files Using WebClient
      3. 10.1.3. Uploading Files Using WebClient
      4. 10.1.4. Reusing a Single WebClient Object
      5. 10.1.5. Cross-Domain Access
    2. 10.2. Silverlight and WCF Duplex Communications
      1. 10.2.1. Setting Up the Duplex Service
      2. 10.2.2. Setting Up the Duplex Client
    3. 10.3. SOCKETS
      1. 10.3.1. Setting Up the Policy Server
      2. 10.3.2. Setting Up the Application Sockets Server
      3. 10.3.3. Setting Up the Sockets Client
    4. 10.4. SUMMARY
  18. 11. Building Line of Business Applications
    1. 11.1. LINE OF BUSINESS BASICS
      1. 11.1.1. Responding to Mouse Actions
      2. 11.1.2. Enabling Right-Click Support
      3. 11.1.3. Handling Multi-Touch
      4. 11.1.4. Drawing with Ink
      5. 11.1.5. Enabling Clipboard Access
      6. 11.1.6. Adding Printing Support
      7. 11.1.7. Supporting Drag-and-Drop
      8. 11.1.8. Using the Web Browser Control
    2. 11.2. ADVANCED SCENARIOS
      1. 11.2.1. Communicating between Silverlight Applications
      2. 11.2.2. Integrating with Office
    3. 11.3. GLOBALIZATION AND LOCALIZATION
      1. 11.3.1. Localizing Your Application
      2. 11.3.2. Using Resource Files
      3. 11.3.3. Packing and Deploying
      4. 11.3.4. Supporting Bidirectional Right-to-Left (RTL) Text
      5. 11.3.5. Deploying Best Practices
    4. 11.4. FULL-SCREEN APPLICATIONS
    5. 11.5. SUMMARY
  19. 12. Application Architecture
    1. 12.1. UNDERSTANDING DESIGN PATTERNS
      1. 12.1.1. Exploring the Model View ViewModel (MVVM)
        1. 12.1.1.1. MVVM and Separation of Concerns
          1. 12.1.1.1.1. The Responsibility of the Model
          2. 12.1.1.1.2. The Responsibility of the View
          3. 12.1.1.1.3. The Responsibilities of the ViewModel
        2. 12.1.1.2. Using MVVM Best Practices
      2. 12.1.2. Learning about Inversion of Control/Dependency Injection
      3. 12.1.3. Exploring the Event Broker Pattern
    2. 12.2. USING SILVERLIGHT FRAMEWORKS
      1. 12.2.1. Exploring the Managed Extensibility Framework
        1. 12.2.1.1. What Problem Does MEF Solve?
        2. 12.2.1.2. How Does MEF Work?
        3. 12.2.1.3. Using MEF in Your Application
        4. 12.2.1.4. Declaring Exports
        5. 12.2.1.5. Declaring Imports
        6. 12.2.1.6. Using Catalogs
        7. 12.2.1.7. Managing a Part's Lifetime
        8. 12.2.1.8. Hosting MEF in Silverlight
        9. 12.2.1.9. Partitioning Applications across Multiple XAPs
      2. 12.2.2. Exploring PRISM/Composite Application Library
        1. 12.2.2.1. Using PRISM to Build an Application
          1. 12.2.2.1.1. Building the Shell and Modules
        2. 12.2.2.2. Defining Region Adapters
        3. 12.2.2.3. Adding Views to a Region
        4. 12.2.2.4. Using Commands
          1. 12.2.2.4.1. Using DelegateCommand<T>
          2. 12.2.2.4.2. Using CompositeCommands
        5. 12.2.2.5. Using the Event Aggregator
    3. 12.3. DEFINING YOUR DATA ACCESS STRATEGY
    4. 12.4. HANDLING PERFORMANCE
    5. 12.5. SUMMARY
  20. 13. DOM Interaction
    1. 13.1. CONFIGURING THE SILVERLIGHT PLUG-IN
      1. 13.1.1. windowless
      2. 13.1.2. splashScreenSource
      3. 13.1.3. initParams
      4. 13.1.4. enablehtmlaccess
      5. 13.1.5. enableAutoZoom
      6. 13.1.6. enableGPUAcceleration
      7. 13.1.7. enableNavigation
      8. 13.1.8. allowHtmlPopupWindow
      9. 13.1.9. Plug-In API
    2. 13.2. CREATING INTERACTION BETWEEN SILVERLIGHT AND JAVASCRIPT
      1. 13.2.1. JavaScript API
      2. 13.2.2. HTML Bridge
        1. 13.2.2.1. Exposing Managed Code in JavaScript
        2. 13.2.2.2. Accessing the DOM Using Managed Code
    3. 13.3. SUMMARY
  21. 14. Securing Your Applications
    1. 14.1. TAKING ADVANTAGE OF ASP.NET
      1. 14.1.1. Forms-Based Authentication
        1. 14.1.1.1. Storing Encrypted Passwords within the Web.config File
        2. 14.1.1.2. Authenticating Against Values in a Database
        3. 14.1.1.3. Silverlight Consuming the Authenticate() Service
      2. 14.1.2. Windows-Based Authentication
        1. 14.1.2.1. Running the WCF Solution in IIS
        2. 14.1.2.2. Authenticating and Authorizing a User in the Web.config
        3. 14.1.2.3. Looking Closely at the <allow> and <deny> Nodes
      3. 14.1.3. Authenticating Specific Files and Folders
    2. 14.2. USING ASP.NET APPLICATION SERVICES
      1. 14.2.1. Working with Membership on the Server
        1. 14.2.1.1. Creating Users
        2. 14.2.1.2. Seeing Where Users Are Stored
      2. 14.2.2. Working with Membership on the Client
      3. 14.2.3. Working with Role Management on the Server
        1. 14.2.3.1. Making Changes to the <roleManager> Section
        2. 14.2.3.2. Adding Roles to the Database
        3. 14.2.3.3. Creating a Role Service
        4. 14.2.3.4. Adding Roles to Your Silverlight Application
    3. 14.3. SUMMARY
  22. 15. Accessing Audio and Video Devices
    1. 15.1. CONFIGURING PERMISSIONS
    2. 15.2. ACCESSING AUDIO AND VIDEO DEVICES
    3. 15.3. CAPTURING IMAGES FROM A VIDEO FEED
      1. 15.3.1. Saving Images to the Filesystem
    4. 15.4. CAPTURING AN AUDIO STREAM
    5. 15.5. SUMMARY
  23. 16. Working with File I/O
    1. 16.1. THE OPENFILEDIALOG AND SAVEFILEDIALOG CLASSES
    2. 16.2. CLASSES FOR MANAGING THE FILESYSTEM
      1. 16.2.1. .NET Classes That Represent Files and Folders
      2. 16.2.2. Using the Path Class
      3. 16.2.3. Using Basic File Objects from Silverlight
        1. 16.2.3.1. Applying Settings for an Out-of-Browser Application
        2. 16.2.3.2. Building the InstallPage.xaml File
    3. 16.3. MOVING, COPYING, AND DELETING FILES
      1. 16.3.1. Extending on the FileProperties Solution
      2. 16.3.2. Using the Move, Copy, and Delete Methods
    4. 16.4. READING AND WRITING FILES
      1. 16.4.1. Reading from a File
      2. 16.4.2. Writing to a File
    5. 16.5. USING STREAMS
      1. 16.5.1. Using Buffered Streams
      2. 16.5.2. Reading and Writing Binary Files Using FileStream
      3. 16.5.3. Reading and Writing to Text Files
        1. 16.5.3.1. Using the StreamReader Class
        2. 16.5.3.2. Using the StreamWriter Class
    6. 16.6. USING ISOLATED STORAGE OPTIONS
      1. 16.6.1. Reading and Writing from Isolated Storage
      2. 16.6.2. Understanding Space Constraints
      3. 16.6.3. Creating Directories in Isolated Storage
      4. 16.6.4. Deleting Your Store
    7. 16.7. SUMMARY
  24. 17. Using Graphics and Visuals
    1. 17.1. THE BASICS
      1. 17.1.1. Working with Rectangles and Borders
      2. 17.1.2. Applying Rounded Corners
        1. 17.1.2.1. Understanding Pixel-Based Values
        2. 17.1.2.2. Comparing Rectangles to Borders
        3. 17.1.2.3. Nesting Borders
      3. 17.1.3. Using the Ellipse
      4. 17.1.4. Using the Path
        1. 17.1.4.1. Defining and Understanding Path Data
        2. 17.1.4.2. Defining the Path Resize Behavior
      5. 17.1.5. Using Geometries
        1. 17.1.5.1. Defining Complex Shapes
        2. 17.1.5.2. Why Use PathGeometries?
      6. 17.1.6. Using Clipping/Masking Elements
    2. 17.2. EXPRESSION BLEND SHAPES
      1. 17.2.1. Binding to Shape Properties
    3. 17.3. IMAGES AND MEDIA
      1. 17.3.1. Displaying Images
        1. 17.3.1.1. Using the Image Control
        2. 17.3.1.2. Referencing Images
        3. 17.3.1.3. Compiling Images
          1. 17.3.1.3.1. Adding an Image in Expression Blend
          2. 17.3.1.3.2. Setting the Image Source
          3. 17.3.1.3.3. Using XAP File Images
          4. 17.3.1.3.4. Adding Loose Images
          5. 17.3.1.3.5. Compiling Images in Other Assemblies
          6. 17.3.1.3.6. Accessing Images on Other Domains
      2. 17.3.2. Displaying Media
    4. 17.4. BRUSHES
      1. 17.4.1. Painting with Solids
      2. 17.4.2. Painting with Linear Gradients
      3. 17.4.3. Painting with Radial Gradients
      4. 17.4.4. Painting with Images
      5. 17.4.5. Painting with Video
      6. 17.4.6. Editing Brushes in Expression Blend
        1. 17.4.6.1. Using the Brush Editor
        2. 17.4.6.2. Applying a Brush Value
        3. 17.4.6.3. Applying Solid Color Brushes
        4. 17.4.6.4. Applying Gradient Brushes
        5. 17.4.6.5. Using the Gradient Tool
      7. 17.4.7. Creating ImageBrushes
    5. 17.5. FONTS AND FONT EMBEDDING
    6. 17.6. EFFECTS
      1. 17.6.1. Applying Effects
      2. 17.6.2. Using Native Effects
        1. 17.6.2.1. Applying the BlurEffect
        2. 17.6.2.2. Applying the DropShadowEffect
        3. 17.6.2.3. Applying Effects in Expression Blend
      3. 17.6.3. Using Custom Effects
        1. 17.6.3.1. Getting the Tools
        2. 17.6.3.2. Viewing and Compiling Shaders with Shazzam and the DirectX SDK
        3. 17.6.3.3. Creating a Custom Shader Effect
          1. 17.6.3.3.1. Adding the Compiled Shader to Visual Studio
          2. 17.6.3.3.2. Creating the Effect Class
          3. 17.6.3.3.3. Applying the Custom Effect
    7. 17.7. TRANSFORMS
      1. 17.7.1. Using 2D Transforms
        1. 17.7.1.1. Using the RotateTransform
        2. 17.7.1.2. Using the ScaleTransform
        3. 17.7.1.3. Using the SkewTransform
        4. 17.7.1.4. Using the TranslateTransform
        5. 17.7.1.5. Using the MatrixTransform
        6. 17.7.1.6. Applying Multiple Transforms
          1. 17.7.1.6.1. Using the TransformGroup
          2. 17.7.1.6.2. Using the CompositeTransform
      2. 17.7.2. Using Perspective 3D
        1. 17.7.2.1. Adjusting PlaneProjections in Expression Blend
    8. 17.8. SUMMARY
  25. 18. Working with Animations in Silverlight
    1. 18.1. STORYBOARD ANIMATIONS
      1. 18.1.1. Applying Easing Functions
      2. 18.1.2. Controlling Storyboards Using Behaviors
      3. 18.1.3. Nesting Storyboards
      4. 18.1.4. Using Storyboards as Timers
    2. 18.2. KEYFRAME ANIMATION
      1. 18.2.1. Rendering CompositionTargets
      2. 18.2.2. Animating Visibility
      3. 18.2.3. Animating Sprites
    3. 18.3. SUMMARY
  26. 19. Working with Text
    1. 19.1. DISPLAYING AND INPUTTING TEXT
      1. 19.1.1. Using the TextBlock Element
        1. 19.1.1.1. Using Text Element Layout Properties
        2. 19.1.1.2. Using Text Trimming
        3. 19.1.1.3. Using Text Decorations
        4. 19.1.1.4. Formatting Inline Text
      2. 19.1.2. Using the RichTextBox Control
        1. 19.1.2.1. Creating Rich Content
        2. 19.1.2.2. Working with RichTextBox Default Behaviors
        3. 19.1.2.3. Selecting and Navigating Content
    2. 19.2. FONT SUPPORT AND RENDERING
      1. 19.2.1. Using Embedded Fonts
      2. 19.2.2. Creating Font Glyph Subsets
      3. 19.2.3. Rendering Text
    3. 19.3. SUMMARY
  27. 20. Making It Richer with Media
    1. 20.1. SUPPORTED FORMATS
    2. 20.2. UNSUPPORTED WINDOWS MEDIA FORMATS
    3. 20.3. H.264 AND AAC SUPPORT
    4. 20.4. DIGITAL RIGHTS MANAGEMENT
    5. 20.5. USING THE MEDIAELEMENT CONTROL
      1. 20.5.1. Build Actions and Referencing Media
        1. 20.5.1.1. Assembly Resource Media
        2. 20.5.1.2. XAP File Media
        3. 20.5.1.3. Loose Files
        4. 20.5.1.4. Media in Other Assemblies
        5. 20.5.1.5. Media on Other Domains
      2. 20.5.2. Adding a MediaElement in Blend
      3. 20.5.3. Sizing Video and Setting the Stretch Behavior
      4. 20.5.4. Transforming Video
      5. 20.5.5. Rotating Video in 3D
      6. 20.5.6. Clipping Video
      7. 20.5.7. Painting Elements with the VideoBrush
      8. 20.5.8. Simulating Video Reflections
      9. 20.5.9. Enabling GPU Hardware Acceleration
      10. 20.5.10. Audio Settings
      11. 20.5.11. Buffering
      12. 20.5.12. Detecting Download Progress
      13. 20.5.13. Detecting Playback Quality
      14. 20.5.14. Controlling Playback
        1. 20.5.14.1. Pause()
        2. 20.5.14.2. Play()
        3. 20.5.14.3. Stop()
        4. 20.5.14.4. SetSource()
        5. 20.5.14.5. Seeking
      15. 20.5.15. Responding to Video Markers
        1. 20.5.15.1. The Markers Property
        2. 20.5.15.2. The MarkerReached Event
      16. 20.5.16. Handling Failed Media
      17. 20.5.17. Responding to State Changes
    6. 20.6. MEDIA PLAYLISTS
      1. 20.6.1. Server-Side Playlist (SSPL) Files
        1. 20.6.1.1. Why Use a Media Server and SSPL?
        2. 20.6.1.2. Creating and Consuming a WSX File
      2. 20.6.2. Advanced Stream Redirector (ASX) Files
        1. 20.6.2.1. Key Features of ASX
        2. 20.6.2.2. Creating and Consuming an ASX File
      3. 20.6.3. Encoding Media with Expression Encoder
        1. 20.6.3.1. Timeline Controls
          1. 20.6.3.1.1. Timeline
          2. 20.6.3.1.2. Timeline Viewing Controls
          3. 20.6.3.1.3. Playback Controls
          4. 20.6.3.1.4. Editing Buttons
          5. 20.6.3.1.5. "Add Leader"/"Add Trailer" Buttons
        2. 20.6.3.2. Editing Metadata
        3. 20.6.3.3. Encoding Settings
          1. 20.6.3.3.1. Additional Encoding Features
          2. 20.6.3.3.2. Adding a Video Overlay
        4. 20.6.3.4. Output Settings
          1. 20.6.3.4.1. Encoding Media
      4. 20.6.4. Smooth Streaming and IIS 7
    7. 20.7. SUMMARY
  28. 21. Styling and Themes
    1. 21.1. GETTING STARTED
      1. 21.1.1. Defining a Core Terminology
      2. 21.1.2. Defining the Working Environment: A XAML-Based Approach
    2. 21.2. DEFINING LOCAL STYLING (INLINE STYLING)
    3. 21.3. STYLING WITH RESOURCES
    4. 21.4. WORKING WITH THE STYLE OBJECT
      1. 21.4.1. Understanding Value Resolution
      2. 21.4.2. Creating BasedOn Styles
      3. 21.4.3. Changing the Look of a Control with a Custom ControlTemplate
        1. 21.4.3.1. What Is a ControlTemplate?
        2. 21.4.3.2. Why Define a Custom Template?
        3. 21.4.3.3. Defining and Applying a Custom Template
        4. 21.4.3.4. Using the ContentPresenter
        5. 21.4.3.5. Using the TemplateBinding Markup Extension
        6. 21.4.3.6. Embracing TemplateBinding throughout the ControlTemplate
        7. 21.4.3.7. Preserving the Essence of Your Style
        8. 21.4.3.8. Understanding the Limitations of TemplateBinding
        9. 21.4.3.9. Visual State Manager: Reacting to State Changes within a Template
          1. 21.4.3.9.1. Defining Transitions
        10. 21.4.3.10. Using Text-Related Properties
    5. 21.5. DEFINING AND USING IMPLICIT STYLES
    6. 21.6. DEFINING AND ORGANIZING RESOURCES
      1. 21.6.1. Defining Stand-alone ResourceDictionaries
      2. 21.6.2. Loading ResourceDictionaries (via the Merged Dictionaries Collection)
      3. 21.6.3. Understanding Resource Scope
        1. 21.6.3.1. Defining Application-Wide Resources
        2. 21.6.3.2. Defining Styles for Custom Controls
        3. 21.6.3.3. Scoping Resources to a Single UserControl or Element
        4. 21.6.3.4. Understanding External ResourceDictionary Scope
      4. 21.6.4. Organizing Resources
      5. 21.6.5. Naming Resources
        1. 21.6.5.1. Naming Brushes: Template/Style-Specific Brushes
        2. 21.6.5.2. Naming Brushes: Non-Template Brushes
        3. 21.6.5.3. Naming Styles/Templates
    7. 21.7. USING THEMES
      1. 21.7.1. Using Silverlight Toolkit Themes
        1. 21.7.1.1. Referencing via the MergedDictionaries Collection
        2. 21.7.1.2. Using the Theme Controls
      2. 21.7.2. Creating Custom Themes
      3. 21.7.3. Distributing Your Theme
    8. 21.8. EDITING STYLES AND TEMPLATES IN EXPRESSION BLEND
      1. 21.8.1. Editing the Default Button Style
        1. 21.8.1.1. Using the Property Panel to Define TemplateBindings
        2. 21.8.1.2. Editing Control States
      2. 21.8.2. Creating a Custom Button
    9. 21.9. SUMMARY
  29. A. XAML Primer
    1. A.1. INTRODUCING XAML
    2. A.2. SILVERLIGHT XAML BASICS
    3. A.3. DECLARING OBJECTS IN XAML
      1. A.3.1. Object or Content Element Syntax
      2. A.3.2. Attribute Element Syntax
      3. A.3.3. Property Element Syntax
      4. A.3.4. Setting a Property Using Implicit Collection Syntax
      5. A.3.5. Deciding When to Use Attribute or Property Element Syntax to Set a Property
    4. A.4. XAML HIERARCHY
    5. A.5. EVENTS AND THE SILVERLIGHT CONTROL
      1. A.5.1. Event Handlers and Partial Classes
        1. A.5.1.1. Defining Events in JavaScript
        2. A.5.1.2. Finding a XAML Object Using findName
      2. A.5.2. Event Bubbling
    6. A.6. MARKUP EXTENSIONS
      1. A.6.1. Binding Markup Extensions
      2. A.6.2. StaticResource Markup Extensions
    7. A.7. SUMMARY
  30. B. Testing Silverlight Applications
    1. B.1. CREATING THE SAMPLE APPLICATION
    2. B.2. Using the Silverlight Unit Test Framework
    3. B.3. USING THE SELENIUM TEST FRAMEWORK
    4. B.4. AUTOMATED UI TESTING USING WHITE
    5. B.5. MOCKING FRAMEWORKS
    6. B.6. SUMMARY
  31. C. Building Facebook Applications with Silverlight
    1. C.1. CREATING A NEW APPLICATION ON FACEBOOK
    2. C.2. USING THE FACEBOOK DEVELOPER TOOLKIT
      1. C.2.1. Adding the Facebook Connect Components
      2. C.2.2. Using an Asynchronous API Request
        1. C.2.2.1. Authenticating and Initiating a Session (BrowserSession.Login() Method)
      3. C.2.3. Adding Features from the Facebook API
    3. C.3. SUMMARY
  32. D. Integrating Silverlight into SharePoint 2010
    1. D.1. THE SAMPLE APPLICATION
    2. D.2. USING THE SHAREPOINT FOUNDATION 2010 SILVERLIGHT OBJECT MODEL
    3. D.3. DEPLOYING A SILVERLIGHT APPLICATION INTO SHAREPOINT
    4. D.4. SUMMARY
  33. E. Silverlight Control Assemblies