Viewers: in countries Watching now:
Discover how to build professional apps that encompass the 17 major feature areas of Windows Phone, from XAML to multimedia to network access. In this course, author Michael Lehman details the standard hardware device configuration, teaches how to navigate the development environment, and explores the Windows Phone APIs. The course shows how to build sample applications while learning Windows Phone concepts and frameworks, including the Metro design language.
So we still have to update the standard pivot template XAML and code to put in our all and favorites list and bring it all together so that we can actually run this puppy. So let's do that. Come here to the Solution we'll open up the MainPage.xaml, and we'll substitute our version of this and then take a look at it. You can see we've titled our pivot control SONNETS PLUS, and we have set the title of our first PivotItem to all.
And we've bound that particular thing to the items collection of our main ViewModel, and we use the FirstListBox_SelectionChanged handler to handle tabs in the all list. If we go look at the second PivotItem, here is our second PivotItem, and it is titled favorites, and we bound it to the FavoriteItems collection on our MainView model, and we have a SecondListBox_SelectionChanged event handler to handle tabs in the favorites list. If we go over here to the code, let's take a look at what we changed here.
So here's our FirstListBox_Selection handler. This looks just like the ListBox_ SelectionChanged in the basic sonnets app. And you see that we just pass selectedItem as a query parameter to our DetailsPage. That indicates that this came from the all list. If we look at the SecondListBox_SelectionChanged event handler, you'll see that we not only interact with the SecondListBox, and we pass the selectedItem, you see we've added this fromFavorites query parameter so that the DetailsPage knows to retrieve the selectedItem from the favorite items collection on the main ViewModel, not the items collection on the main ViewModel.
And that's it, of course we have our About _Click as we had in the main sonnets app. We are ready to rock and roll. Let's save all this and see it in action. All right, there we go. Here's our pivot control. You can see we've got two lists on our pivot, here is our list of 154 sonnets. Here is our list of our favorites which has nothing in it right now. So let's go down and pick our favorite sonnet, once again to a summer's day.
And you can see we now have the word sonnet, and we've got the Roman numerals for the sonnet, and this isn't favorite yet, because there is no gold star. We tap the app bar icon, and look now there is a gold star, and when we go back, we'll see of course it still remains in the all list, but now the favorites list has our favorite sonnet in it. Let's go back to the all list and pick a couple of others, add them as favorites. And if you go over to our favorites list, you can now see we've got three favorites.
Well, let's say that sonnet XIII, we've just fallen out in love with you, it just doesn't speak to us anymore. We come back over here, we click the toggle favorites button, the gold star goes away, and when we go back to the list, it's gone. Just the way we want it. What we've seen here is that we have now a way of dealing not only with persistent data, in this case we use a flat XML file inside isolated storage. We also have seen how we can show multiple views on the same list using the pivot control, and we've shown how we can use query parameters being passed to a page to change the behavior of the page, in this case the way the DetailsPage determines whether it picks up the selected sonnet from the favorites list or from the all list.
We're done with flat files and isolated storage. Next up we are going to convert this same app to work with a database in isolated storage, which will be slightly different because we don't have to read and write the entire thing, we can update an individual sonnet one at a time.
Find answers to the most frequently asked questions about Windows Phone SDK Essential Training .
Here are the FAQs that matched your search "" :
Sorry, there are no matches for your search "" —to search again, type in another word or phrase and click search.
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.