In this recipe, we shall explore how to serialize an object and then deserialize the XML back to an object.
Open a new Phone 7 application project and save it as
Recipe5_SerializeXml. Press F5 and make sure it compiles without any errors.
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.
MainPage.xamlfile; 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> ...