PacktLib: Microsoft Silverlight 4 Data and Services Cookbook

Silverlight 4 Data and Services Cookbook


About the authors

About the reviewers


Learning the Nuts and Bolts of Silverlight 4


Getting our environment ready to start developing Silverlight applications

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

Using the workflow between Visual Studio 2010 and Blend 4

Using source control in Visual Studio 2010 and Blend 4

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

Data binding from Expression Blend 4

Using Expression Blend 4 for sample data generation

Advanced Data Binding


Hooking into the data binding process

Replacing converters with Silverlight 4 BindingBase properties

Validating databound input

Validating data input using attributes

Validating using IDataErrorInfo and INotifyDataErrorInfo

Using templates to customize the way data is shown by controls

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

The DataForm


Displaying and editing an object using the DataForm

Displaying and editing a collection using the DataForm

Customizing the DataForm using Data Annotations

Customizing the DataForm using a custom DataTemplate

Customizing the DataForm template

Validating the DataForm

Talking to 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

Aggregating RSS feeds

Talking with services in the Windows Azure cloud

Persisting data to and reading data from the Windows Azure cloud

Using socket communication in Silverlight

Talking to WCF and ASMX Services


Invoking a service that exposes data

Invoking a service such as

Handling faults when calling a service

Optimizing performance using binary XML

Using duplex communication

Using duplex communication with the WCF net.tcp binding

Debugging a service in Silverlight

Ensuring data is encrypted

Securing service communication using message-based security

Uploading files to a WCF service

Displaying images as a stream from a WCF service

Hooking into proxy creation using slsvcutil.exe

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 ClientHttpStack

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

Talking to WCF RIA Services


Setting up a data solution to work with RIA Services

Getting data on the client

Sorting and filtering data

Persisting data to the server

Persisting a Unit of Work/changeset

Working with concurrency and transactions

Tracking a user's identity

Controlling a user's access to a service and service methods

Validating data using data annotations

Validating data using shared code

Using the DomainDataSource

Using the DomainDataSource to page through data

Sorting, filtering, and grouping data using the DomainDataSource

Converting Your Existing Applications to Use Silverlight


Calling a stored procedure from Silverlight

Working with LINQ to SQL from Silverlight

Working with the Entity Framework from Silverlight

Converting a Silverlight application to use WCF RIA Services

Using ASP.NET Authentication in Silverlight

Using ASP.NET Roles in Silverlight

Using ASP.NET Profiles in Silverlight