You are previewing Silverlight 4 in Action.
O'Reilly logo
Silverlight 4 in Action

Book Description

Anyone who has gotten a taste of what it can do knows that Silverlight represents an entirely new level of rich web interface technology for Microsoft developers. With Silverlight, developers can use JavaScript, C#, and other languages to build user-friendly, interactive, and visually-dazzling web applications that work in most major browsers.

Silverlight 4 in Action is a comprehensive guide to Silverlight, taking you from Hello World through the techniques you'll need to build sophisticated rich web apps. This new edition covers all the new features added in the latest versions of Silverlight, Visual Studio, and Expression Blend, along with the best practices emerging in the Silverlight community. With more than 50% new content, you'll take a mind-expanding trip through the technology, features, and techniques required to build applications ranging from media, to custom experiences, to business applications to games.

Beyond the fundamentals, you'll find numerous practical examples of important patterns like the ViewModel (or MVVM) pattern, and effective practices for developing real-world applications. You'll delve into the underlying object model and what makes Silverlight tick. Business application developers will appreciate the coverage of the exciting new.NET RIA Services. Combined with advanced binding and validation techniques, they help you visualize how to make your application development super productive and your architecture flexible enough to implement solutions in any problem domain.

Silverlight 4 in Action devotes extensive coverage to flexible layout components, the extensible control model, the communication framework, and the data-binding features-all cornerstones of software development. You'll master Silverlight's rich media and vivid graphical and animation features. The closing chapters include a variety of Silverlight deployment and customization scenarios.

Finally, Silverlight 4 in Action doesn't leave you in the dark when it comes to testing and debugging your applications. Techniques, tools, and patterns to support testable Silverlight applications are woven throughout the chapters, with additional dedicated content on the specifics of testing and debugging in Silverlight.

Table of Contents

  1. Copyright
  2. preface
  3. acknowledgments
  4. about this book
    1. Audience
    2. The bits: what you need
    3. Roadmap
      1. Part 1: Introducing Silverlight
      2. Part 2: Structuring your application
      3. Part 3: Completing the experience
    4. Code conventions and downloads
    5. Author online
    6. About the author
    7. About the title
  5. about the cover illustration
  6. 1. Introducing Silverlight
    1. 1. Introducing Silverlight
      1. 1.1 Silverlight and the web
      2. 1.2 Silverlight and WPF
      3. 1.3 Types of Silverlight applications
      4. 1.4 What's new since the first edition
        1. 1.4.1 Features for business and client applications
        2. 1.4.2 Media and graphics enhancements
        3. 1.4.3 User interaction
        4. 1.4.4 Text
      5. 1.5 Getting started with Silverlight development
        1. 1.5.1 Setting up your development environment
        2. 1.5.2 Helpful sites
      6. 1.6 Building your first Silverlight web application
        1. 1.6.1 Project setup
        2. 1.6.2 User interface
        3. 1.6.3 Calling Twitter search
        4. 1.6.4 Parsing the results and binding the ListBox
          1. TWEET CLASS
          2. PARSING WITH LINQ TO XML
          3. BINDING THE LISTBOX
        5. 1.6.5 Making the ListBox contents more meaningful
      7. 1.7 Summary
    2. 2. Core XAML
      1. 2.1 XAML basics
        1. 2.1.1 Objects
        2. 2.1.2 Namespaces
          1. STANDARD XAML NAMESPACES
          2. REFERENCING OTHER LIBRARIES
        3. 2.1.3 Properties
          1. INLINE PROPERTIES
          2. ELEMENT PROPERTIES
        4. 2.1.4 Dependency properties
          1. VALUE PRECEDENCE
        5. 2.1.5 Attached properties
          1. PROPERTY PATHS
        6. 2.1.6 Events
          1. EVENTS REFERENCED IN XAML
          2. EVENTS REFERENCED IN CODE
        7. 2.1.7 Commands
        8. 2.1.8 Behaviors
      2. 2.2 Object trees and namescope
        1. 2.2.1 Object trees
          1. WALKING THE VISUAL TREE
        2. 2.2.2 Namescope
      3. 2.3 XAML extensions and type converters
        1. 2.3.1 Markup extensions
        2. 2.3.2 Type converters
          1. CREATING CUSTOM TYPE CONVERTERS
      4. 2.4 Loading XAML at runtime
      5. 2.5 Tools for working in XAML
      6. 2.6 Summary
    3. 3. The application model and the plug-in
      1. 3.1 The Silverlight application model
        1. 3.1.1 Application startup process
        2. 3.1.2 XAP
        3. 3.1.3 The application manifest file
          1. DEPLOYMENT.PARTS
        4. 3.1.4 The Silverlight application object
          1. MANAGING THE START OF A SILVERLIGHT APPLICATION
          2. HANDLING UNFORESEEN ERRORS
          3. EXITING THE SILVERLIGHT APPLICATION
          4. READING PLUG-IN SETTINGS
        5. 3.1.5 Application dependencies
        6. 3.1.6 Assembly caching
          1. HOW IT WORKS
      2. 3.2 Creating the Silverlight plug-in
        1. 3.2.1 Using the object tag
        2. 3.2.2 Using the Silverlight.js utility file
          1. REFERENCING THE SILVERLIGHT.JS FILE
          2. THE FUNCTIONS OF THE SILVERLIGHT.JS FILE
        3. 3.2.3 Creating an instance of the Silverlight plug-in
      3. 3.3 Integrating the Silverlight plug-in
        1. 3.3.1 Relating the Silverlight application to the HTML DOM
          1. SOURCE
          2. PARENTELEMENT
          3. ID
        2. 3.3.2 Clarifying the initial experience
          1. HEIGHT AND WIDTH+
          2. BACKGROUND AND ISWINDOWLESS
          3. FRAMERATE
          4. VERSION
          5. IGNOREBROWSERVER
          6. ENABLEHTMLACCESS
        3. 3.3.3 Handling plug-in events
          1. ONLOAD
          2. ONERROR
        4. 3.3.4 Sending initialization parameters
          1. INITPARAMS
          2. CONTEXT
      4. 3.4 Summary
    4. 4. Integrating with the browser
      1. 4.1 Silverlight and the HTML DOM
      2. 4.2 Managing the web page from managed code
        1. 4.2.1 Navigating web page contents
        2. 4.2.2 Working with element properties
        3. 4.2.3 Handling CSS information
        4. 4.2.4 Accessing the query string
      3. 4.3 Working with the user's browser window
        1. 4.3.1 Prompting the user
        2. 4.3.2 Navigating the browser window
        3. 4.3.3 Discovering the browser properties
      4. 4.4 Bridging the scripting and managed code worlds
        1. 4.4.1 Calling managed code from JavaScript
        2. 4.4.2 Using JavaScript from managed code
      5. 4.5 Hosting HTML in Silverlight
        1. 4.5.1 Hosting the WebBrowser control
          1. SOURCE PROPERTY
          2. NAVIGATE METHOD
          3. NAVIGATETOSTRING METHOD
          4. INVOKING SCRIPTS
          5. SAVING THE CONTENT
        2. 4.5.2 Using the WebBrowserBrush
      6. 4.6 Summary
    5. 5. Integrating with the desktop
      1. 5.1 Silverlight out of the browser
        1. 5.1.1 Capabilities and restrictions
        2. 5.1.2 The end-user experience
      2. 5.2 Creating out-of-browser applications
        1. 5.2.1 The out-of-browser settings file
        2. 5.2.2 Controlling the experience
        3. 5.2.3 Customizing icons
        4. 5.2.4 Checking the network state
          1. UPDATING
        5. 5.2.5 Alerting the user with Notification toast
        6. 5.2.6 Implementation specifics
      3. 5.3 Escaping the sandbox—elevated trust
        1. 5.3.1 Creating elevated-trust applications
          1. UNSIGNED APPLICATIONS
          2. SIGNED APPLICATIONS
        2. 5.3.2 Detecting elevated trust mode
      4. 5.4 Local file access
        1. 5.4.1 Accessing special folders
        2. 5.4.2 Reading from a file
        3. 5.4.3 Writing to a file
      5. 5.5 COM automation
        1. 5.5.1 Detecting COM automation availability
        2. 5.5.2 Using COM automation to make Silverlight talk
        3. 5.5.3 Accessing GPS data using COM automation
        4. 5.5.4 Automating Excel
      6. 5.6 Controlling the host window
        1. 5.6.1 Basic window properties
        2. 5.6.2 Changing window chrome
        3. 5.6.3 Minimizing, maximizing, restoring, and closing
        4. 5.6.4 Moving
        5. 5.6.5 Resizing
      7. 5.7 Running in full screen
        1. 5.7.1 Normal full-screen mode
          1. TOGGLING BETWEEN SCREEN MODES
        2. 5.7.2 Elevated trust full-screen mode
      8. 5.8 Storing data in Isolated storage
        1. 5.8.1 IsolatedStorageFile: the virtual filesystem
          1. LISTING THE CONTENTS OF THE VIRTUAL FILESYSTEM
          2. REMOVING ITEMS FROM ISOLATED STORAGE
          3. CREATING DIRECTORIES WITHIN ISOLATED STORAGE
          4. CHECKING THE AVAILABLE SPACE
          5. REQUESTING MORE SPACE
        2. 5.8.2 Reading and writing files: the isolated storage way
          1. ISOLATED FILE CREATION
          2. READING AN ISOLATED FILE
        3. 5.8.3 Administering isolated storage
      9. 5.9 Summary
    6. 6. Rendering, layout, and transforming
      1. 6.1 The UIElement and FrameworkElement
        1. 6.1.1 Properties
          1. CURSOR
          2. OPACITY
          3. VISIBILITY
          4. HORIZONTALALIGNMENT AND VERTICALALIGNMENT
          5. MARGIN
          6. USELAYOUTROUNDING
        2. 6.1.2 Methods
          1. MANAGING ATTACHED PROPERTIES
          2. FINDING ELEMENTS
      2. 6.2 The rendering process
        1. 6.2.1 Clock tick
        2. 6.2.2 Per-frame rendering callback
        3. 6.2.3 Rasterization
          1. ORDER OF RENDERING
          2. OCCLUSION
          3. CACHED COMPOSITION
          4. ENABLING HARDWARE ACCELERATION FOR THE CACHE
          5. VISUALIZING THE CACHE AND REDRAW REGIONS
      3. 6.3 The layout system
        1. 6.3.1 Multipass layout—measuring and arranging
          1. THE MEASURE PASS
          2. THE ARRANGE PASS
          3. LAYOUT COMPLETED
        2. 6.3.2 The LayoutInformation class
          1. GETLAYOUTSLOT
          2. GETLAYOUTCLIP
        3. 6.3.3 Performance considerations
          1. VIRTUALIZATION
          2. SIZING AND POSITIONING
      4. 6.4 Render transforms
        1. 6.4.1 RotateTransform
        2. 6.4.2 ScaleTransform
        3. 6.4.3 SkewTransform
        4. 6.4.4 TranslateTransform
        5. 6.4.5 TransformGroup
        6. 6.4.6 CompositeTransform
        7. 6.4.7 MatrixTransform
      5. 6.5 3D projection transforms
        1. 6.5.1 PlaneProjection
        2. 6.5.2 Matrix3dProjection
      6. 6.6 Summary
    7. 7. Panels
      1. 7.1 Canvas
        1. 7.1.1 Arranging content of a Canvas
          1. SETTING THE OFFSETS
          2. SETTING THE STACK ORDER
      2. 7.2 The StackPanel
      3. 7.3 The Grid
        1. 7.3.1 Arranging Grid content
        2. 7.3.2 Positioning Grid content
        3. 7.3.3 Spanning cells
        4. 7.3.4 Sizing it up
          1. STAR SIZING
          2. AUTO SIZING
          3. ABSOLUTE
        5. 7.3.5 Working with the grid programmatically
          1. ADDING ROWS AND COLUMNS AT RUNTIME
          2. REMOVING ROWS AND COLUMNS AT RUNTIME
        6. 7.3.6 Customizing cell boundaries
          1. ACCESSING EXTENDED CONTROLS
          2. USING THE GRIDSPLITTER
      4. 7.4 Summary
    8. 8. Human input
      1. 8.1 Capturing the keyboard
        1. 8.1.1 Understanding focus
          1. ELEMENT FOCUS
        2. 8.1.2 Handling keyboard events
        3. 8.1.3 Dealing with modifier keys
      2. 8.2 Mouse input
        1. 8.2.1 Mouse button and movement events
        2. 8.2.2 Using the mouse wheel
      3. 8.3 Using multi-touch
      4. 8.4 Collecting ink drawings
        1. 8.4.1 Creating the InkPresenter
        2. 8.4.2 Collecting ink
        3. 8.4.3 Styling the ink
      5. 8.5 Summary
    9. 9. Text
      1. 9.1 The text system
        1. 9.1.1 Subpixel text rendering
        2. 9.1.2 Text hinting
      2. 9.2 Displaying text
        1. 9.2.1 Font properties
          1. FONTFAMILY
          2. FONTSIZE
          3. FONTWEIGHT
          4. FONTSTRETCH
          5. FONTSTYLE
        2. 9.2.2 Flow control
        3. 9.2.3 Text properties
          1. FOREGROUND
          2. TEXTDECORATIONS
          3. TEXTWRAPPING
          4. TEXTTRIMMING
          5. TEXTALIGNMENT
        4. 9.2.4 Spacing
          1. LINEHEIGHT
          2. PADDING
      3. 9.3 Embedding fonts
      4. 9.4 Entering and editing text
        1. 9.4.1 Handling basic text input
          1. ENABLING MULTILINE TEXT SUPPORT
          2. MASTERING TEXT SELECTION
        2. 9.4.2 Understanding input method editors
        3. 9.4.3 Copying text with the Clipboard API
        4. 9.4.4 Collecting sensitive data
      5. 9.5 Entering and displaying rich text
        1. 9.5.1 Formatting and inline elements
          1. PARAGRAPHS
          2. INLINE STYLES AND SPANS
          3. INLINE HYPERLINKS
          4. INLINE IMAGES AND ELEMENTS
        2. 9.5.2 Working with selected text
          1. SELECTION
          2. CHANGING SELECTION PROPERTIES
          3. REPLACING TEXT
          4. INSERTING NEW TEXT
          5. RETRIEVING RICH TEXT AS XAML
      6. 9.6 Summary
    10. 10. Controls and UserControls
      1. 10.1 Control
        1. 10.1.1 Appearance
        2. 10.1.2 Navigation and state
        3. 10.1.3 Templating
      2. 10.2 ContentControl
        1. 10.2.1 The ContentPresenter
      3. 10.3 Button controls
        1. 10.3.1 The Button
        2. 10.3.2 The HyperlinkButton
        3. 10.3.3 The RadioButton
          1. RADIOBUTTON SELECTION
          2. RADIOBUTTON GROUPING
        4. 10.3.4 The CheckBox
      4. 10.4 ItemsControls
        1. 10.4.1 The ListBox
        2. 10.4.2 The ComboBox
        3. 10.4.3 The TabControl
      5. 10.5 Creating UserControls
        1. 10.5.1 Defining the appearance
        2. 10.5.2 Defining the behavior
          1. REGISTERING DEPENDENCY PROPERTIES
          2. RESPONDING TO PROPERTY VALUE CHANGES
        3. 10.5.3 Calling the control
      6. 10.6 Summary
  7. 2. Structuring your application
    1. 11. Binding
      1. 11.1 Binding with your data
        1. 11.1.1 Mastering the binding syntax
          1. BINDING AT RUNTIME
          2. BINDING AT DESIGN TIME
        2. 11.1.2 Choosing a binding mode
          1. ONETIME
          2. ONEWAY
          3. TWOWAY
      2. 11.2 Understanding your binding source
        1. 11.2.1 Binding to a property
        2. 11.2.2 Binding to an object
        3. 11.2.3 Binding to a UI element
          1. USING A RELATIVE SOURCE
        4. 11.2.4 Binding to an indexed element
        5. 11.2.5 Binding to a keyed (string indexed) element
        6. 11.2.6 Binding to an entire collection
      3. 11.3 Customizing the display
        1. 11.3.1 Formatting values
        2. 11.3.2 Converting values during binding
          1. CREATING A VALUE CONVERTER
          2. USING A VALUE CONVERTER
        3. 11.3.3 Providing default fallback values
        4. 11.3.4 Handling null values
      4. 11.4 Creating data templates
        1. 11.4.1 Using a DataTemplate with a ContentControl
        2. 11.4.2 Rendering an ItemsControl with a DataTemplate
      5. 11.5 Summary
    2. 12. Data controls: DataGrid and DataForm
      1. 12.1 The DataGrid
        1. 12.1.1 Displaying your data
          1. EXPLORING BOUND COLUMNS
          2. MANUALLY WORKING WITH COLUMNS
          3. CUSTOMIZING THE ROWS
          4. CUSTOMIZING THE HEADERS
        2. 12.1.2 Editing grid data
        3. 12.1.3 Sorting items
      2. 12.2 The DataForm
        1. 12.2.1 Displaying your data
        2. 12.2.2 Binding to lists of data
        3. 12.2.3 Customizing display
          1. CUSTOMIZING FIELD LABELS
          2. CUSTOMIZING FIELD DESCRIPTIONS
        4. 12.2.4 Customizing edit, add, and display templates
          1. CREATING THE DATATEMPLATE
        5. 12.2.5 Finer control over editing and committing data
          1. IEDITABLEOBJECT
          2. CHECKING FOR DIRTY STATE AND VALIDITY
      3. 12.3 Annotating for display
        1. 12.3.1 The Display attribute
        2. 12.3.2 The Editable attribute
      4. 12.4 Summary
    3. 13. Input validation
      1. 13.1 The validation example source and UI
      2. 13.2 Exception-based property validation
        1. 13.2.1 Handling exception validation errors
        2. 13.2.2 Custom validation code
          1. COMBINING VALIDATION MESSAGES
        3. 13.2.3 Validation error display
      3. 13.3 Synchronous validation with IDataErrorInfo
        1. 13.3.1 The IDataErrorInfo interface
          1. BINDING WITH VALIDATESONDATAERRORS
        2. 13.3.2 Simple validation with IDataErrorInfo
        3. 13.3.3 Cross-field validation with IDataErrorInfo
        4. 13.3.4 Combining exceptions and IDataErrorInfo
      4. 13.4 Asynchronous validation with INotifyDataErrorInfo
        1. 13.4.1 The INotifyDataErrorInfo interface
        2. 13.4.2 Implementing the interface
        3. 13.4.3 Binding support
        4. 13.4.4 Building the WCF web service
        5. 13.4.5 Adding the client service code
        6. 13.4.6 Property modifications
      5. 13.5 Annotating for validation
        1. 13.5.1 Validation attributes
        2. 13.5.2 Annotating your entity
        3. 13.5.3 Calling external validation functions
        4. 13.5.4 Creating custom validators
      6. 13.6 Comparison of validation approaches
      7. 13.7 Summary
    4. 14. Networking and communications
      1. 14.1 Trust, security, and browser limitations
        1. 14.1.1 Cross-domain network access
        2. 14.1.2 Making your application secure
          1. DATA INTEGRITY
          2. HTTPS
          3. COOKIES
        3. 14.1.3 Limitations of the browser
          1. CONNECTION COUNT LIMIT
          2. ASYNCHRONOUS ONLY
      2. 14.2 Connecting to data sources
        1. 14.2.1 Using SOAP services
          1. SERVICE REFERENCES
          2. RECEIVING DATA WITH THE PROXY
          3. SENDING DATA USING THE PROXY
          4. USING COMPLEX DATA TYPES
          5. USING THE CONFIGURATION FILE
        2. 14.2.2 RESTful services
          1. BYPASSING THREADING PROBLEMS
          2. GETTING FROM REST SERVICES
          3. POSTING TO REST SERVICES
      3. 14.3 The client HTTP stack
        1. 14.3.1 Manually creating the client stack
        2. 14.3.2 Automatically using the client stack
        3. 14.3.3 Automatically setting the HTTP Referer and other headers
          1. REFERRING SITE HEADER
        4. 14.3.4 Authentication credentials
        5. 14.3.5 Managing cookies with the CookieContainer
      4. 14.4 Making the data usable
        1. 14.4.1 Reading POX
          1. SETTING UP
          2. XLINQ
          3. XMLREADER
          4. XMLSERIALIZER
        2. 14.4.2 Converting JSON
          1. JSONOBJECT
          2. DATACONTRACTJSONSERIALIZER
      5. 14.5 Using advanced services
        1. 14.5.1 WCF service enhancements
          1. ERROR HANDLING
        2. 14.5.2 WCF duplex services
          1. CONNECTING TO THE SERVICE
        3. 14.5.3 Connecting to sockets
          1. SERVING THE POLICY FILE
          2. OPENING THE CONNECTION
          3. HANDLING THE RESPONSE
        4. 14.5.4 Multicast sockets
          1. ANY SOURCE MULTICAST/INTERNET STANDARD MULTICAST
          2. SOURCE SPECIFIC MULTICAST
      6. 14.6 Connecting to other Silverlight applications
        1. 14.6.1 Creating the receiver
        2. 14.6.2 Creating the sender
        3. 14.6.3 Putting it all together
      7. 14.7 Summary
    5. 15. Navigation and dialogs
      1. 15.1 Browser navigation background
        1. 15.1.1 Browser journals
        2. 15.1.2 Anchor hashtags
        3. 15.1.3 Back and forth
      2. 15.2 The Navigation Application template
        1. 15.2.1 Creating a navigation application
        2. 15.2.2 Adding a new page
          1. ADDING THE NEW VIEW
          2. ADDING THE LINK TO THE TOP MENU
        3. 15.2.3 Changing the application theme
      3. 15.3 Navigating to pages
        1. 15.3.1 The Page class
          1. NAVIGATION VIRTUAL FUNCTIONS
        2. 15.3.2 The NavigationService class
        3. 15.3.3 Frames and URIs
          1. LOADING CONTENT WITH THE NAVIGATE METHOD
          2. URI MAPPING
          3. PASSING AND RECEIVING PAGE PARAMETERS
        4. 15.3.4 Caching pages
          1. PAGE CACHE SETTINGS
          2. FRAME CACHE SETTINGS
        5. 15.3.5 Navigating to pages in other assemblies
          1. URI SYNTAX
          2. ADDING THE ASSEMBLY
          3. MAPPING THE URI
          4. ADDING THE NAVIGATION MENU ITEM
      4. 15.4 Navigation out of the browser
        1. 15.4.1 Providing custom navigation controls
          1. CREATING THE NAVIGATION CONTROLS
          2. WIRING UP THE BUTTONS
          3. OUT OF BROWSER
          4. CONTROLLING THE JOURNAL
      5. 15.5 Showing dialogs and pop-ups
        1. 15.5.1 The Popup control
        2. 15.5.2 Displaying a dialog box with the ChildWindow control
          1. SHOWING THE CHILDWINDOW
          2. CUSTOMIZING THE CHILDWINDOW
        3. 15.5.3 Prompting for a file
          1. LAUNCHING THE DIALOG BOX
          2. RETRIEVING THE RESULTS
          3. READING THE RESULTS
      6. 15.6 Summary
    6. 16. Structuring and testing with the MVVM/ViewModel pattern
      1. 16.1 Project setup and traditional code-behind approach
        1. 16.1.1 Project and service setup
          1. WEB SERVICES
          2. EMPLOYEE LIST VIEW
          3. EMPLOYEE DETAIL VIEW
        2. 16.1.2 A typical code-behind solution
      2. 16.2 Model-View-ViewModel basics
        1. 16.2.1 Keep it simple: a basic ViewModel implementation
          1. BASE VIEWMODEL
          2. LIST PAGE VIEWMODEL
          3. UPDATED LIST VIEW XAML
          4. UPDATED LIST VIEW CODE-BEHIND
      3. 16.3 Factoring out reusable code
        1. 16.3.1 Business rules and logic
        2. 16.3.2 Data access and service calls
      4. 16.4 Better separation from the UI
        1. 16.4.1 Using commands
        2. 16.4.2 Using the CallMethodAction behavior
        3. 16.4.3 View-specific entities and ViewModels
        4. 16.4.4 Interfaces, IoC, and ViewModel locators
          1. INTERFACES AND IOC
          2. VIEWMODEL LOCATOR
      5. 16.5 Testing
        1. 16.5.1 Introduction to the Silverlight Unit Testing Framework
        2. 16.5.2 Testing the ViewModel
        3. 16.5.3 Testing asynchronous operations
      6. 16.6 Summary
    7. 17. WCF RIA Services
      1. 17.1 WCF RIA Services architecture, tooling, and template
        1. 17.1.1 RIA Services tooling support
        2. 17.1.2 Creating a project with the template
          1. APPLICATION RESOURCES
          2. OTHER DIFFERENCES
      2. 17.2 Exposing data with the domain service
        1. 17.2.1 Creating the domain service
        2. 17.2.2 Exposing the domain service to other clients
          1. EXPOSING AN ODATA ENDPOINT
          2. EXPOSING A JSON ENDPOINT
          3. EXPOSING A SOAP ENDPOINT
        3. 17.2.3 Domain service method types
          1. QUERY METHODS
          2. TYPES OF QUERY METHODS
          3. INSERT, UPDATE, AND DELETE METHODS
          4. NAMED UPDATE METHODS
          5. INVOKE METHODS
          6. IGNORING METHODS DESPITE THE NAME
        4. 17.2.4 Using a domain service from Silverlight
          1. CONNECTING VIA CODE
          2. USING THE DOMAINDATASOURCE CONTROL
      3. 17.3 Filtering, sorting, grouping, and paging
        1. 17.3.1 Filtering
          1. FILTER DESCRIPTORS EXPLAINED
          2. USING FILTER DESCRIPTORS WITH THE DOMAINDATASOURCE
        2. 17.3.2 Sorting
        3. 17.3.3 Grouping
        4. 17.3.4 Paging
          1. DATAPAGER PROPERTIES
      4. 17.4 Updating data
        1. 17.4.1 Using the DataForm UI
          1. SAVING CHANGES
        2. 17.4.2 The domain context
          1. INVOKE OPERATIONS
          2. SUBMITCHANGES
        3. 17.4.3 The Entity class
        4. 17.4.4 Using validation and display metadata
          1. CONTROLLING DISPLAY
          2. ADDING VALIDATION
      5. 17.5 Loose coupling: using presentation models
        1. 17.5.1 Creating the employee presentation model
        2. 17.5.2 Supporting query operations
          1. WIRING UP TO THE UI
        3. 17.5.3 Supporting update operations
        4. 17.5.4 Supporting insert operations
      6. 17.6 Business logic
        1. 17.6.1 Business logic in entities
        2. 17.6.2 Sharing code
          1. SHARED SOURCE FILES
          2. LINKED SOURCE FILES
          3. SHARED BINARIES
      7. 17.7 Authentication and authorization
        1. 17.7.1 Authentication
          1. FORMS-BASED AUTHENTICATION
          2. WINDOWS AUTHENTICATION
          3. REQUIRING AUTHENTICATION
        2. 17.7.2 Authorization
          1. ROLE-BASED AUTHORIZATION
      8. 17.8 Summary
  8. 3. Completing the experience
    1. 18. Graphics and effects
      1. 18.1 Shapes
        1. 18.1.1 Lines
        2. 18.1.2 Rectangle
        3. 18.1.3 Ellipse
        4. 18.1.4 Polyline
        5. 18.1.5 Polygon
      2. 18.2 Geometry
        1. 18.2.1 Simple geometries
        2. 18.2.2 Path geometries
        3. 18.2.3 Composite geometries
      3. 18.3 Brushes
        1. 18.3.1 SolidColorBrush
        2. 18.3.2 LinearGradientBrush
        3. 18.3.3 RadialGradientBrush
        4. 18.3.4 ImageBrush
        5. 18.3.5 VideoBrush
      4. 18.4 Effects
        1. 18.4.1 Using built-in effects
          1. BLUR EFFECT
          2. DROP SHADOW EFFECT
          3. TRICKS AND CONSIDERATIONS
        2. 18.4.2 Creating custom pixel shaders
          1. HOW PIXEL SHADERS WORK
          2. ENVIRONMENT SETUP
          3. SHADER CODE
          4. WRAPPER CLASS
          5. USING THE SHADER
      5. 18.5 Summary
    2. 19. Printing
      1. 19.1 How Silverlight printing works
        1. 19.1.1 The PrintDocument class
          1. PRINT METHOD
          2. PRINTEDPAGECOUNT PROPERTY
          3. THE BEGINPRINT AND ENDPRINT EVENTS
        2. 19.1.2 The PrintPage Event
          1. PAGEMARGINS AND PRINTABLEAREA PROPERTIES
          2. HASMOREPAGES PROPERTY
          3. PAGEVISUAL PROPERTY
        3. 19.1.3 Rasterization
      2. 19.2 Printing onscreen Information
        1. 19.2.1 Printing the content as is
        2. 19.2.2 Rerooting the elements to fit
        3. 19.2.3 Scaling content to fit
      3. 19.3 Multipage printing dedicated trees
        1. 19.3.1 Prerequisites
          1. CREATING THE SERVICE
          2. CREATING THE EMPLOYEEREPORTITEM CLASS
          3. ADDING THE SERVICE IMPLEMENTATION
          4. ADDING A REFERENCE TO THE SERVICE
          5. TEST THE SERVICE
        2. 19.3.2 Printing line items
          1. CREATING THE EMPLOYEEREPORT CLASS AND LOADING DATA
          2. ADDING THE ITEMTEMPLATE
          3. THE PRINT METHOD
          4. ENUMERATING ROWS
        3. 19.3.3 Adding multipage support
        4. 19.3.4 Adding a header and footer
      4. 19.4 Summary
    3. 20. Displaying and capturing media
      1. 20.1 Audio and video
        1. 20.1.1 Media source
          1. SUPPORTED FORMATS
          2. SMOOTH STREAMING WITH IIS
          3. WINDOWS MEDIA STREAMING
          4. PROGRESSIVE DOWNLOAD
        2. 20.1.2 Common properties
          1. AUTOPLAY
          2. CANPAUSE
          3. CURRENTSTATE
          4. NATURALDURATION
          5. POSITION
        3. 20.1.3 Audio specific properties
          1. AUDIOSTREAMCOUNT/AUDIOSTREAMINDEX
          2. BALANCE
          3. ISMUTED
          4. VOLUME
        4. 20.1.4 Video specific properties
        5. 20.1.5 The lifecycle of a media file
      2. 20.2 Playlists
        1. 20.2.1 Understanding client-side playlists
          1. USING ASX FILES
          2. ACCESSING THE METADATA
        2. 20.2.2 Using server-side playlists
          1. CREATING WSX FILES
          2. REFERENCING SERVER-SIDE PLAYLISTS
      3. 20.3 Interactive playback
        1. 20.3.1 Controlling the play state
        2. 20.3.2 Working with the timeline
      4. 20.4 Using protected content
        1. 20.4.1 Requesting protected content
        2. 20.4.2 Retrieving the PlayReady components
        3. 20.4.3 Unlocking protected content
      5. 20.5 Using the Silverlight Media Framework
        1. 20.5.1 Using the player libraries
        2. 20.5.2 Creating the player
      6. 20.6 Working with raw media
        1. 20.6.1 A custom MediaStreamSource class
        2. 20.6.2 Creating raw video
          1. SETTING UP THE VIDEO STREAM
          2. RETURNING THE SAMPLE
        3. 20.6.3 Creating raw audio
          1. SETTING UP THE WAV MEDIA SOURCE
          2. CREATING SOUND SAMPLES
      7. 20.7 Using the webcam
        1. 20.7.1 Gaining access to capture devices
          1. CHANGING THE DEFAULT CAPTURE DEVICE
        2. 20.7.2 Working with video
          1. SETTING THE DESIRED VIDEO FORMAT
        3. 20.7.3 Capturing still images
        4. 20.7.4 Getting the raw video data
        5. 20.7.5 A note about audio
      8. 20.8 Summary
    4. 21. Working with bitmap images
      1. 21.1 Basic imaging
      2. 21.2 Creating images at runtime
        1. 21.2.1 Creating from existing images
        2. 21.2.2 Creating from UI elements
          1. DIRECT PIXEL ACCESS
        3. 21.2.3 A Mandelbrot fractal generator
      3. 21.3 Deep Zoom
        1. 21.3.1 Showing an image
        2. 21.3.2 Zooming in and out
        3. 21.3.3 Managing the viewport
        4. 21.3.4 Deploying multiscale images
      4. 21.4 Dealing with dead space
        1. 21.4.1 Filling the space
        2. 21.4.2 Uniform sizing
        3. 21.4.3 Fill the area
        4. 21.4.4 UniformToFill
      5. 21.5 Summary
    5. 22. Animation and behaviors
      1. 22.1 Animation: it's about time
      2. 22.2 Mastering the timeline
        1. 22.2.1 What type of property are you animating?
          1. DOUBLEANIMATION
          2. POINTANIMATION
          3. COLORANIMATION
        2. 22.2.2 Where are you starting from and where are you going?
          1. WHERE IS THE ANIMATION COMING FROM?
          2. WHERE AM I GOING?
          3. HOW AM I GOING TO GET THERE?
        3. 22.2.3 How long should the animation run?
          1. HOW LONG?
          2. THROTTLING THE ANIMATION
          3. PLAY IT AGAIN
          4. TURN IT AROUND
          5. HOW WILL IT END?
          6. FROM THE TOP
      3. 22.3 Storyboarding
        1. 22.3.1 Understanding the storyboard
        2. 22.3.2 Hitting the target
        3. 22.3.3 Controlling the Storyboard
        4. 22.3.4 Being resourceful
          1. STORYBOARD AS A RESOURCE
          2. STORYBOARD AS A TRIGGER
      4. 22.4 Keyframing
        1. 22.4.1 Interpolation: it's about acceleration
          1. LINEAR INTERPOLATION
          2. SPLINE INTERPOLATION
          3. DISCRETE INTERPOLATION
          4. KEYTIME
      5. 22.5 Easing functions
        1. 22.5.1 Using easing functions
        2. 22.5.2 Creating a custom easing function
          1. EASINGFUNCTIONBASE
          2. EASEINCORE
      6. 22.6 Behaviors, triggers, and actions
        1. 22.6.1 Using existing behaviors
          1. USING THE FLUIDMOVEBEHAVIOR
        2. 22.6.2 Creating your own behavior
      7. 22.7 Summary
    6. 23. Resources, styles, and control templates
      1. 23.1 Being resourceful
        1. 23.1.1 Declarative resources
          1. DEFINING DECLARATIVE RESOURCES
          2. ALL ABOUT SCOPE
          3. MERGING RESOURCE DICTIONARIES
          4. USING DECLARATIVE RESOURCES AT RUNTIME
        2. 23.1.2 Accessing loose resources
          1. REFERENCING RELATIVE LOOSE RESOURCES
          2. RETRIEVING LOOSE RESOURCES WITH AN ABSOLUTE URI
        3. 23.1.3 Bundled resources
          1. USING CONTENT FILES
          2. USING EMBEDDED FILES
      2. 23.2 Giving your elements style
        1. 23.2.1 Defining the look
          1. SETTING SIMPLE PROPERTY VALUES
          2. SETTING COMPLEX PROPERTY VALUES
        2. 23.2.2 Explicitly keyed style definitions
        3. 23.2.3 Implicit style definitions
      3. 23.3 Creating templates
        1. 23.3.1 Building a control template
          1. CONSIDERING CONTROL PROPERTIES
          2. DISPLAYING THE CONTENT
          3. CONTROLLING ITEM ARRANGEMENT
        2. 23.3.2 Creating reusable templates
      4. 23.4 Dealing with visual states
        1. 23.4.1 Understanding the components
          1. STATES
          2. TRANSITIONS
          3. PARTS
        2. 23.4.2 Leveraging the VisualStateManager
          1. CREATING STATE-BASED EFFECTS
          2. DEFINE TRANSITIONING EFFECTS
      5. 23.5 Sharing your visual states
      6. 23.6 Summary
    7. 24. Creating panels and controls
      1. 24.1 Creating a custom panel
        1. 24.1.1 Project setup
        2. 24.1.2 The OrbitPanel class
        3. 24.1.3 Properties
          1. ORBITS DEPENDENCY PROPERTY
          2. ORBIT ATTACHED PROPERTY
        4. 24.1.4 Custom layout
          1. TEST MARKUP
        5. 24.1.5 Enhancements
          1. START AND STOP ANGLES
          2. DEFINING ORBITS
          3. ITEM CLIPPING
      2. 24.2 Creating a custom control
        1. 24.2.1 Choosing the base type
        2. 24.2.2 Properties
        3. 24.2.3 The control template contract
        4. 24.2.4 The default template
        5. 24.2.5 Visual states
        6. 24.2.6 Visual states in template
          1. TESTING
      3. 24.3 Summary
    8. 25. The install experience and preloaders
      1. 25.1 Handling the "Silverlight not installed" scenarios
        1. 25.1.1 Creating your own install experience
          1. ALWAYS GRABBING THE LATEST PLUG-IN
          2. HANDLING THE VERSION-UPGRADE SCENARIO
      2. 25.2 Using a custom preloader
        1. 25.2.1 Creating the appearance
        2. 25.2.2 Integrating the custom splash screen
        3. 25.2.3 Monitoring the load progress
      3. 25.3 Summary
  9. A. Database, connection, and data model setup
    1. A.1 Install the AdventureWorks database
      1. A.1.1 Installing on a dedicated SQL Server instance
      2. A.1.2 Installing on SQL Server Express
    2. A.2 Database connection and entities
      1. A.2.1 Choosing the entities to create