Book Image

Windows Phone 7.5 Data Cookbook

By : Ramesh Thalli
Book Image

Windows Phone 7.5 Data Cookbook

By: Ramesh Thalli

Overview of this book

Windows Phone 7.5 Mango contains support for apps written in Silverlight or XNA. These apps can store data on the device, and also load and manipulate data from "the cloud" and other web services.This Windows Phone 7.5 Data Cookbook has a range of recipes to help you apply data handling concepts. You will be able to apply the knowledge gained from these recipes to build your own apps effectively. This Windows Phone 7.5 Data Cookbook starts with data binding concepts at the UI layer and then shows different ways of saving data locally and externally in databases. The book ends with a look at the popular MVVM software design pattern. The recipes contained in this book will make you an expert in the areas of data access and storage.
Table of Contents (15 chapters)
Windows Phone 7.5 Data Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Opening a local XML file


In this recipe let's try to open an XML file saved in the local application folder. We will make use of the XDocument parse method for opening the XML file. LINQ to XML is the best and the easiest way to navigate the XML for Silverlight applications. LINQ to XML replaced the XSLT transformation in C#.

Getting ready

For this recipe let's create a new project named Recipe1_LinqToXml under the solution folder named Ch3_Recipes. We will use this solution for all our samples in this chapter. Change the Application Name in the MainPage.xaml to LINQToXML. Press F5 and run to make sure you have no errors.

How to do it...

In the following steps we will create an XML file with sample data for our testing purposes and then we will load the results of the LINQ to SQL query into a list box control to be displayed on the screen.

  1. Open the MainPage.xaml.cs file and add the assembly reference for accessing isolated storage, which is System.IO.IsolatedStorage. As we are going to use XML...