{"id":683,"date":"2011-02-28T03:56:00","date_gmt":"2011-02-28T03:56:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/vbteam\/2011\/02\/28\/visual-basic-windows-phone-7-series-4-how-to-implement-a-model-view-viewmodel-pattern-in-a-windows-phone-application\/"},"modified":"2024-07-05T12:40:26","modified_gmt":"2024-07-05T19:40:26","slug":"visual-basic-windows-phone-7-series-4-how-to-implement-a-model-view-viewmodel-pattern-in-a-windows-phone-application","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/vbteam\/visual-basic-windows-phone-7-series-4-how-to-implement-a-model-view-viewmodel-pattern-in-a-windows-phone-application\/","title":{"rendered":"Visual Basic Windows Phone 7 Series #4. How to implement a model-view-viewmodel pattern in a Windows Phone application"},"content":{"rendered":"<p><span style=\"font-size: small\">In our <\/span><a href=\"http:\/\/blogs.msdn.com\/b\/vbteam\/archive\/2011\/02\/26\/visual-basic-windows-phone-7-series-how-to-create-a-custom-indeterminate-progress-bar-application-for-windows-phone-7.aspx\"><span style=\"font-size: small\">last post<\/span><\/a><span style=\"font-size: small\">, I explained how to create a custom indeterminate progress bar application for Windows Phone 7. In this blog, I want to share a sample that will help you to implement a model-view-viewmodel pattern in a Windows Phone application. A model-view-viewmodel pattern is used to separate data from the user interface. This pattern allows the developers to code data models and the designers to create user interfaces. In this sample, I will demonstrate how to create a game tracker application by implementing the model-view-viewmodel pattern.<\/span><\/p>\n<p><span style=\"font-size: small\">I will now demonstrate how easy it is to implement the model-view-viewmodel pattern in a Windows Phone application, using Visual Basic for Windows Phone Developer Tools. The model-view-viewmodel pattern can be implemented in 8 simple steps as follows:<\/span><\/p>\n<ol>\n<li><span style=\"font-size: small\">Create a sample application <\/span><\/li>\n<li><span style=\"font-size: small\">Create a data model, a viewmodel, and two views <\/span><\/li>\n<li><span style=\"font-size: small\">Create the main application page <\/span><\/li>\n<li><span style=\"font-size: small\">Maintain the page state <\/span><\/li>\n<li><span style=\"font-size: small\">Save the data to isolated storage <\/span><\/li>\n<li><span style=\"font-size: small\">Add the application bar <\/span><\/li>\n<li><span style=\"font-size: small\">Build and debug the application <\/span><\/li>\n<li><span style=\"font-size: small\">Rebuild in the release mode before publishing <\/span><\/li>\n<\/ol>\n<p><i><span style=\"font-size: small\">Prerequisites:<\/span><\/i><\/p>\n<ul>\n<\/ul>\n<ul>\n<\/ul>\n<ul>\n<\/ul>\n<ul>\n<li><span style=\"font-size: small\"><i>Visual Studio 2010 Professional, Premium,\nor Ultimate. If you do not have any of the releases, you can download any of\nthe following trial versions as per your preference: <\/i><a href=\"http:\/\/www.microsoft.com\/downloads\/en\/details.aspx?FamilyID=26bae65f-b0df-4081-ae6e-1d828993d4d0&amp;displaylang=en\"><i>Professional<\/i><\/a><i>, <\/i><a href=\"http:\/\/www.microsoft.com\/downloads\/en\/details.aspx?FamilyID=7038e207-329c-4006-b620-16d1af1c42c1&amp;displaylang=en\"><i>Premium<\/i><\/a><i>, or <\/i><a href=\"http:\/\/www.microsoft.com\/downloads\/en\/details.aspx?FamilyID=e2a1a098-995e-4468-816d-7fdbe0a64f38&amp;displaylang=en\"><i>Ultimate<\/i><\/a><i>.<\/i><\/span><\/li>\n<li><span style=\"font-size: small\"><a href=\"http:\/\/www.microsoft.com\/downloads\/en\/details.aspx?FamilyID=04704acf-a63a-4f97-952c-8b51b34b00ce&amp;displaylang=en\"><i>Windows Phone Developer Tools\nRTW<\/i><\/a><\/span><\/li>\n<li><span style=\"font-size: small\"><a href=\"http:\/\/www.microsoft.com\/downloads\/en\/details.aspx?FamilyID=4e97ea70-e479-4c05-814f-639d71690e5d&amp;displaylang=en\"><i>Visual Basic\nfor Windows Phone Developer Tools &#8211; RTW<br \/><\/i><\/a><em>&nbsp;<\/em><\/span><span style=\"font-size: small\"><em>Note: You can install the newer version- <\/em><em><a href=\"http:\/\/www.microsoft.com\/downloads\/en\/details.aspx?FamilyID=77586864-ab15-40e1-bc38-713a95a56a05&amp;displaylang=en\">Windows Phone Developer Tools 7.1 Beta<\/a>\n instead of the above mentioned two tools as it will take comparatively\nless time. However, this sample was created using the previous version.<\/em><\/span><\/li>\n<\/ul>\n<ul>\n<\/ul>\n<ul>\n<\/ul>\n<p><span style=\"font-size: small\">To implement the model-view-viewmodel pattern in a Windows Phone application, let&rsquo;s follow the 8 simple steps mentioned earlier:<\/span><\/p>\n<h3>Step 1 &#8211; Create a sample application<\/h3>\n<ol>\n<li><span style=\"font-size: small\">Create a new project and browse to the &ldquo;Silverlight for Windows Phone&rdquo; node. <\/span><\/li>\n<li><span style=\"font-size: small\">Select the &ldquo;Windows Phone Application&rdquo; template. <\/span><\/li>\n<li><span style=\"font-size: small\">Enter a name for the application. <br \/><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/vbteam\/wp-content\/uploads\/sites\/7\/2011\/02\/1184.Select_App.bmp\" border=\"0\" \/><\/span><\/li>\n<li><span style=\"font-size: small\">Click OK. The MainPage.xaml page is displayed. <br \/><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/vbteam\/wp-content\/uploads\/sites\/7\/2011\/02\/1638.App_Init.bmp\" border=\"0\" \/><\/span><\/li>\n<\/ol>\n<h4><\/h4>\n<h3>Step 2 &#8211; Create a data model, a viewmodel, and two views<\/h3>\n<h4>Create a data model<\/h4>\n<ol>\n<li><span style=\"font-size: small\">In Solution Explorer, right-click the application name and add a new folder. <\/span><\/li>\n<li><span style=\"font-size: small\">Rename the new folder as &ldquo;Model&rdquo;. <\/span><\/li>\n<li><span style=\"font-size: small\">Right-click the Model folder, and then add a class. The Add New Item dialog box is displayed. <\/span><\/li>\n<li><span style=\"font-size: small\">Enter the name for the class as &ldquo;Accomplishment.vb&rdquo;, and then click Add. The Accomplishment.vb page is displayed. <\/span><\/li>\n<li><span style=\"font-size: small\">Replace the code with the following code: \n<div id=\"codeSnippetWrapper\" style=\"text-align: left;line-height: 12pt;background-color: #f4f4f4;margin: 20px 0px 10px;width: 95.26%;font-family: 'Courier New', courier, monospace;direction: ltr;height: 67px;max-height: 200px;font-size: 8pt;overflow: auto;cursor: text;border: silver 1px solid;padding: 4px\">\n<div id=\"codeSnippet\" style=\"text-align: left;line-height: 12pt;background-color: #f4f4f4;width: 100%;font-family: 'Courier New', courier, monospace;direction: ltr;height: 22px;color: black;font-size: 8pt;overflow: visible;border-style: none;padding: 0px\">\n<pre style=\"text-align: left;line-height: 12pt;background-color: white;margin: 0em;width: 100%;font-family: 'Courier New', courier, monospace;direction: ltr;color: black;font-size: 8pt;overflow: visible;border-style: none;padding: 0px\"><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">Imports<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"> System.ComponentModel<\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">Public<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"> <span style=\"color: blue\">Class<\/span> <span style=\"color: #2b91af\">Accomplishment<\/span><\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">Implements<\/span> <span style=\"color: #2b91af\">INotifyPropertyChanged<\/span><\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: green\">' The name of the accomplishment.<\/span><\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">Public<\/span> <span style=\"color: blue\">Property<\/span> Name <span style=\"color: blue\">As<\/span> <span style=\"color: blue\">String<\/span><\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\">&nbsp;<\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: green\">' The type of the accomplishment, Item or Level.<\/span><\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">Public<\/span> <span style=\"color: blue\">Property<\/span> Type <span style=\"color: blue\">As<\/span> <span style=\"color: blue\">String<\/span><\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\">&nbsp;<\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: green\">' The number of each item that has been collected.<\/span><\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">Private<\/span> _count <span style=\"color: blue\">As<\/span> <span style=\"color: blue\">Integer<\/span><\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">Public<\/span> <span style=\"color: blue\">Property<\/span> Count <span style=\"color: blue\">As<\/span> <span style=\"color: blue\">Integer<\/span><\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">Get<\/span><\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">Return<\/span> _count<\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">End<\/span> <span style=\"color: blue\">Get<\/span><\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">Set<\/span>(<span style=\"color: blue\">ByVal<\/span> value <span style=\"color: blue\">As<\/span> <span style=\"color: blue\">Integer<\/span>)<\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>_count = value<\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span>&nbsp;&nbsp;&nbsp;<\/span>RaisePropertyChanged(<span style=\"color: #a31515\">\"Count\"<\/span>)<\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">End<\/span> <span style=\"color: blue\">Set<\/span><\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">End<\/span> <span style=\"color: blue\">Property<\/span><\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\">&nbsp;<\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: green\">' Whether a level has been completed or not<\/span><\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">Private<\/span> _completed <span style=\"color: blue\">As<\/span> <span style=\"color: blue\">Boolean<\/span><\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">Public<\/span> <span style=\"color: blue\">Property<\/span> Completed <span style=\"color: blue\">As<\/span> <span style=\"color: blue\">Boolean<\/span><\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">Get<\/span><\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">Return<\/span> _completed<\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">End<\/span> <span style=\"color: blue\">Get<\/span><\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">Set<\/span>(<span style=\"color: blue\">ByVal<\/span> value <span style=\"color: blue\">As<\/span> <span style=\"color: blue\">Boolean<\/span>)<\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>_completed = value<\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>RaisePropertyChanged(<span style=\"color: #a31515\">\"Completed\"<\/span>)<\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">End<\/span> <span style=\"color: blue\">Set<\/span><\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">End<\/span> <span style=\"color: blue\">Property<\/span><\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\">&nbsp;<\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">Public<\/span> <span style=\"color: blue\">Event<\/span> PropertyChanged <span style=\"color: blue\">As<\/span> <span style=\"color: #2b91af\">PropertyChangedEventHandler<\/span> <span style=\"color: blue\">Implements<\/span> <span style=\"color: #2b91af\">INotifyPropertyChanged<\/span>.PropertyChanged<\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\">&nbsp;<\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">Private<\/span> <span style=\"color: blue\">Sub<\/span> RaisePropertyChanged(<span style=\"color: blue\">ByVal<\/span> propertyName <span style=\"color: blue\">As<\/span> <span style=\"color: blue\">String<\/span>)<\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">RaiseEvent<\/span> PropertyChanged(<span style=\"color: blue\">Me<\/span>, <span style=\"color: blue\">New<\/span> <span style=\"color: #2b91af\">PropertyChangedEventArgs<\/span>(propertyName))<\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">End<\/span> <span style=\"color: blue\">Sub<\/span><\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\">&nbsp;<\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: green\">' Create a copy of an accomplishment to save.<\/span><\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: green\">' If your object is databound, this copy is not databound.<\/span><\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">Public<\/span> <span style=\"color: blue\">Function<\/span> GetCopy() <span style=\"color: blue\">As<\/span> <span style=\"color: #2b91af\">Accomplishment<\/span><\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">Dim<\/span> copy = <span style=\"color: blue\">CType<\/span>(<span style=\"color: blue\">Me<\/span>.MemberwiseClone(), <span style=\"color: #2b91af\">Accomplishment<\/span>)<\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">Return<\/span> copy<\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">End<\/span> <span style=\"color: blue\">Function<\/span><\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">End<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"> <span style=\"color: blue\">Class<\/span><\/span><\/p><\/pre>\n<\/div>\n<\/div>\n<p><\/span><\/li>\n<\/ol>\n<h4>Create a&nbsp;viewmodel<\/h4>\n<p><span style=\"font-size: small\">In Solution Explorer, right-click the application name, and then add a new folder. <\/span><\/p>\n<ol>\n<li><span style=\"font-size: small\">Rename the new folder as &ldquo;ViewModel&rdquo;. <\/span><\/li>\n<li><span style=\"font-size: small\">Right-click the ViewModel folder, and then add a class. The Add New Item dialog box is displayed. <\/span><\/li>\n<li><span style=\"font-size: small\">Enter the name for the class as &ldquo;ViewModel.vb&rdquo;, and then click Add. The ViewModel.vb page is displayed. <\/span><\/li>\n<li><span style=\"font-size: small\">Replace the code with the following code: \n<div id=\"codeSnippetWrapper\" style=\"text-align: left;line-height: 12pt;background-color: #f4f4f4;margin: 20px 0px 10px;width: 95.26%;font-family: 'Courier New', courier, monospace;direction: ltr;height: 67px;max-height: 200px;font-size: 8pt;overflow: auto;cursor: text;border: silver 1px solid;padding: 4px\">\n<div id=\"codeSnippet\" style=\"text-align: left;line-height: 12pt;background-color: #f4f4f4;width: 100%;font-family: 'Courier New', courier, monospace;direction: ltr;height: 22px;color: black;font-size: 8pt;overflow: visible;border-style: none;padding: 0px\">\n<pre style=\"text-align: left;line-height: 12pt;background-color: white;margin: 0em;width: 100%;font-family: 'Courier New', courier, monospace;direction: ltr;color: black;font-size: 8pt;overflow: visible;border-style: none;padding: 0px\"><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">Imports<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"> System.Collections.ObjectModel<\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">Imports<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"> System.IO.IsolatedStorage<\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\">&nbsp;<\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">Public<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"> <span style=\"color: blue\">Class<\/span> <span style=\"color: #2b91af\">ViewModel<\/span><\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">Public<\/span> <span style=\"color: blue\">Property<\/span> Accomplishments <span style=\"color: blue\">As<\/span> <span style=\"color: #2b91af\">ObservableCollection<\/span>(<span style=\"color: blue\">Of<\/span> <span style=\"color: #2b91af\">Accomplishment<\/span>)<\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\">&nbsp;<\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">Public<\/span> <span style=\"color: blue\">Sub<\/span> GetAccomplishments()<\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">If<\/span> <span style=\"color: #2b91af\">IsolatedStorageSettings<\/span>.ApplicationSettings.Count &gt; 0 <span style=\"color: blue\">Then<\/span><\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>GetSavedAccomplishments()<\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">Else<\/span><\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>GetDefaultAccomplishments()<\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">End<\/span> <span style=\"color: blue\">If<\/span><\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">End<\/span> <span style=\"color: blue\">Sub<\/span><\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\">&nbsp;<\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">Public<\/span> <span style=\"color: blue\">Sub<\/span> GetDefaultAccomplishments()<\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">Dim<\/span> a <span style=\"color: blue\">As<\/span> <span style=\"color: blue\">New<\/span> <span style=\"color: #2b91af\">ObservableCollection<\/span>(<span style=\"color: blue\">Of<\/span> <span style=\"color: #2b91af\">Accomplishment<\/span>)<\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\">&nbsp;<\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: green\">' Items to collect<\/span><\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>a.Add(<span style=\"color: blue\">New<\/span> <span style=\"color: #2b91af\">Accomplishment<\/span> <span style=\"color: blue\">With<\/span> {.Name = <span style=\"color: #a31515\">\"Potions\"<\/span>, .Type = <span style=\"color: #a31515\">\"Item\"<\/span>})<\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>a.Add(<span style=\"color: blue\">New<\/span> <span style=\"color: #2b91af\">Accomplishment<\/span> <span style=\"color: blue\">With<\/span> {.Name = <span style=\"color: #a31515\">\"Coins\"<\/span>, .Type = <span style=\"color: #a31515\">\"Item\"<\/span>})<\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>a.Add(<span style=\"color: blue\">New<\/span> <span style=\"color: #2b91af\">Accomplishment<\/span> <span style=\"color: blue\">With<\/span> {.Name = <span style=\"color: #a31515\">\"Hearts\"<\/span>, .Type = <span style=\"color: #a31515\">\"Item\"<\/span>})<\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>a.Add(<span style=\"color: blue\">New<\/span> <span style=\"color: #2b91af\">Accomplishment<\/span> <span style=\"color: blue\">With<\/span> {.Name = <span style=\"color: #a31515\">\"Swords\"<\/span>, .Type = <span style=\"color: #a31515\">\"Item\"<\/span>})<\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>a.Add(<span style=\"color: blue\">New<\/span> <span style=\"color: #2b91af\">Accomplishment<\/span> <span style=\"color: blue\">With<\/span> {.Name = <span style=\"color: #a31515\">\"Shields\"<\/span>, .Type = <span style=\"color: #a31515\">\"Item\"<\/span>})<\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\">&nbsp;<\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: green\">' Levels to complete<\/span><\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>a.Add(<span style=\"color: blue\">New<\/span> <span style=\"color: #2b91af\">Accomplishment<\/span> <span style=\"color: blue\">With<\/span> {.Name = <span style=\"color: #a31515\">\"Level 1\"<\/span>, .Type = <span style=\"color: #a31515\">\"Level\"<\/span>})<\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>a.Add(<span style=\"color: blue\">New<\/span> <span style=\"color: #2b91af\">Accomplishment<\/span> <span style=\"color: blue\">With<\/span> {.Name = <span style=\"color: #a31515\">\"Level 2\"<\/span>, .Type = <span style=\"color: #a31515\">\"Level\"<\/span>})<\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>a.Add(<span style=\"color: blue\">New<\/span> <span style=\"color: #2b91af\">Accomplishment<\/span> <span style=\"color: blue\">With<\/span> {.Name = <span style=\"color: #a31515\">\"Level 3\"<\/span>, .Type = <span style=\"color: #a31515\">\"Level\"<\/span>})<\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\">&nbsp;<\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>Accomplishments = a<\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: green\">'MessageBox.Show(\"Got accomplishments from default\")<\/span><\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">End<\/span> <span style=\"color: blue\">Sub<\/span><\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\">&nbsp;<\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">Public<\/span> <span style=\"color: blue\">Sub<\/span> GetSavedAccomplishments()<\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">Dim<\/span> a <span style=\"color: blue\">As<\/span> <span style=\"color: blue\">New<\/span> <span style=\"color: #2b91af\">ObservableCollection<\/span>(<span style=\"color: blue\">Of<\/span> <span style=\"color: #2b91af\">Accomplishment<\/span>)<\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\">&nbsp;<\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">For<\/span> <span style=\"color: blue\">Each<\/span> o <span style=\"color: blue\">In<\/span> <span style=\"color: #2b91af\">IsolatedStorageSettings<\/span>.ApplicationSettings.Values<\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>a.Add(<span style=\"color: blue\">CType<\/span>(o, <span style=\"color: #2b91af\">Accomplishment<\/span>))<\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">Next<\/span> o<\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\">&nbsp;<\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>Accomplishments = a<\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: green\">'MessageBox.Show(\"Got accomplishments from storage\")<\/span><\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">End<\/span> <span style=\"color: blue\">Sub<\/span><\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\">&nbsp;<\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">End<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"> <span style=\"color: blue\">Class<\/span><\/span><\/p><\/pre>\n<\/div>\n<\/div>\n<p><\/span><\/li>\n<\/ol>\n<h4>Create the first view<\/h4>\n<ol>\n<li><span style=\"font-size: small\">In Solution Explorer, right-click the application name, and then add a new folder. <\/span><\/li>\n<li><span style=\"font-size: small\">Rename the new folder as &ldquo;View&rdquo;. <\/span><\/li>\n<li><span style=\"font-size: small\">Right-click the View folder, and then add a new item. The Add New Item dialog box is displayed. <\/span><\/li>\n<li><span style=\"font-size: small\">Select the &ldquo;Silverlight for Windows Phone&rdquo; node, and then select the &ldquo;Windows Phone User Control&rdquo; template. <\/span><\/li>\n<li><span style=\"font-size: small\">Enter the name for the view as &ldquo;ItemView.xaml&rdquo;, and then click Add. The ItemView.xaml page is displayed. <\/span><\/li>\n<li><span style=\"font-size: small\">In the &lt;Grid&gt; tag, add the following XAML code: \n<div id=\"codeSnippetWrapper\" style=\"text-align: left;line-height: 12pt;background-color: #f4f4f4;margin: 20px 0px 10px;width: 95.26%;font-family: 'Courier New', courier, monospace;direction: ltr;height: 67px;max-height: 200px;font-size: 8pt;overflow: auto;cursor: text;border: silver 1px solid;padding: 4px\">\n<div id=\"codeSnippet\" style=\"text-align: left;line-height: 12pt;background-color: #f4f4f4;width: 100%;font-family: 'Courier New', courier, monospace;direction: ltr;height: 22px;color: black;font-size: 8pt;overflow: visible;border-style: none;padding: 0px\">\n<pre style=\"text-align: left;line-height: 12pt;background-color: white;margin: 0em;width: 100%;font-family: 'Courier New', courier, monospace;direction: ltr;color: black;font-size: 8pt;overflow: visible;border-style: none;padding: 0px\"><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">ListBox<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> ItemsSource<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=\"{<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">Binding<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">}\"&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">ListBox.ItemTemplate<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">DataTemplate<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">Grid<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">Grid.ColumnDefinitions<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">ColumnDefinition<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Width<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=\"200\"\/&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">ColumnDefinition<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Width<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=\"80\"\/&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">ColumnDefinition<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Width<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=\"100\"\/&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;\/<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">Grid.ColumnDefinitions<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">TextBlock<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> x<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">:<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\">Name<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=\"Item\"<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Text<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=\"{<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">Binding<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Path<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=Name,<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Mode<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=OneWay}\"<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Grid.Column<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=\"0\"<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> HorizontalAlignment<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=\"Left\"<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> VerticalAlignment<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=\"Center\" \/&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">TextBox<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> x<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">:<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\">Name<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=\"Count\"<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Text<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=\"{<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">Binding<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Path<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=Count,<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Mode<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=TwoWay}\"<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Grid.Column<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=\"1\"<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> TextAlignment<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=\"Center\"<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> InputScope<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=\"Number\"\/&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">TextBlock<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> x<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">:<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\">Name<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=\"Check\"<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Text<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=\"{<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">Binding<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Path<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=Count,<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Mode<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=OneWay}\"<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Grid.Column<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=\"2\"<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> HorizontalAlignment<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=\"Center\"<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> VerticalAlignment<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=\"Center\" \/&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;\/<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">Grid<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;\/<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">DataTemplate<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;\/<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">ListBox.ItemTemplate<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;\/<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">ListBox<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&gt;<\/span><\/p><\/pre>\n<\/div>\n<\/div>\n<p><\/span><\/li>\n<\/ol>\n<h4>Create the second view<\/h4>\n<ol>\n<li><span style=\"font-size: small\">In Solution Explorer, right-click the View folder, and then add a new item. The Add New Item dialog box is displayed. <\/span><\/li>\n<li><span style=\"font-size: small\">Select the &ldquo;Silverlight for Windows Phone&rdquo; node, and then select the &ldquo;Windows Phone User Control&rdquo; template. <\/span><\/li>\n<li><span style=\"font-size: small\">Enter the name for the view as &ldquo;LevelView.xaml&rdquo;, and then click Add. The LevelView.xaml page is displayed. <\/span><\/li>\n<\/ol>\n<h4>Create the custom data binding converter<\/h4>\n<p><span style=\"font-size: small\">Open the LevelView.xaml.vb page, and replace the code with the following code:<br \/><\/span>&nbsp;<\/p>\n<div id=\"codeSnippetWrapper\" style=\"text-align: left;line-height: 12pt;background-color: #f4f4f4;margin: 20px 0px 10px;width: 95.26%;font-family: 'Courier New', courier, monospace;direction: ltr;height: 67px;max-height: 200px;font-size: 8pt;overflow: auto;cursor: text;border: silver 1px solid;padding: 4px\">\n<div id=\"codeSnippet\" style=\"text-align: left;line-height: 12pt;background-color: #f4f4f4;width: 100%;font-family: 'Courier New', courier, monospace;direction: ltr;height: 22px;color: black;font-size: 8pt;overflow: visible;border-style: none;padding: 0px\">\n<pre style=\"text-align: left;line-height: 12pt;background-color: white;margin: 0em;width: 100%;font-family: 'Courier New', courier, monospace;direction: ltr;color: black;font-size: 8pt;overflow: visible;border-style: none;padding: 0px\"><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">Imports<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"> System.Globalization<\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\">&nbsp;<\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">Partial<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"> <span style=\"color: blue\">Public<\/span> <span style=\"color: blue\">Class<\/span> <span style=\"color: #2b91af\">LevelView<\/span><\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">Inherits<\/span> <span style=\"color: #2b91af\">UserControl<\/span><\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">Public<\/span> <span style=\"color: blue\">Sub<\/span> <span style=\"color: blue\">New<\/span>()<\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>InitializeComponent()<\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">End<\/span> <span style=\"color: blue\">Sub<\/span><\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">End<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"> <span style=\"color: blue\">Class<\/span><\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\">&nbsp;<\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\">&nbsp;<\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">Public<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"> <span style=\"color: blue\">Class<\/span> <span style=\"color: #2b91af\">BoolOpposite<\/span><\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">Implements<\/span> System.Windows.Data.<span style=\"color: #2b91af\">IValueConverter<\/span><\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">Public<\/span> <span style=\"color: blue\">Function<\/span> Convert(<span style=\"color: blue\">ByVal<\/span> value <span style=\"color: blue\">As<\/span> <span style=\"color: blue\">Object<\/span>, <span style=\"color: blue\">ByVal<\/span> targetType <span style=\"color: blue\">As<\/span> <span style=\"color: #2b91af\">Type<\/span>, <span style=\"color: blue\">ByVal<\/span> parameter <span style=\"color: blue\">As<\/span> <span style=\"color: blue\">Object<\/span>, <span style=\"color: blue\">ByVal<\/span> culture <span style=\"color: blue\">As<\/span> <span style=\"color: #2b91af\">CultureInfo<\/span>) <span style=\"color: blue\">As<\/span> <span style=\"color: blue\">Object<\/span> <span style=\"color: blue\">Implements<\/span> System.Windows.Data.<span style=\"color: #2b91af\">IValueConverter<\/span>.Convert<\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">Dim<\/span> b = <span style=\"color: blue\">CBool<\/span>(value)<\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">Return<\/span> <span style=\"color: blue\">Not<\/span> b<\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">End<\/span> <span style=\"color: blue\">Function<\/span><\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\">&nbsp;<\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\">&nbsp;<\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">Public<\/span> <span style=\"color: blue\">Function<\/span> ConvertBack(<span style=\"color: blue\">ByVal<\/span> value <span style=\"color: blue\">As<\/span> <span style=\"color: blue\">Object<\/span>, <span style=\"color: blue\">ByVal<\/span> targetType <span style=\"color: blue\">As<\/span> <span style=\"color: #2b91af\">Type<\/span>, <span style=\"color: blue\">ByVal<\/span> parameter <span style=\"color: blue\">As<\/span> <span style=\"color: blue\">Object<\/span>, <span style=\"color: blue\">ByVal<\/span> culture <span style=\"color: blue\">As<\/span> <span style=\"color: #2b91af\">CultureInfo<\/span>) <span style=\"color: blue\">As<\/span> <span style=\"color: blue\">Object<\/span> <span style=\"color: blue\">Implements<\/span> System.Windows.Data.<span style=\"color: #2b91af\">IValueConverter<\/span>.ConvertBack<\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">Dim<\/span> s = <span style=\"color: blue\">TryCast<\/span>(value, <span style=\"color: blue\">String<\/span>)<\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">Dim<\/span> b <span style=\"color: blue\">As<\/span> <span style=\"color: blue\">Boolean<\/span><\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\">&nbsp;<\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">If<\/span> <span style=\"color: blue\">Boolean<\/span>.TryParse(s, b) <span style=\"color: blue\">Then<\/span><\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">Return<\/span> <span style=\"color: blue\">Not<\/span> b<\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">End<\/span> <span style=\"color: blue\">If<\/span><\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">Return<\/span> <span style=\"color: blue\">False<\/span><\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">End<\/span> <span style=\"color: blue\">Function<\/span><\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">End<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"> <span style=\"color: blue\">Class<\/span><\/span><\/p><\/pre>\n<\/div>\n<\/div>\n<p>&nbsp;<\/p>\n<h4>Create the user interface for the second view<\/h4>\n<ol>\n<li><span style=\"font-size: small\">Open the LevelView.xaml page. <\/span><\/li>\n<li><span style=\"font-size: small\">In the &lt;UserControl&gt; tag, add the following XAML code: \n<div id=\"codeSnippetWrapper\" style=\"text-align: left;line-height: 12pt;background-color: #f4f4f4;margin: 20px 0px 10px;width: 95.2%;font-family: 'Courier New', courier, monospace;direction: ltr;height: 29px;max-height: 200px;font-size: 8pt;overflow: auto;cursor: text;border: silver 1px solid;padding: 4px\">\n<div id=\"codeSnippet\" style=\"text-align: left;line-height: 12pt;background-color: #f4f4f4;width: 100%;font-family: 'Courier New', courier, monospace;direction: ltr;height: 20px;color: black;font-size: 8pt;overflow: visible;border-style: none;padding: 0px\">\n<pre style=\"text-align: left;line-height: 12pt;background-color: white;margin: 0em;width: 100%;font-family: 'Courier New', courier, monospace;direction: ltr;color: black;font-size: 8pt;overflow: visible;border-style: none;padding: 0px\"><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\">xmlns<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">:<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\">src<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=\"clr-namespace:MVVMTestApp\"<\/span><span style=\"line-height: 115%;font-size: 8.5pt\"><span style=\"font-family: Calibri\">&nbsp;<\/span><\/span><\/p><\/pre>\n<\/div>\n<\/div>\n<p><\/span><\/li>\n<li><span style=\"font-size: small\">After the &lt;UserControl&gt; tag, add the following XAML code: \n<div id=\"codeSnippetWrapper\" style=\"text-align: left;line-height: 12pt;background-color: #f4f4f4;margin: 20px 0px 10px;width: 95.11%;font-family: 'Courier New', courier, monospace;direction: ltr;height: 51px;max-height: 200px;font-size: 8pt;overflow: auto;cursor: text;border: silver 1px solid;padding: 4px\">\n<div id=\"codeSnippet\" style=\"text-align: left;line-height: 12pt;background-color: #f4f4f4;width: 100%;font-family: 'Courier New', courier, monospace;direction: ltr;height: 38px;color: black;font-size: 8pt;overflow: visible;border-style: none;padding: 0px\">\n<pre style=\"text-align: left;line-height: 12pt;background-color: white;margin: 0em;width: 100%;font-family: 'Courier New', courier, monospace;direction: ltr;color: black;font-size: 8pt;overflow: visible;border-style: none;padding: 0px\"><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">UserControl.Resources<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">src<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">:<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">BoolOpposite<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> x<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">:<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\">Key<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=\"BoolOpposite\"\/&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p><p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;\/<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">UserControl.Resources<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&gt;<\/span><\/p><\/pre>\n<\/div>\n<\/div>\n<p><\/span><\/li>\n<li><span style=\"font-size: small\">In the &lt;Grid&gt; tag, add the following XAML code: \n<div id=\"codeSnippetWrapper\" style=\"text-align: left;line-height: 12pt;background-color: #f4f4f4;margin: 20px 0px 10px;width: 95.01%;font-family: 'Courier New', courier, monospace;direction: ltr;height: 67px;max-height: 200px;font-size: 8pt;overflow: auto;cursor: text;border: silver 1px solid;padding: 4px\">\n<div id=\"codeSnippet\" style=\"text-align: left;line-height: 12pt;background-color: #f4f4f4;width: 100%;font-family: 'Courier New', courier, monospace;direction: ltr;height: 22px;color: black;font-size: 8pt;overflow: visible;border-style: none;padding: 0px\">\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">ListBox<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> ItemsSource<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;{<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">Binding<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">}&#8221;&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">ListBox.ItemTemplate<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">DataTemplate<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">Grid<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">Grid.ColumnDefinitions<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">ColumnDefinition<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Width<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;200&#8243;\/&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">ColumnDefinition<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Width<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;80&#8243;\/&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">ColumnDefinition<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Width<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;100&#8243;\/&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;\/<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">Grid.ColumnDefinitions<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">TextBlock<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> x<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">:<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\">Name<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;Level&#8221;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Text<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;{<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">Binding<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Path<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=Name,<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Mode<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=OneWay}&#8221;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Grid.Column<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;0&#8243;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> HorizontalAlignment<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;Left&#8221;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> VerticalAlignment<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;Center&#8221;\/&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">CheckBox<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> x<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">:<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\">Name<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;Completed&#8221;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> IsChecked<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;{<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">Binding<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Path<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=Completed,<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Mode<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=TwoWay}&#8221;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Grid.Column<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;1&#8243;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> HorizontalAlignment<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;Center&#8221;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> IsEnabled<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;{<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">Binding<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Path<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=Completed,<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Converter<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">={<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">StaticResource<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> BoolOpposite<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">}}&#8221;\/&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">TextBlock<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> x<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">:<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\">Name<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;Check&#8221;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Text<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;{<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">Binding<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Path<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=Completed,<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Mode<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=OneWay}&#8221;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Grid.Column<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;2&#8243;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> HorizontalAlignment<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;Center&#8221;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> VerticalAlignment<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;Center&#8221;\/&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span>&nbsp;<\/span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;\/<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">Grid<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span>&nbsp;<\/span><\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;\/<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">DataTemplate<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;\/<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">ListBox.ItemTemplate<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;\/<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">ListBox<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&gt;<\/span><\/p>\n<\/div>\n<\/div>\n<p><\/span><\/li>\n<\/ol>\n<h3>Step 3 &#8211; Create the main application page<\/h3>\n<h4>Create the user interface for the main application page<\/h4>\n<ol>\n<li><span style=\"font-size: small\">Open the MainPage.xaml page. <\/span><\/li>\n<li><span style=\"font-size: small\">Click the MY APPLICATION text. In the Properties window, change the text property to &ldquo;MVVM Test App&rdquo;. <\/span><\/li>\n<li><span style=\"font-size: small\">Click the page name text. In the Properties window, change the text property to &ldquo;game tracker&rdquo;. <\/span><\/li>\n<li><span style=\"font-size: small\">In the &lt;phone&gt; tag, add the following XAML code: \n<div id=\"codeSnippetWrapper\" style=\"text-align: left;line-height: 12pt;background-color: #f4f4f4;margin: 20px 0px 10px;width: 95.17%;font-family: 'Courier New', courier, monospace;direction: ltr;height: 26px;max-height: 200px;font-size: 8pt;overflow: auto;cursor: text;border: silver 1px solid;padding: 4px\">\n<div id=\"codeSnippet\" style=\"text-align: left;line-height: 12pt;background-color: #f4f4f4;width: 100%;font-family: 'Courier New', courier, monospace;direction: ltr;height: 22px;color: black;font-size: 8pt;overflow: visible;border-style: none;padding: 0px\"><span style=\"font-family: 'Courier New';color: red;font-size: 9pt\"><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\">xmlns<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">:<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\">views<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;clr-namespace:MVVMTestApp&#8221;<\/span><\/p>\n<p><\/span><\/div>\n<\/div>\n<p><\/span><\/li>\n<li><span style=\"font-size: small\">Replace the &lt;Grid&gt; tag for the content panel with the following XAML code: \n<div id=\"codeSnippetWrapper\" style=\"text-align: left;line-height: 12pt;background-color: #f4f4f4;margin: 20px 0px 10px;width: 95.01%;font-family: 'Courier New', courier, monospace;direction: ltr;height: 67px;max-height: 200px;font-size: 8pt;overflow: auto;cursor: text;border: silver 1px solid;padding: 4px\">\n<div id=\"codeSnippet\" style=\"text-align: left;line-height: 12pt;background-color: #f4f4f4;width: 100%;font-family: 'Courier New', courier, monospace;direction: ltr;height: 22px;color: black;font-size: 8pt;overflow: visible;border-style: none;padding: 0px\">\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: green;font-size: 8.5pt\">&lt;!&#8211;ContentPanel &#8211; place additional content here&#8211;&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">Grid<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> x<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">:<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\">Name<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;ContentPanel&#8221;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Grid.Row<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;1&#8243;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Margin<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;12,0,12,0&#8243;&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp; <\/span><\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">StackPanel<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">TextBlock<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Text<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;Items Collected&#8221;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Foreground<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;{<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">StaticResource<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> PhoneAccentBrush<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">}&#8221;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Style<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;{<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">StaticResource<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> PhoneTextLargeStyle<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">}&#8221; \/&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">views<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">:<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">ItemView<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> x<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">:<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\">Name<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;ItemViewOnPage&#8221;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Height<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;200&#8243;\/&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">TextBlock<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Text<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;Levels Completed&#8221;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Foreground<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;{<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">StaticResource<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> PhoneAccentBrush<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">}&#8221;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Style<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;{<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">StaticResource<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> PhoneTextLargeStyle<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">}&#8221; \/&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">views<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">:<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">LevelView<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> x<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">:<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\">Name<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;LevelViewOnPage&#8221;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Height<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;200&#8243;\/&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp; <\/span><\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;\/<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">StackPanel<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;\/<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">Grid<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&gt;<\/span><\/p>\n<\/div>\n<\/div>\n<p><\/span><\/li>\n<\/ol>\n<h4>Add the code for the main application page<\/h4>\n<p><span style=\"font-size: small\">Open the MainPage.xaml.vb page, and replace the code with the following code:<br \/><\/span><\/p>\n<div id=\"codeSnippetWrapper\" style=\"text-align: left;line-height: 12pt;background-color: #f4f4f4;margin: 20px 0px 10px;width: 95.01%;font-family: 'Courier New', courier, monospace;direction: ltr;height: 67px;max-height: 200px;font-size: 8pt;overflow: auto;cursor: text;border: silver 1px solid;padding: 4px\">\n<div id=\"codeSnippet\" style=\"text-align: left;line-height: 12pt;background-color: #f4f4f4;width: 100%;font-family: 'Courier New', courier, monospace;direction: ltr;height: 22px;color: black;font-size: 8pt;overflow: visible;border-style: none;padding: 0px\">\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">Partial<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"> <span style=\"color: blue\">Public<\/span> <span style=\"color: blue\">Class<\/span> <span style=\"color: #2b91af\">MainPage<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">Inherits<\/span> <span style=\"color: #2b91af\">PhoneApplicationPage<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">Private<\/span> vm <span style=\"color: blue\">As<\/span> <span style=\"color: #2b91af\">ViewModel<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\">&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: green\">&#8216; Constructor<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">Public<\/span> <span style=\"color: blue\">Sub<\/span> <span style=\"color: blue\">New<\/span>()<\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>InitializeComponent()<\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>vm = <span style=\"color: blue\">New<\/span> <span style=\"color: #2b91af\">ViewModel<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">End<\/span> <span style=\"color: blue\">Sub<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\">&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">Protected<\/span> <span style=\"color: blue\">Overrides<\/span> <span style=\"color: blue\">Sub<\/span> OnNavigatedTo(<span style=\"color: blue\">ByVal<\/span> e <span style=\"color: blue\">As<\/span> System.Windows.Navigation.<span style=\"color: #2b91af\">NavigationEventArgs<\/span>)<\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">MyBase<\/span>.OnNavigatedTo(e)<\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\">&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: green\">&#8216; Later, you will replace this line with something better<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>vm.GetAccomplishments()<\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: green\">&#8216; There are two different views, but only one view model.<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: green\">&#8216; So, use LINQ queries to populate the views.<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\">&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: green\">&#8216; Set the data context for the Item view.<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>ItemViewOnPage.DataContext = <span style=\"color: blue\">From<\/span> Accomplishment <span style=\"color: blue\">In<\/span> vm.Accomplishments<\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">Where<\/span> Accomplishment.Type = <span style=\"color: #a31515\">&#8220;Item&#8221;<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">Select<\/span> Accomplishment<\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\">&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: green\">&#8216; Set the data context for the Level view.<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>LevelViewOnPage.DataContext = <span style=\"color: blue\">From<\/span> Accomplishment <span style=\"color: blue\">In<\/span> vm.Accomplishments<\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">Where<\/span> Accomplishment.Type = <span style=\"color: #a31515\">&#8220;Level&#8221;<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">Select<\/span> Accomplishment<\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\">&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: green\">&#8216; If there is only one view, you could use the following code<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: green\">&#8216; to populate the view.<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: green\">&#8216; AccomplishmentViewOnPage.DataContext = vm.Accomplishments<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">End<\/span> <span style=\"color: blue\">Sub<\/span><\/span><\/p>\n<\/div>\n<\/div>\n<p>&nbsp;<\/p>\n<h3>Step 4 &ndash; Maintain the page state<\/h3>\n<ol>\n<li><span style=\"font-size: small\">In Solution Explorer, right-click the application name, and then add a class. The Add New Item dialog box is displayed. <\/span><\/li>\n<li><span style=\"font-size: small\">Enter the name for the class as &ldquo;StateUtilities.vb&rdquo;, and then click Add. The StateUtilities.vb page is displayed. <\/span><\/li>\n<li><span style=\"font-size: small\">Replace the code with the following code: \n<div id=\"codeSnippetWrapper\" style=\"text-align: left;line-height: 12pt;background-color: #f4f4f4;margin: 20px 0px 10px;width: 95.01%;font-family: 'Courier New', courier, monospace;direction: ltr;height: 67px;max-height: 200px;font-size: 8pt;overflow: auto;cursor: text;border: silver 1px solid;padding: 4px\">\n<div id=\"codeSnippet\" style=\"text-align: left;line-height: 12pt;background-color: #f4f4f4;width: 100%;font-family: 'Courier New', courier, monospace;direction: ltr;height: 22px;color: black;font-size: 8pt;overflow: visible;border-style: none;padding: 0px\">\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">Public<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"> <span style=\"color: blue\">NotInheritable<\/span> <span style=\"color: blue\">Class<\/span> <span style=\"color: #2b91af\">StateUtilities<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">Private<\/span> <span style=\"color: blue\">Shared<\/span> _isLaunching <span style=\"color: blue\">As<\/span> <span style=\"color: blue\">Boolean<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\">&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">Private<\/span> <span style=\"color: blue\">Sub<\/span> <span style=\"color: blue\">New<\/span>()<\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">End<\/span> <span style=\"color: blue\">Sub<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\">&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">Public<\/span> <span style=\"color: blue\">Shared<\/span> <span style=\"color: blue\">Property<\/span> IsLaunching <span style=\"color: blue\">As<\/span> <span style=\"color: blue\">Boolean<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">Get<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">Return<\/span> _isLaunching<\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">End<\/span> <span style=\"color: blue\">Get<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">Set<\/span>(<span style=\"color: blue\">ByVal<\/span> value <span style=\"color: blue\">As<\/span> <span style=\"color: blue\">Boolean<\/span>)<\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>_isLaunching = value<\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">End<\/span> <span style=\"color: blue\">Set<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">End<\/span> <span style=\"color: blue\">Property<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">End<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"> <span style=\"color: blue\">Class<\/span><\/span><\/p>\n<\/div>\n<\/div>\n<p><\/span><\/li>\n<li><span style=\"font-size: small\">Open the App.xaml.vb page. <\/span><\/li>\n<li><span style=\"font-size: small\">Replace the Application_Launching method with the following code: \n<div id=\"codeSnippetWrapper\" style=\"text-align: left;line-height: 12pt;background-color: #f4f4f4;margin: 20px 0px 10px;width: 95.01%;font-family: 'Courier New', courier, monospace;direction: ltr;height: 67px;max-height: 200px;font-size: 8pt;overflow: auto;cursor: text;border: silver 1px solid;padding: 4px\">\n<div id=\"codeSnippet\" style=\"text-align: left;line-height: 12pt;background-color: #f4f4f4;width: 100%;font-family: 'Courier New', courier, monospace;direction: ltr;height: 22px;color: black;font-size: 8pt;overflow: visible;border-style: none;padding: 0px\">\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">Private<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"> <span style=\"color: blue\">Sub<\/span> Application_Launching(<span style=\"color: blue\">ByVal<\/span> sender <span style=\"color: blue\">As<\/span> <span style=\"color: blue\">Object<\/span>, <span style=\"color: blue\">ByVal<\/span> e <span style=\"color: blue\">As<\/span> <span style=\"color: #2b91af\">LaunchingEventArgs<\/span>)<\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: #2b91af\">StateUtilities<\/span>.IsLaunching = <span style=\"color: blue\">True<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">End<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"> <span style=\"color: blue\">Sub<\/span><\/span><\/p>\n<\/div>\n<\/div>\n<p><\/span><\/li>\n<li><span style=\"font-size: small\">Replace the Application_Activated method with the following code: \n<div id=\"codeSnippetWrapper\" style=\"text-align: left;line-height: 12pt;background-color: #f4f4f4;margin: 20px 0px 10px;width: 95.01%;font-family: 'Courier New', courier, monospace;direction: ltr;height: 67px;max-height: 200px;font-size: 8pt;overflow: auto;cursor: text;border: silver 1px solid;padding: 4px\">\n<div id=\"codeSnippet\" style=\"text-align: left;line-height: 12pt;background-color: #f4f4f4;width: 100%;font-family: 'Courier New', courier, monospace;direction: ltr;height: 22px;color: black;font-size: 8pt;overflow: visible;border-style: none;padding: 0px\">\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">Private<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"> <span style=\"color: blue\">Sub<\/span> Application_Activated(<span style=\"color: blue\">ByVal<\/span> sender <span style=\"color: blue\">As<\/span> <span style=\"color: blue\">Object<\/span>, <span style=\"color: blue\">ByVal<\/span> e <span style=\"color: blue\">As<\/span> <span style=\"color: #2b91af\">ActivatedEventArgs<\/span>)<\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: #2b91af\">StateUtilities<\/span>.IsLaunching = <span style=\"color: blue\">False<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">End<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"> <span style=\"color: blue\">Sub<\/span><\/span><\/p>\n<\/div>\n<\/div>\n<p><\/span><\/li>\n<li><span style=\"font-size: small\">Open the MainPage.xaml.vb, and locate the following code: \n<div id=\"codeSnippetWrapper\" style=\"text-align: left;line-height: 12pt;background-color: #f4f4f4;margin: 20px 0px 10px;width: 95.01%;font-family: 'Courier New', courier, monospace;direction: ltr;height: 43px;max-height: 200px;font-size: 8pt;overflow: auto;cursor: text;border: silver 1px solid;padding: 4px\">\n<div id=\"codeSnippet\" style=\"text-align: left;line-height: 12pt;background-color: #f4f4f4;width: 100%;font-family: 'Courier New', courier, monospace;direction: ltr;height: 22px;color: black;font-size: 8pt;overflow: visible;border-style: none;padding: 0px\">\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: green;font-size: 8.5pt\">&#8216; Later, you will replace this line with something better<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>vm.GetAccomplishments()<\/span><\/p>\n<\/div>\n<\/div>\n<p><\/span><\/li>\n<li><span style=\"font-size: small\">Replace the code given in step 7 with the following code: \n<div id=\"codeSnippetWrapper\" style=\"text-align: left;line-height: 12pt;background-color: #f4f4f4;margin: 20px 0px 10px;width: 95.01%;font-family: 'Courier New', courier, monospace;direction: ltr;height: 67px;max-height: 200px;font-size: 8pt;overflow: auto;cursor: text;border: silver 1px solid;padding: 4px\">\n<div id=\"codeSnippet\" style=\"text-align: left;line-height: 12pt;background-color: #f4f4f4;width: 100%;font-family: 'Courier New', courier, monospace;direction: ltr;height: 22px;color: black;font-size: 8pt;overflow: visible;border-style: none;padding: 0px\">\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: green;font-size: 8.5pt\">&#8216; Old instance of the application<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: green;font-size: 8.5pt\">&#8216; The user started the application from the Back button.<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">If<\/span> (<span style=\"color: blue\">Not<\/span> <span style=\"color: #2b91af\">StateUtilities<\/span>.IsLaunching) <span style=\"color: blue\">AndAlso<\/span> <span style=\"color: blue\">Me<\/span>.State.ContainsKey(<span style=\"color: #a31515\">&#8220;Accomplishments&#8221;<\/span>) <span style=\"color: blue\">Then<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>vm = <span style=\"color: blue\">CType<\/span>(<span style=\"color: blue\">Me<\/span>.State(<span style=\"color: #a31515\">&#8220;Accomplishments&#8221;<\/span>), <span style=\"color: #2b91af\">ViewModel<\/span>)<\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: green\">&#8216;MessageBox.Show(&#8220;Got data from state&#8221;)<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: green\">&#8216; New instance of the application<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;<\/span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: green\">&#8216; The user started the application from the application list,<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: green\">&#8216; or there is no saved state available.<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">Else<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>vm.GetAccomplishments()<\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: green\">&#8216;MessageBox.Show(&#8220;Did not get data from state&#8221;)<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">End<\/span> <span style=\"color: blue\">If<\/span><\/span><\/p>\n<\/div>\n<\/div>\n<p><\/span><\/li>\n<li><span style=\"font-size: small\">After the OnNavigatedTo method, add the following code:<\/span> \n<div id=\"codeSnippetWrapper\" style=\"text-align: left;line-height: 12pt;background-color: #f4f4f4;margin: 20px 0px 10px;width: 95.01%;font-family: 'Courier New', courier, monospace;direction: ltr;height: 67px;max-height: 200px;font-size: 8pt;overflow: auto;cursor: text;border: silver 1px solid;padding: 4px\">\n<div id=\"codeSnippet\" style=\"text-align: left;line-height: 12pt;background-color: #f4f4f4;width: 100%;font-family: 'Courier New', courier, monospace;direction: ltr;height: 22px;color: black;font-size: 8pt;overflow: visible;border-style: none;padding: 0px\">\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">Protected<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"> <span style=\"color: blue\">Overrides<\/span> <span style=\"color: blue\">Sub<\/span> OnNavigatedFrom(<span style=\"color: blue\">ByVal<\/span> e <span style=\"color: blue\">As<\/span> System.Windows.Navigation.<span style=\"color: #2b91af\">NavigationEventArgs<\/span>)<\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">MyBase<\/span>.OnNavigatedFrom(e)<\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\">&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">If<\/span> <span style=\"color: blue\">Me<\/span>.State.ContainsKey(<span style=\"color: #a31515\">&#8220;Accomplishments&#8221;<\/span>) <span style=\"color: blue\">Then<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">Me<\/span>.State(<span style=\"color: #a31515\">&#8220;Accomplishments&#8221;<\/span>) = vm<\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">Else<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">Me<\/span>.State.Add(<span style=\"color: #a31515\">&#8220;Accomplishments&#8221;<\/span>, vm)<\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">End<\/span> <span style=\"color: blue\">If<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\">&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: #2b91af\">StateUtilities<\/span>.IsLaunching = <span style=\"color: blue\">False<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">End<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"> <span style=\"color: blue\">Sub<\/span><\/span><\/p>\n<\/div>\n<\/div>\n<\/li>\n<\/ol>\n<h3>Step 5 &#8211; Save data to isolated storage<\/h3>\n<p><span style=\"font-size: small\">Open the ViewModel.vb page, and add the following code:<br \/><\/span><\/p>\n<div id=\"codeSnippetWrapper\" style=\"text-align: left;line-height: 12pt;background-color: #f4f4f4;margin: 20px 0px 10px;width: 95.01%;font-family: 'Courier New', courier, monospace;direction: ltr;height: 67px;max-height: 200px;font-size: 8pt;overflow: auto;cursor: text;border: silver 1px solid;padding: 4px\">\n<div id=\"codeSnippet\" style=\"text-align: left;line-height: 12pt;background-color: #f4f4f4;width: 100%;font-family: 'Courier New', courier, monospace;direction: ltr;height: 22px;color: black;font-size: 8pt;overflow: visible;border-style: none;padding: 0px\">\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">Public<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"> <span style=\"color: blue\">Sub<\/span> SaveAccomplishments()<\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp; <\/span><span style=\"color: blue\">Dim<\/span> settings <span style=\"color: blue\">As<\/span> <span style=\"color: #2b91af\">IsolatedStorageSettings<\/span> = <span style=\"color: #2b91af\">IsolatedStorageSettings<\/span>.ApplicationSettings<\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\">&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp; <\/span><span style=\"color: blue\">For<\/span> <span style=\"color: blue\">Each<\/span> a <span style=\"color: blue\">In<\/span> Accomplishments<\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">If<\/span> settings.Contains(a.Name) <span style=\"color: blue\">Then<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>settings(a.Name) = a<\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">Else<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>settings.Add(a.Name, a.GetCopy())<\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">End<\/span> <span style=\"color: blue\">If<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp; <\/span><span style=\"color: blue\">Next<\/span> a<\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\">&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp; <\/span>settings.Save()<\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp; <\/span><span style=\"color: #2b91af\">MessageBox<\/span>.Show(<span style=\"color: #a31515\">&#8220;Finished saving accomplishments&#8221;<\/span>)<\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">End<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"> <span style=\"color: blue\">Sub<\/span><\/span><\/p>\n<\/div>\n<\/div>\n<p>&nbsp;<\/p>\n<h3>Step 6 &#8211; Add the application bar<\/h3>\n<h4>Add the icon file<\/h4>\n<ol>\n<li><span style=\"font-size: small\">In Solution Explorer, right-click the application name, and then add an existing item. The Add Existing Item dialog box is displayed. <\/span><\/li>\n<li><span style=\"font-size: small\">Browse to one of the following folders to locate the standard icons: <\/span>\n<ul>\n<li><span style=\"font-size: small\">C:Program FilesMicrosoft SDKsWindows Phonev7.0Iconsdark <\/span><\/li>\n<li><span style=\"font-size: small\">C:Program Files (x86)Microsoft SDKsWindows Phonev7.0Iconsdark <\/span><\/li>\n<\/ul>\n<\/li>\n<li><span style=\"font-size: small\">Select the appbar.save.rest.png icon, and then click Add. <\/span><\/li>\n<li><span style=\"font-size: small\">In Solution Explorer, select the appbar.save.rest.png file. <\/span><\/li>\n<li><span style=\"font-size: small\">In the Properties window, change the Build Action property to &ldquo;Content&rdquo;. <\/span><\/li>\n<li><span style=\"font-size: small\">Change the Copy to Output Directory property to &ldquo;Copy if newer&rdquo;. <\/span><\/li>\n<li><span style=\"font-size: small\">Change the File Name property to &ldquo;AppBarSave.png&rdquo;. <\/span><\/li>\n<\/ol>\n<h4>Add the application bar<\/h4>\n<ol>\n<li><span style=\"font-size: small\">Open the MainPage.xaml.vb page. <\/span><\/li>\n<li><span style=\"font-size: small\">After the OnNavigatedFrom method, add the following code: \n<div id=\"codeSnippetWrapper\" style=\"text-align: left;line-height: 12pt;background-color: #f4f4f4;margin: 20px 0px 10px;width: 95.01%;font-family: 'Courier New', courier, monospace;direction: ltr;height: 67px;max-height: 200px;font-size: 8pt;overflow: auto;cursor: text;border: silver 1px solid;padding: 4px\">\n<div id=\"codeSnippet\" style=\"text-align: left;line-height: 12pt;background-color: #f4f4f4;width: 100%;font-family: 'Courier New', courier, monospace;direction: ltr;height: 22px;color: black;font-size: 8pt;overflow: visible;border-style: none;padding: 0px\">\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">Private<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"> <span style=\"color: blue\">Sub<\/span> AppBarSave_Click(<span style=\"color: blue\">ByVal<\/span> sender <span style=\"color: blue\">As<\/span> <span style=\"color: blue\">Object<\/span>, <span style=\"color: blue\">ByVal<\/span> e <span style=\"color: blue\">As<\/span> <span style=\"color: #2b91af\">EventArgs<\/span>)<\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp; <\/span>vm.SaveAccomplishments()<\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">End<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"> <span style=\"color: blue\">Sub<\/span><\/span><\/p>\n<\/div>\n<\/div>\n<p><\/span><\/li>\n<li><span style=\"font-size: small\">Open the MainPage.xaml page. <\/span><\/li>\n<li><span style=\"font-size: small\">Replace the &lt;phone:PhoneApplicationPage.ApplicationBar&gt; tag with the following XAML code: \n<div id=\"codeSnippetWrapper\" style=\"text-align: left;line-height: 12pt;background-color: #f4f4f4;margin: 20px 0px 10px;width: 95.01%;font-family: 'Courier New', courier, monospace;direction: ltr;height: 67px;max-height: 200px;font-size: 8pt;overflow: auto;cursor: text;border: silver 1px solid;padding: 4px\">\n<div id=\"codeSnippet\" style=\"text-align: left;line-height: 12pt;background-color: #f4f4f4;width: 100%;font-family: 'Courier New', courier, monospace;direction: ltr;height: 22px;color: black;font-size: 8pt;overflow: visible;border-style: none;padding: 0px\">\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">phone<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">:<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">PhoneApplicationPage.ApplicationBar<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp; <\/span><\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">shell<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">:<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">ApplicationBar<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> IsVisible<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;True&#8221;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> IsMenuEnabled<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;True&#8221; &gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">shell<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">:<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">ApplicationBarIconButton<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> IconUri<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;AppBarSave.png&#8221;<\/span><span style=\"font-family: 'Courier New';color: red;font-size: 8.5pt\"> Text<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">=&#8221;Save&#8221;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"> <span style=\"color: red\"><span>&nbsp;<\/span>Click<\/span><span style=\"color: blue\">=&#8221;AppBarSave_Click&#8221; \/&gt;<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\"><span>&nbsp;&nbsp;&nbsp; <\/span><\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;\/<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">shell<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">:<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">ApplicationBar<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&gt;<\/span><span style=\"font-family: 'Courier New';font-size: 8.5pt\"><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&lt;\/<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">phone<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">:<\/span><span style=\"font-family: 'Courier New';color: #a31515;font-size: 8.5pt\">PhoneApplicationPage.ApplicationBar<\/span><span style=\"font-family: 'Courier New';color: blue;font-size: 8.5pt\">&gt;<\/span><\/p>\n<\/div>\n<\/div>\n<p><\/span><\/li>\n<\/ol>\n<p><span style=\"font-size: small\">Voila! Now your model-view-viewmodel pattern for Windows Phone application is ready! You just need to build and debug the application.<\/span><\/p>\n<h3>Step 7 &#8211; Build and debug the application<\/h3>\n<ol>\n<li><span style=\"font-size: small\">To build the application, select Build &gt; Build Solution. The project should build without any errors. If there are errors, check the earlier steps, correct the errors, and then build the application again. <\/span><\/li>\n<li><span style=\"font-size: small\">To debug the application, set the deployment target of the application to &ldquo;Windows Phone 7 Emulator&rdquo;. <s><\/s><\/span><\/li>\n<li><span style=\"font-size: small\">Select Debug &gt; Start Debugging. The emulator window is displayed. <br \/><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/vbteam\/wp-content\/uploads\/sites\/7\/2011\/02\/1856.Emulator.bmp\" width=\"280\" border=\"0\" height=\"589\" \/><\/span><\/li>\n<li><span style=\"font-size: small\">To test whether the view is bound to the model, enter appropriate values in the Items Collected boxes. <\/span><\/li>\n<li><span style=\"font-size: small\">To test the data converter, select the Level 1 check box. <\/span><\/li>\n<li><span style=\"font-size: small\">To test the page state, click the Start button, and then click the Back button. The application resumes, and the page state is maintained. <\/span><\/li>\n<li><span style=\"font-size: small\">To test the data in isolated storage, click the Save button. The message &ldquo;Finished saving accomplishments&rdquo; is displayed. Click the Start button, and then select &ldquo;MVVMTestApp&rdquo;. A new instance of the application is launched, containing the data that you had saved in isolated storage. <\/span><\/li>\n<\/ol>\n<h3>Step 8 &#8211; Rebuild in the release mode before publishing<\/h3>\n<ol>\n<li><span style=\"font-size: small\">On the standard toolbar, change the configuration manager to Release. <s><\/s><\/span><\/li>\n<li><span style=\"font-size: small\">To rebuild the application, select Build &gt; Rebuild. The XAP file of the application is generated. <\/span><\/li>\n<\/ol>\n<p><span style=\"font-size: small\">Finally, to submit your application to the market place, you can refer to <\/span><a href=\"http:\/\/create.msdn.com\/en-US\/home\/about\/app_submission_walkthrough_upload\"><span style=\"font-size: small\">upload your application walkthrough<\/span><\/a><span style=\"font-size: small\">.<\/span><\/p>\n<h3>Summary<\/h3>\n<p><span style=\"font-size: small\">That&rsquo;s it! You have now successfully implemented the model-view-viewmodel pattern for the Windows Phone application, that too in just 8 simple steps!<\/span><\/p>\n<p><span style=\"font-size: small\">You can find the full source code for the Model-View-ViewModel Pattern application <\/span><a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/ff431744(v=VS.92).aspx\"><span style=\"font-size: small\">here<\/span><\/a><span style=\"font-size: small\">. <\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In our last post, I explained how to create a custom indeterminate progress bar application for Windows Phone 7. In this blog, I want to share a sample that will help you to implement a model-view-viewmodel pattern in a Windows Phone application. A model-view-viewmodel pattern is used to separate data from the user interface. This [&hellip;]<\/p>\n","protected":false},"author":260,"featured_media":8818,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[195],"tags":[],"class_list":["post-683","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-visual-basic"],"acf":[],"blog_post_summary":"<p>In our last post, I explained how to create a custom indeterminate progress bar application for Windows Phone 7. In this blog, I want to share a sample that will help you to implement a model-view-viewmodel pattern in a Windows Phone application. A model-view-viewmodel pattern is used to separate data from the user interface. This [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/posts\/683","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/users\/260"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/comments?post=683"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/posts\/683\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/media\/8818"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/media?parent=683"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/categories?post=683"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/tags?post=683"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}