PacktLib: Microsoft Silverlight 5 Data and Services Cookbook

Microsoft Silverlight 5 Data and Services Cookbook


About the Authors

About the Reviewers


Learning the Nuts and Bolts of Silverlight 5


Getting our environment ready to start building Silverlight applications

Creating our first service-enabled and data-driven Silverlight 5 application using Visual Studio 2010

Using the workflow between Visual Studio 2010 and Blend 5

Using source control in Visual Studio 2010 and Blend 5

Deploying a Silverlight application on the server

An Introduction to Data Binding


Displaying data in Silverlight applications

Creating dynamic bindings

Binding data to another UI element

Binding collections to UI elements

Enabling a Silverlight application to automatically update its UI

Obtaining data from any UI element it is bound to

Using the different modes of data binding to allow persisting data

Debugging data binding expressions in Visual Studio

Data binding from Expression Blend 5

Using Expression Blend 5 for sample data generation

Advanced Data Binding


Hooking into the data binding process

Replacing converters with Silverlight 5 BindingBase properties

Validating data-bound input

Validating data input using attributes

Validating using IDataErrorInfo and INotifyDataErrorInfo

Using templates to customize the way data is shown by controls

Using implicit data templates

Using the Ancestor RelativeSource binding

Creating custom markup extensions

Building a change-aware collection type

Combining converters, data binding, and DataContext into a custom DataTemplate

The Data Grid


Displaying data in a customized DataGrid

Inserting, updating, and deleting data in a DataGrid

Sorting and grouping data in a DataGrid

Filtering and paging data in a DataGrid

Using custom columns in the DataGrid

Implementing master-detail in the DataGrid

Validating the DataGrid

Working with Local Data


Reading data from and storing data in the isolated storage

Working with IsolatedStorageSettings

Caching data between different Silverlight applications using isolated storage

Using the Sterling database



Creating a basic MVVM application

Using MVVM Light to enable MVVM applications

Connecting a View to a ViewModel using a ViewModelLocator

Connecting a View to a ViewModel using MEF

Using commands to pass your events to the ViewModel

Communicating between different ViewModels

Leveraging a messenger to wrap application-wide messages

Working with Services


Connecting and reading from a standardized service

Persisting data using a standardized service

Configuring cross-domain calls

Working cross-domain from a trusted Silverlight application

Reading XML using HttpWebRequest

Reading out an RSS feed

Accessing a database in the cloud

Accessing a service in the cloud

Running a Silverlight application from the cloud

Using socket communication in Silverlight

Talking to WCF and ASMX Services


Invoking a service that exposes data

Invoking a service such as

Optimizing performance using binary XML

Debugging a service in Silverlight

Using ASP.NET Authentication in Silverlight

Uploading files to a WCF service

Displaying images as a stream from a WCF service

Talking to WCF and ASMX Services—One Step Beyond


Using duplex communication over HTTP

Using duplex communication with the WCF net.tcp binding

Ensuring data is encrypted

Securing service communication using message-based security

Integrating Windows Identity Foundation in Silverlight

Calling a WCF service from Silverlight using ChannelFactory

Talking to REST and WCF Data Services


Reading data from a REST service

Parsing REST results with LINQ To XML

Persisting data using a REST service

Working with the ClientHttp stack

Communicating with a REST service using JSON

Using WCF Data Services with Silverlight

Reading data using WCF Data Services

Persisting data using WCF Data Services

Talking to Flickr

Talking to Twitter over REST

Passing credentials and cross-domain access to Twitter from a trusted Silverlight application

Using WCF RIA Services


Setting up a data solution to work with WCF RIA Services

Using a WCF RIA Services class library

Getting data on the client

Using LoadBehavior to control what happens to your data once it's sent to the client

Controlling the server-side query from the client

Sorting and filtering data on the server

Paging through your data

Persisting a change set/unit of work

Working with concurrency and transactions

Advanced WCF RIA Services


Tracking a user's identity default Windows authentication

Tracking a user's identity — a custom authentication service

Integrating Windows Identity Foundation with WCF RIA Services

Controlling a user's access to services and service methods

Validating data: using data annotations

Validating data: writing a custom validator

Validating data: server-side validation with client-side feedback

Validating data: triggering validation when needed

Validating data: using the ValidationContext

Handling errors on the server

Using SQL Azure with WCF RIA Services

Exposing WCF RIA Domain Services as OData endpoints

Exposing WCF RIA Domain Services for other technologies

Windows Phone 7


Getting our environment ready to start building Windows Phone 7 applications

Building your first data-driven Windows Phone 7 application

Getting data on your Windows phone 7 using WCF

Accessing REST services from Windows Phone 7 using XML

Accessing REST services from Windows Phone 7 using JSON

Working with push notifications using the cloud

Storing data in a local SQL CE database

Using the background transfer service