O'Reilly logo

Windows Phone 7.5 Data Cookbook by Ramesh Thalli

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

Object serialization to XML

In this recipe, we shall explore how to serialize an object and then deserialize the XML back to an object.

Getting ready

Open a new Phone 7 application project and save it as Recipe5_SerializeXml. Press F5 and make sure it compiles without any errors.

How to do it...

In the following steps, we will create sample data to save and serialize it to XML. We will then open it using the deserialize method and then display it in a list box.

  1. Open the MainPage.xaml file; add a button to trigger the saving and opening of the serialization. The XAML should look like the following code snippet:
    <Grid x:Name="LayoutRoot" Background="Transparent"> <Grid.RowDefinitions> <RowDefinition Height="Auto"/> <RowDefinition Height="*"/> </Grid.RowDefinitions> ...

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