O'Reilly logo

Professional Silverlight® 4 by Bill Evjen, Jason Beres, Devin Rader

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 7. Accessing Data

WHAT'S IN THIS CHAPTER?

  • Working with XML using LINQ and the XmlReader object

  • Working with data binding and user interfaces

  • Dealing with data when it changes

  • Communicating with services (REST, WCF)

One of the most prominent and compelling aspects of rich Internet applications is unfettered access to data. Therefore, it should be no surprise that Silverlight provides a rich, pervasive model that allows you to create dynamic data-driven applications. Silverlight provides a host of facilities for retrieving, displaying, manipulating, and storing data from a variety of data sources.

If you are accustomed to using classes within System.Data to query databases directly, you are in for a rude surprise with Silverlight, because none of these services are available. This chapter looks at how you can use Silverlight to deal with services, both ASP.NET Web Services and the newer Windows Communication Foundation services.

This chapter also looks at dealing with XML, data binding, and RESTful-based services — starting with working with XML.

Note

WCF RIA Services is covered in Chapter 8.

PROCESSING XML DATA

Although a developer might actually enjoy seeing XML presented directly in an application, it is far more likely that you will need to massage the XML data into some strongly typed objects that will be presented to the user. For instance, you would probably not want to expose the end user to the raw XML presented in Listing 7-1.

Example 7-1. Raw XML

<?xml version="1.0" encoding="utf-8" ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required