Reading an XML file
Apart from writing XML files, it is also possible to read content from such files. It can be done with the use of similar classes. You will learn how to do it in this recipe.
As an example, you will modify the project from the previous recipe by adding a Load button. Once you click on it, the content from the XML file is parsed. Then, the read data of the events are presented in the application.
Getting ready
To step through this recipe, you need the project from the previous recipe.
How to do it...
To modify the example from the preceding recipe to support loading data of various events from an XML-formatted file, perform the following steps:
Add the Load button to the page by modifying the content of the
MainPage.xaml
file as follows:<Page (...)> <Grid> (...) <Grid Grid.Row="9" Grid.Column="1"> (...) <Button Grid.Column="0" Content="Save" ...