I’m practicing my programming skills on an app that has a pivot page with seven pivot items. Each item has five buttons. I want those buttons to lead the user to the same page but with different content depending on which button was pressed. I know that I have to use XML parsing to achieve this but I just don’t know where to start.
The idea is to have one application page and parse the right image and audio file to it depending on what button was pressed on the pivot page.
Here’s an example of the XML:
<?xml version="1.0" encoding="utf-8" ?>
<Exercises>
<Exercise name = "Exercise 1">
<image>/Images/ex1.jpg</image>
<audio>/Audio/ex1.mp3</audio>
</Exercise>
<Exercise name = "Exercise 2">
<image>/Images/ex2.jpg</image>
<audio>/Audio/ex2.mp3</audio>
</Exercise>
<Exercise name = "Exercise 3">
<image>/Images/ex3.jpg</image>
<audio>/Audio/ex3.mp3</audio>
</Exercise>
<Exercise name = "Exercise 4">
<image>/Images/ex4.jpg</image>
<audio>/Audio/ex4.mp3</audio>
</Exercise>
<Exercise name = "Exercise 5">
<image>/Images/ex5.jpg</image>
<audio>/Audio/ex5.mp3</audio>
</Exercise>
</Exercises>
I am not sure where exactly you’re stuck.
One SIMPLE process to achieve this is:
Tag. Use a single event handler forClickon all buttons, then depending on what(sender as Button).Taggives you,Navigateby adding appropriate values to the query parameters.audioandimageusing the exercise values which you can collect byNavigationContext.QueryString["exercise"], or whatever you named your query parameter.I hope this helps you get started. Of course, there are many better approaches to this. Questions with the code that you tried will help you get specific responses.