<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" media="screen" href="/styles/xslt/rss.xslt"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:c9="http://channel9.msdn.com">
<channel>
	<title>Migrating apps from Windows Phone to Windows 8  - Channel 9</title>
    <atom:link rel="self" type="application/rss+xml" href="http://channel9.msdn.com/Series/Migrating-apps-from-Windows-Phone-to-Windows-8/feed"></atom:link>
    <itunes:summary>These quickstarts provide guidance on migrating a Windows Phone 7 app to perform&amp;nbsp;well on&amp;nbsp;Windows 8 devices. We will assume that you are a developer familiar with Silverlight for Windows Phone but wish to get up to speed on Windows 8 application development, and the challenges and solutions that may arise during your porting effort. We will be migrating the Khan Academy Windows Phone 7 app developed by Joel Martinez. The original source code for the phone app is here The finished Windows 8 solution is also available for download </itunes:summary>
    <itunes:author>Microsoft</itunes:author>
    <itunes:subtitle></itunes:subtitle>
    <image>
      <url>http://files.channel9.msdn.com/thumbnail/87d48ed8-c115-4bb0-baa2-b03b3fd04096.png</url>
      <title>Migrating apps from Windows Phone to Windows 8  - Channel 9</title>
      <link>http://channel9.msdn.com/Series/Migrating-apps-from-Windows-Phone-to-Windows-8</link>
    </image>
    <itunes:image href="http://files.channel9.msdn.com/thumbnail/87d48ed8-c115-4bb0-baa2-b03b3fd04096.png"></itunes:image>
    <itunes:category text="Technology"></itunes:category>
    <description>These quickstarts provide guidance on migrating a Windows Phone 7 app to perform&amp;nbsp;well on&amp;nbsp;Windows 8 devices. We will assume that you are a developer familiar with Silverlight for Windows Phone but wish to get up to speed on Windows 8 application development, and the challenges and solutions that may arise during your porting effort. We will be migrating the Khan Academy Windows Phone 7 app developed by Joel Martinez. The original source code for the phone app is here The finished Windows 8 solution is also available for download </description>
    <link>http://channel9.msdn.com/Series/Migrating-apps-from-Windows-Phone-to-Windows-8</link>
    <language>en</language>
    <pubDate>Sat, 18 May 2013 13:43:15 GMT</pubDate>
    <lastBuildDate>Sat, 18 May 2013 13:43:15 GMT</lastBuildDate>
    <generator>Rev9</generator>
    <c9:totalResults>5</c9:totalResults>
    <c9:pageCount>1</c9:pageCount>
    <c9:pageSize>100</c9:pageSize>
  <item>
      <title>Features and Contracts in Windows Store Apps</title>
      <description><![CDATA[<p>&nbsp;</p><p>While the goal of these quickstarts is to discuss the issues and solutions involved in porting our Windows Phone 7 app to a Windows&nbsp;Store app, there are some features and requirements in Windows 8 we wanted to address: snapping and appcontracts.</p><p>Windows 8 Contracts provide OS level functionality and can significantly extend the power of your app when implemented properly. In this video, we will look at two contracts we implemented, the <a href="http://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh868180.aspx"><strong>Search Contract</strong></a> and the <strong>Share Contract</strong>. But first, let us look at how snapping is handled in a Windows&nbsp;Store app.</p><p>&nbsp;</p><h1><strong>Handling Window Snapping</strong></h1><p>As we discussed in the last Quickstart, snapping can have a significant impact on how you choose to present your app interface. In a typical template project page, we will find a GridView and ListView element both positioned in <strong>Grid.Row=&quot;1&quot;</strong> under the navigation and page header row of our root grid.</p><p><img title="clip_image001" src="http://files.channel9.msdn.com/wlwimages/b99a24a9f48a4ce2b672a09b015ae985/clip_image001%5B5%5D.png" alt="clip_image001" width="678" height="655" border="0"></p><p>It is the <strong>VisualStateManager</strong> that controls the visibility of these elements. Since <strong>PageHub.xaml</strong> inherits from&nbsp; <strong>Common\LayoutAwarePage.cs</strong>, we already have the orientation and positioning handlers taken care of. When the app is &quot;snapped&quot; to the screen and has its visual footprint significantly reduced, the <strong>VisualStateManager</strong> will toggle the visibility of the main <strong>GridView</strong> to <strong>Collapsed</strong> while making the thinner <strong>ListView</strong> based interface visible as shown below:</p><p><img title="clip_image002" src="http://files.channel9.msdn.com/wlwimages/b99a24a9f48a4ce2b672a09b015ae985/clip_image002%5B3%5D-3.png" alt="clip_image002" width="691" height="621" border="0"></p><p>One other thing to note in this discussion is that while the <strong>ListView</strong> and <strong>GridView</strong> are both showing the same data, they would most likely need to reference different data templates and styles.</p><p>In the Khan Academy app, the <strong>ListView</strong> control that handles the snapped layout shares the same <strong>CollectionViewSource</strong> as the larger <strong>GridView</strong> control, but points to its own <strong>ItemTemplateSelector</strong> so that it will pull in the snapped styles accordingly.</p><p><img title="clip_image003" src="http://files.channel9.msdn.com/wlwimages/b99a24a9f48a4ce2b672a09b015ae985/clip_image003%5B3%5D-4.png" alt="clip_image003" width="713" height="639" border="0"></p><p>&nbsp;</p><h1><strong>The Search Contract</strong></h1><p>The Search Contract allows your app to register with the operating system as being searchable from the Windows 8 Search charm.</p><p>&nbsp;</p><p><a href="http://files.channel9.msdn.com/wlwimages/b99a24a9f48a4ce2b672a09b015ae985/image2.png"><img title="image" src="http://files.channel9.msdn.com/wlwimages/b99a24a9f48a4ce2b672a09b015ae985/image_thumb.png" alt="image" width="600" height="222" border="0"></a></p><p>&nbsp;</p><p>To set this up, we need to add some code to the <strong>LaunchApp()</strong> method in <strong>App.xaml.cs</strong> as shown below:</p><p><strong>App.xaml.cs</strong></p><p><pre class="brush: csharp">
public async void LaunchApp(
    ApplicationExecutionState previousExecutionState)
{
    DataSource = new KhanDataSource();
    await DataSource.LoadAllData();
 
    SearchPane searchPane = SearchPane.GetForCurrentView();
    searchPane.PlaceholderText = “Search Khan Academy”;
    searchPane.QuerySubmitted &#43;=
        (sender, queryArgs) =&gt;
        {
            KhanAcademy.SearchResultsPage.Activate(
                queryArgs.QueryText, previousExecutionState);
        };
        […]
</pre></p><p>&nbsp;</p><p>First, we get the <strong>SearchPane</strong> object for the current app. Once we have a handle to the instance of the pane, we can set some properties to make the search experience a bit more tailored to our app. Namely, we set the <strong>PlaceholderText</strong> property to the string “Search Khan Academy”. Finally, we hook the <strong>QuerySubmitted</strong> event off the <strong>SearchPane</strong> object, which will be called once the user presses the Enter key or clicks/taps the magnifying glass icon to the right of the search box. In the event handler, the <strong>SearchResultsPage</strong> is activated and displayed with the user’s query text passed to the page.</p><p>The Search pane can also handle real-time suggestions based on the query the user is typing. To do this, we just need to handle the <strong>SuggestionsRequested</strong> and <strong>ResultSuggestionChosen</strong> events as shown:</p><p><strong>C#</strong></p><p><pre class="brush: csharp">
            searchPane.SuggestionsRequested &#43;= 
                (sender, suggestionArgs) =&gt;
                {
                    var videos = App.DataSource.TopicGroups.SelectMany(g =&gt;
                        g.Playlists.SelectMany(p =&gt; p.Videos.Where(v =&gt;
                            Regex.IsMatch(v.Name ?? &quot;&quot;, suggestionArgs.QueryText, RegexOptions.IgnoreCase) ||
                            Regex.IsMatch(v.Description ?? &quot;&quot;, suggestionArgs.QueryText, RegexOptions.IgnoreCase))))
                            .Distinct(VideoItem.CreateComparer())
                            .Take(3);
                    foreach(VideoItem vi in videos)
                        suggestionArgs.Request.SearchSuggestionCollection.AppendQuerySuggestion(vi.Title);
                    var recommended = App.DataSource.TopicGroups.SelectMany(g =&gt;
                        g.Playlists.SelectMany(p =&gt; p.Videos.Where(v =&gt;
                            Regex.IsMatch(v.Name ?? &quot;&quot;, suggestionArgs.QueryText, RegexOptions.IgnoreCase)))).FirstOrDefault();
                    if(recommended != null)
                    {
                        suggestionArgs.Request.SearchSuggestionCollection.AppendSearchSeparator(&quot;Recommended&quot;);
                        IRandomAccessStreamReference imgStream = RandomAccessStreamReference.CreateFromUri(recommended.ImagePath);
                        suggestionArgs.Request.SearchSuggestionCollection.AppendResultSuggestion(recommended.Title, recommended.Description, recommended.VideoPath.ToString(), imgStream, recommended.Title);
                    }
                };
            searchPane.ResultSuggestionChosen &#43;=
                (sender, resultArgs) =&gt;
                {
                    var recommended = App.DataSource.TopicGroups.SelectMany(g =&gt;
                        g.Playlists.SelectMany(p =&gt; p.Videos.Where(v =&gt;
                            Regex.IsMatch(v.VideoPath.ToString() ?? &quot;&quot;, resultArgs.Tag, RegexOptions.IgnoreCase)))).FirstOrDefault();
                    Frame f = Window.Current.Content as Frame;
                    f.Navigate(typeof(VideoPage), JsonSerializer.Serialize(recommended));
                };
</pre></p><p>&nbsp;</p><p>In the <strong>SuggestionRequested</strong> event handler, we use a LINQ query to find the first 3 results that match what the user is typing and add them to the suggestions list using the <strong>AppendQuerySuggestion</strong> method off the <strong>SearchSuggestionCollection</strong> object. In addition, we also use LINQ to find the closest match to what the user is typing to display and display that after a line separator.</p><p>The line gets added with the <strong>AppendSearchSeparator</strong> method, and the single result gets added with the <strong>AppendResultSuggestion</strong> method. The specific result suggestion can include an icon, and we get the stream for that icon using the <strong>CreateFromUri</strong> method off the <strong>RandomAccessStreamReference</strong> object, passing in the path to the image we want to use as the icon. This returns the <strong>IRandomAccessStreamReference</strong> required by the <strong>AppendResultSuggestion</strong> method.</p><p>In the <strong>ResultSuggestionChosen</strong> method, we determine which suggestion the user selected and then navigate to the <strong>VideoPage</strong> to show the video to the user.</p><p>&nbsp;</p><h1><strong>The Share and Devices Contracts</strong></h1><p>The <strong>Share Contract</strong> allows the user to share a piece of data from the current app to another app which knows how to receive the data. For our app, we wanted to allow the user to share a link to the video they are watching to other apps. This works great with the Windows 8 mail app.</p><p>&nbsp;<a href="http://files.channel9.msdn.com/wlwimages/b99a24a9f48a4ce2b672a09b015ae985/image5.png"><img title="image" src="http://files.channel9.msdn.com/wlwimages/b99a24a9f48a4ce2b672a09b015ae985/image_thumb1.png" alt="image" width="600" height="338" border="0"></a></p><p>&nbsp;</p><p>To accomplish this, we override the <strong>DataRequested</strong> method on the <strong>VideoPage</strong> class as shown:</p><p><strong>VideoPage.xaml.cs</strong></p><p><pre class="brush: csharp">
public sealed partial class VideoPage
    : KhanAcademy.Common.LayoutAwarePage
{
    private PlayToManager _playToManager = null;
    private CoreDispatcher _dispatcher = null;
    private DisplayRequest _displayRequest = null;
 
    public VideoPage()
    {
        this.InitializeComponent();
    }
    protected override void DataRequested(
        DataTransferManager sender,
        DataRequestedEventArgs args)
    {
        VideoItem vi = (this.DataContext as VideoItem);
        args.Request.Data.Properties.Title = vi.Name;
        args.Request.Data.Properties.Description = vi.Description;
        args.Request.Data.SetUri(vi.KhanPath);
    }
</pre></p><p>In this method, we get the <strong>VideoItem</strong> that is currently being played, and use its properties to fill out the Data object property of the Request object. The <strong>SetUri</strong> method is used to pass the actual Uri to the Khan Academy website.</p><p>Finally, we wanted to enable <strong>PlayTo</strong> functionality so the user can quickly and easily send the video output to a TV or other media device on the network. The user can choose to do this while watching the video by selecting the <strong>Devices charm</strong>. Any PlayTo-enabled devices on the network will show up in this device list.</p><p>In code, we handle this scenario in the <strong>OnNavigatedTo</strong> and <strong>OnNavigatedFrom</strong> overridden methods.</p><p><strong>VideoPage.xaml.cs</strong></p><p><pre class="brush: csharp">
protected override void OnNavigatedTo(NavigationEventArgs e)
{
    _dispatcher = Window.Current.CoreWindow.Dispatcher;
    _playToManager = PlayToManager.GetForCurrentView();
    _playToManager.SourceRequested &#43;= playToManager_SourceRequested;
    if(_displayRequest == null)
        _displayRequest = new DisplayRequest();
    _displayRequest.RequestActive();
    base.OnNavigatedTo(e);
}
protected override void OnNavigatedFrom(NavigationEventArgs e)
{
    _playToManager.SourceRequested -= playToManager_SourceRequested;
    if(_displayRequest != null)
        _displayRequest.RequestRelease();
    base.OnNavigatedFrom(e);
}
void playToManager_SourceRequested(PlayToManager sender, PlayToSourceRequestedEventArgs args)
{
    var deferral = args.SourceRequest.GetDeferral();
    var handler = _dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =&gt;
    {
        args.SourceRequest.SetSource(videoElement.PlayToSource);
        deferral.Complete();
    });
}
</pre></p><p>In the <strong>OnNavigatedTo</strong> method, we get an instance of the <strong>PlayToManager</strong> and hook the <strong>SourceRequested</strong> event. We also grab an instance of the current Dispatcher. In the <strong>SourceRequested</strong> event handler, we request a deferral. This tells the PlayTo manager to wait until we give it the PlayTo source so the request doesn’t time out. We then, using the dispatcher, set the source of the PlayTo request to the video player’s <strong>PlayToSource</strong> property, and then complete the deferral. At this point, the PlayTo request is sent and the media player talks to the OS to make the magic happen. Note that in the <strong>OnNavigatedFrom</strong> method we unhook the <strong>SourceRequested</strong> event handler since it is no longer needed once the user navigates away from this page.</p><p>So at this point, we have come up with a migration strategy for porting our Windows Phone 8 to Windows 8, handled changes to how we handle asynchronous data requests and have a well styled, data bound interface that leverages the newest features of Windows 8. From here, the next step would be submitting to the store for distribution.</p><p>Hopefully, this set of quickstarts has covered some key areas of interest in getting your app up and running on Windows 8.</p><p>I would like to extend a tremendous amount of gratitude for Joel Martinez and all his tireless work as well as opening up the <strong><em>Viewer for Khan Academy</em></strong> app to serve as a Coding4Fun Community project here on Channel 9.</p><p>The source code for the Windows 8 Khan Academy app is available for <a href="https://github.com/joelmartinez/Khan-Academy-for-WinRT">download</a>:</p><p>&nbsp;</p><p>If you have any questions, comments, or feedback feel free to join in the discussion.</p><p>Twitter: @<a href="http://twitter.com/rickbarraza">rickbarraza</a>, <a href="http://twitter.com/joelmartinez">@joelmartinez</a></p> <img src="http://m.webtrends.com/dcs1wotjh10000w0irc493s0e_6x1g/njs.gif?dcssip=channel9.msdn.com&dcsuri=http://channel9.msdn.com/Series/Migrating-apps-from-Windows-Phone-to-Windows-8/feed&WT.dl=0&WT.entryid=Entry:RSSView:ea258cf458514bb2b1b5a0a00157701d">]]></description>
      <comments>http://channel9.msdn.com/Series/Migrating-apps-from-Windows-Phone-to-Windows-8/Features-and-Contracts-in-Windows-Store-Apps</comments>
      <itunes:summary>&amp;nbsp; While the goal of these quickstarts is to discuss the issues and solutions involved in porting our Windows Phone 7 app to a Windows&amp;nbsp;Store app, there are some features and requirements in Windows 8 we wanted to address: snapping and appcontracts. Windows 8 Contracts provide OS level functionality and can significantly extend the power of your app when implemented properly. In this video, we will look at two contracts we implemented, the Search Contract and the Share Contract. But first, let us look at how snapping is handled in a Windows&amp;nbsp;Store app. &amp;nbsp; Handling Window SnappingAs we discussed in the last Quickstart, snapping can have a significant impact on how you choose to present your app interface. In a typical template project page, we will find a GridView and ListView element both positioned in Grid.Row=&amp;quot;1&amp;quot; under the navigation and page header row of our root grid.  It is the VisualStateManager that controls the visibility of these elements. Since PageHub.xaml inherits from&amp;nbsp; Common\LayoutAwarePage.cs, we already have the orientation and positioning handlers taken care of. When the app is &amp;quot;snapped&amp;quot; to the screen and has its visual footprint significantly reduced, the VisualStateManager will toggle the visibility of the main GridView to Collapsed while making the thinner ListView based interface visible as shown below:  One other thing to note in this discussion is that while the ListView and GridView are both showing the same data, they would most likely need to reference different data templates and styles. In the Khan Academy app, the ListView control that handles the snapped layout shares the same CollectionViewSource as the larger GridView control, but points to its own ItemTemplateSelector so that it will pull in the snapped styles accordingly.  &amp;nbsp; The Search ContractThe Search Contract allows your app to register with the operating system as being searchable from the Windows 8 Search charm. &amp;nbsp;  &amp;nbsp; To </itunes:summary>
      <itunes:duration>881</itunes:duration>
      <link>http://channel9.msdn.com/Series/Migrating-apps-from-Windows-Phone-to-Windows-8/Features-and-Contracts-in-Windows-Store-Apps</link>
      <pubDate>Wed, 26 Sep 2012 19:53:32 GMT</pubDate>
      <guid isPermaLink="false">http://channel9.msdn.com/Series/Migrating-apps-from-Windows-Phone-to-Windows-8/Features-and-Contracts-in-Windows-Store-Apps</guid>
      <media:thumbnail url="http://media.ch9.ms/ch9/ae72/4454b2eb-7567-4803-8c31-ff4797c1ae72/Phone7toWin8QS05_100.jpg" height="56" width="100"></media:thumbnail>
      <media:thumbnail url="http://media.ch9.ms/ch9/ae72/4454b2eb-7567-4803-8c31-ff4797c1ae72/Phone7toWin8QS05_220.jpg" height="123" width="220"></media:thumbnail>
      <media:thumbnail url="http://media.ch9.ms/ch9/ae72/4454b2eb-7567-4803-8c31-ff4797c1ae72/Phone7toWin8QS05_512.jpg" height="288" width="512"></media:thumbnail>
      <media:group>
        <media:content url="http://media.ch9.ms/ch9/ae72/4454b2eb-7567-4803-8c31-ff4797c1ae72/Phone7toWin8QS05.mp3" expression="full" duration="881" fileSize="14099628" type="audio/mp3" medium="audio"></media:content>
        <media:content url="http://media.ch9.ms/ch9/ae72/4454b2eb-7567-4803-8c31-ff4797c1ae72/Phone7toWin8QS05.mp4" expression="full" duration="881" fileSize="83158376" type="video/mp4" medium="video"></media:content>
        <media:content url="http://media.ch9.ms/ch9/ae72/4454b2eb-7567-4803-8c31-ff4797c1ae72/Phone7toWin8QS05.webm" expression="full" duration="881" fileSize="31151308" type="video/webm" medium="video"></media:content>
        <media:content url="http://media.ch9.ms/ch9/ae72/4454b2eb-7567-4803-8c31-ff4797c1ae72/Phone7toWin8QS05.wma" expression="full" duration="881" fileSize="7130519" type="audio/x-ms-wma" medium="audio"></media:content>
        <media:content url="http://media.ch9.ms/ch9/ae72/4454b2eb-7567-4803-8c31-ff4797c1ae72/Phone7toWin8QS05.wmv" expression="full" duration="881" fileSize="46701173" type="video/x-ms-wmv" medium="video"></media:content>
        <media:content url="http://media.ch9.ms/ch9/ae72/4454b2eb-7567-4803-8c31-ff4797c1ae72/Phone7toWin8QS05_high.mp4" expression="full" duration="881" fileSize="182437332" type="video/mp4" medium="video"></media:content>
        <media:content url="http://media.ch9.ms/ch9/ae72/4454b2eb-7567-4803-8c31-ff4797c1ae72/Phone7toWin8QS05_mid.mp4" expression="full" duration="881" fileSize="127445509" type="video/mp4" medium="video"></media:content>
        <media:content url="http://media.ch9.ms/ch9/ae72/4454b2eb-7567-4803-8c31-ff4797c1ae72/Phone7toWin8QS05_Source.wmv" expression="full" duration="881" fileSize="113621308" type="video/x-ms-wmv" medium="video"></media:content>
        <media:content url="http://smooth.ch9.ms/ch9/ae72/4454b2eb-7567-4803-8c31-ff4797c1ae72/Phone7toWin8QS05.ism/manifest" expression="full" duration="881" fileSize="6076" type="video/x-ms-wmv" medium="video"></media:content>
      </media:group>      
      <enclosure url="http://media.ch9.ms/ch9/ae72/4454b2eb-7567-4803-8c31-ff4797c1ae72/Phone7toWin8QS05.wmv" length="46701173" type="video/x-ms-wmv"></enclosure>
      <dc:creator>Brian Peek, Rick Barraza</dc:creator>
      <itunes:author>Brian Peek, Rick Barraza</itunes:author>
      <slash:comments>0</slash:comments>
      <wfw:commentRss>http://channel9.msdn.com/Series/Migrating-apps-from-Windows-Phone-to-Windows-8/Features-and-Contracts-in-Windows-Store-Apps/RSS</wfw:commentRss>
      <category>Windows Phone</category>
      <category>Windows Store App</category>
      <category>Microsoft Design Style</category>
      <category>WindowsContent</category>
    </item>
  <item>
      <title>Custom Styling in Windows Store Apps</title>
      <description><![CDATA[<p>&nbsp;</p><p>Now that we have the data properly formatted and bound to the controls, this video will focus on custom styling and interface elements in our app.</p><p>&nbsp;</p><h1><strong>Setting up Custom Styles</strong></h1><p>As we've discussed in the previous Quickstarts, by basing our migration effort on one of the Windows 8 Templates in Visual Studio 2012, our project came with a <strong>Common</strong> and <strong>Data</strong> folder filled with classes and resources ready to use. The <strong>Common\StandardStyles.xaml</strong> file provides the default styling for all the elements in the template and is a great place to start when customizing your own interface.</p><p>However, to keep things organized, we created a new file and also placed it in the Common folder called <strong>CustomStyles.xaml</strong>. By using inheritance, we are able to keep most of our custom edits in <strong>CustomStyles.xaml</strong> and leave <strong>StandardStyles.xaml</strong> relatively unchanged.</p><p><img title="clip_image001" src="http://files.channel9.msdn.com/wlwimages/b99a24a9f48a4ce2b672a09b015ae985/clip_image001%5B3%5D-2.png" alt="clip_image001" width="328" height="412" border="0"></p><p>It may be designer preference, but one exception to this separation between <strong>CustomStyles.xaml</strong> and <strong>StandardStyles.xaml</strong> was the inclusion of custom of global colors, which we put at the very top of the <strong>StandardStyles.xaml</strong> file since we would want them to affect all subsequent styles, including the defaults.</p><p><strong>StandardStyles.xaml</strong></p><p><pre class="brush: text">
&lt;ResourceDictionary
    xmlns=&quot;<a href="http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;">http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;</a>
    xmlns:x=&quot;<a href="http://schemas.microsoft.com/winfx/2006/xaml&quot;">http://schemas.microsoft.com/winfx/2006/xaml&quot;</a>
    xmlns:vsm=&quot;using:Windows.UI.Xaml&quot;
    &gt;
&lt;!-- Non-brush values that vary across themes –&gt;
&lt;ResourceDictionary.ThemeDictionaries  […]  &gt;

&lt;!-- System Wide Overrides --&gt;
&lt;SolidColorBrush x:Key=&quot;ApplicationForegroundThemeBrush&quot;
    Color=&quot;#FF222E3D&quot; /&gt;
&lt;SolidColorBrush x:Key=&quot;ApplicationPageBackgroundThemeBrush&quot;
    Color=&quot;#FFD4DEB7&quot; /&gt;
&lt;SolidColorBrush x:Key=&quot;ApplicationPointerOverForegroundThemeBrush&quot;
    Color=&quot;#FFFFFFFF&quot; /&gt;
&lt;SolidColorBrush x:Key=&quot;ApplicationPressedForegroundThemeBrush&quot;
    Color=&quot;#FFFFFFFF&quot; /&gt;
&lt;SolidColorBrush x:Key=&quot;ButtonDisabledForegroundThemeBrush&quot;
    Color=&quot;#99222E3D&quot; /&gt;
&lt;SolidColorBrush x:Key=&quot;ListViewItemPlaceholderBackgroundThemeBrush&quot;
    Color=&quot;#FF222E3D&quot; /&gt;
&lt;SolidColorBrush x:Key=&quot;ListViewItemOverlayBackgroundThemeBrush&quot;
    Color=&quot;#FFFFFFFF&quot;/&gt;
&lt;SolidColorBrush x:Key=&quot;ListViewItemBackgroundThemeBrush&quot;
    Color=&quot;#FFFFFFFF&quot;/&gt;
&lt;SolidColorBrush x:Key=&quot;BackButtonForegroundThemeBrush&quot;
    Color=&quot;#FF222E3D&quot;/&gt;
&lt;SolidColorBrush x:Key=&quot;BackButtonPressedForegroundThemeBrush&quot;
    Color=&quot;#FFFFFFFF&quot;/&gt;
&lt;SolidColorBrush x:Key=&quot;BackButtonPointerOverBackgroundThemeBrush&quot;
    Color=&quot;#00000000&quot;/&gt;
</pre></p><p>However, all other custom style definitions are kept grouped together in a single file called <strong>CustomStyles.xaml</strong> which in turn references <strong>StandardStyles.xaml</strong> as a merged dictionary:</p><p><strong>CustomStyles.xaml</strong></p><p><pre class="brush: text">
&lt;ResourceDictionary
    xmlns=&quot;<a href="http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;">http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;</a> 
    xmlns:x=&quot;<a href="http://schemas.microsoft.com/winfx/2006/xaml&quot;">http://schemas.microsoft.com/winfx/2006/xaml&quot;</a>
    xmlns:vsm=&quot;using:Windows.UI.Xaml&quot;
    xmlns:local=&quot;using:KhanAcademy.Common&quot;&gt;
    
    &lt;vsm:ResourceDictionary.MergedDictionaries&gt;
        &lt;vsm:ResourceDictionary Source=&quot;StandardStyles.xaml&quot;/&gt;
    &lt;/vsm:ResourceDictionary.MergedDictionaries&gt;
</pre></p><p>In this way, custom styles we define in <strong>CustomStyles.xaml</strong> can be <strong>BasedOn</strong> template styles already defined in<strong> StandardStyles.xaml</strong> with only minimal change, if we only intend to customize a few properties of an existing template:</p><p><strong>CustomStyles.xaml</strong></p><p><pre class="brush: text">
&lt;vsm:Style x:Key=&quot;TopicItemTextStyleTitle&quot; 
           TargetType=&quot;TextBlock&quot; 
           BasedOn=&quot;{StaticResource BaselineTextStyle}&quot;&gt;
    &lt;vsm:Setter Property=&quot;FontSize&quot; Value=&quot;12&quot;/&gt;
    &lt;vsm:Setter Property=&quot;LineHeight&quot; Value=&quot;16&quot;/&gt;
    &lt;vsm:Setter Property=&quot;FontWeight&quot; Value=&quot;SemiBold&quot;/&gt;
    &lt;vsm:Setter Property=&quot;Foreground&quot; 
                Value=&quot;{StaticResource TopicItemForegroundTextBrush}&quot;/&gt;
    &lt;vsm:Setter Property=&quot;VerticalAlignment&quot; 
                Value=&quot;Center&quot;/&gt;
&lt;/vsm:Style&gt;
</pre></p><p>Of course, we don't need to base our new elements on existing elements. We can always create new styles and templates from scratch as needed:</p><p><strong>CustomStyles.xaml</strong></p><p><pre class="brush: text">
&lt;vsm:DataTemplate x:Key=&quot;TopicItemTemplate&quot;&gt;
    &lt;Grid HorizontalAlignment=&quot;Left&quot; 
            Width=&quot;220&quot; 
            Height=&quot;110&quot; 
            Background=&quot;White&quot; 
            Margin=&quot;0,0,2,2&quot;&gt;
        &lt;Grid.RowDefinitions&gt;
            &lt;RowDefinition Height=&quot;2&quot;/&gt;
            &lt;RowDefinition Height=&quot;38&quot;/&gt;
            &lt;RowDefinition Height=&quot;69&quot;/&gt;
        &lt;/Grid.RowDefinitions&gt;
        &lt;Rectangle Grid.Row=&quot;0&quot; 
                    Width=&quot;220&quot; 
                    Height=&quot;2&quot; 
                    Fill=&quot;{Binding Color}&quot;/&gt;
        &lt;TextBlock Grid.Row=&quot;1&quot; 
                    Text=&quot;{Binding Name}&quot; 
                    Style=&quot;{StaticResource TopicItemTextStyleTitle}&quot; 
                    VerticalAlignment=&quot;Center&quot; 
                    Padding=&quot;10,0,10,0&quot;/&gt;
        &lt;TextBlock Grid.Row=&quot;2&quot; 
                    Text=&quot;{Binding Description}&quot; 
                    Style=&quot;{StaticResource TopicItemTextStyleBody}&quot; 
                    TextWrapping=&quot;Wrap&quot; 
                    VerticalAlignment=&quot;Top&quot; 
                    Margin=&quot;10,5,10,5&quot;/&gt;
    &lt;/Grid&gt;
&lt;/vsm:DataTemplate&gt;
   
</pre></p><p>Notice that the <strong>DataTemplate</strong> shown above is assuming bindable properties of the elements it will be formatting, which we already reviewed in the Data Binding Quickstart.</p><p>Since <strong>CustomStyles.xaml</strong> is already merging in <strong>StandardStyles.xaml</strong> as a Resource Dictionary, we only need to reference <strong>CustomStyles.xaml</strong> directly in <strong>App.xaml</strong> to get access to the entire collection of custom and standard styles.</p><p><strong>App.xaml</strong></p><p><pre class="brush: text">
&lt;Application.Resources&gt;
    &lt;ResourceDictionary&gt;
        &lt;ResourceDictionary.MergedDictionaries&gt;
            &lt;ResourceDictionary Source=&quot;Common/CustomStyles.xaml&quot;/&gt;
        &lt;/ResourceDictionary.MergedDictionaries&gt;
        &lt;x:String x:Key=&quot;AppName&quot;&gt;KhanAcademy&lt;/x:String&gt;
    &lt;/ResourceDictionary&gt;
&lt;/Application.Resources&gt;
</pre></p><p>&nbsp;</p><h1><strong>Working with Template Selectors</strong></h1><p>As discussed in our Data Binding Quickstart, we wanted to implement a Hub type experience for the Khan Academy landing page. This meant that the interface would be displaying both collections of Playlists and individual playlist collections of Videos. These two types of objects would look different from each other, since Videos have a thumbnail graphic and Playlists only display their title and description.</p><p>The challenge was that our single Grid View would need to display both types of objects, but using different styling for each.So we needed a solution to switch templates based on object type.</p><p>If we look at the way the default<strong> Grid View</strong> Template Project works, we see that its <strong>ItemTemplate</strong> property references a specific <strong>StaticResource</strong>. In this case, the <strong>Standard250x250ItemTemplate</strong> description found in <strong>Common\StandardStyles.xaml:</strong></p><p><strong>GroupedItemsPage.xaml</strong></p><p><pre class="brush: text">
&lt;GridView
    x:Name=&quot;itemGridView&quot;
    AutomationProperties.AutomationId=&quot;ItemGridView&quot;
    AutomationProperties.Name=&quot;Grouped Items&quot;
    Grid.RowSpan=&quot;2&quot;
    Padding=&quot;116,137,40,46&quot;
    ItemsSource=
        &quot;{Binding Source={StaticResource groupedItemsViewSource}}&quot;
    ItemTemplate=&quot;{StaticResource Standard250x250ItemTemplate}&quot;
    SelectionMode=&quot;None&quot;
    IsSwipeEnabled=&quot;false&quot;
    IsItemClickEnabled=&quot;True&quot;
    ItemClick=&quot;ItemView_ItemClick&quot;&gt;
</pre></p><p>That is the way it often works. You use a specific, <strong>StaticResource</strong> reference on the <strong>ItemTemplate</strong> property of the container you have bound to your data.</p><p>But in the Khan Academy project, if you look at the <strong>GridView</strong> setup on<strong> Hub.xaml</strong>, you'll see that we are not using a <strong>StaticResource</strong> on the <strong>ItemTemplate</strong> property, but setting a value for the GridView’s<strong> ItemTemplateSelector</strong> property instead:</p><p><strong>HubPage.xaml</strong></p><p><pre class="brush: text">
&lt;GridView
    x:Name=&quot;itemGridView&quot;
    AutomationProperties.AutomationId=&quot;ItemGridView&quot;
    AutomationProperties.Name=&quot;Grouped Items&quot;
    Margin=&quot;0,-3,0,0&quot;
    Padding=&quot;120,0,40,60&quot;
    VerticalAlignment=&quot;Top&quot;
    ItemsSource=&quot;{Binding Source={StaticResource groupedItemsViewSource}}&quot;
    ItemTemplateSelector=&quot;{StaticResource TemplateSelector}&quot;
    SelectionMode=&quot;None&quot;
    IsItemClickEnabled=&quot;True&quot;
    ItemClick=&quot;ItemView_ItemClick&quot;&gt;
</pre></p><p><strong>ItemTemplateSelector</strong> is referencing a local resource we added to the page resources:</p><p><strong>HubPage.xaml</strong></p><p><pre class="brush: text">
&lt;Page.Resources&gt;
&lt;local:HubItemSelector x:Key=&quot;TemplateSelector&quot;
    Topic=&quot;{StaticResource TopicItemTemplate}&quot;
    Playlist=&quot;{StaticResource PlaylistItemTemplate}&quot;
    Video=&quot;{StaticResource FeaturedVideoItemTemplate}&quot; &gt;
&lt;/local:HubItemSelector&gt;   
</pre></p><p>Based on the return type of <strong>HubItemSelector</strong>, this <strong>ItemTemplateSelector</strong> will redirect the template to whatever template you define in the look up. So what does the class <strong>HubItemSelector</strong> actually look like?</p><p><strong>HubItemSelector.cs</strong></p><p><pre class="brush: csharp">
public class HubItemSelector : DataTemplateSelector
    {
        public DataTemplate Video { get; set; }
        public DataTemplate Playlist { get; set; }
        public DataTemplate Topic { get; set; }
        protected override DataTemplate SelectTemplateCore(object item, DependencyObject container)
        {
            DataItem dataItem = item as DataItem;
            if (dataItem.GetType() == typeof(VideoItem))
            {
                return Playlist;
            }
            else
            {
                return Topic;
            }
        }
    }
</pre></p><p>&nbsp;</p><p>This technique can definitely come in handy if you are experimenting with Hub style interfaces and find yourself in a similar situation with your own app.</p><h4>&nbsp;</h4><h1><strong>Semantic Zoom</strong></h1><p>Like Windows Phone, modern Window 8 apps are Touch ready. As such, <a href="http://msdn.microsoft.com/en-us/library/windows/apps/hh465319.aspx">Semantic Zoom</a> is a powerful new control we can leverage in our apps. Semantic Zoom allows the user to switch views on a large body of data with a simple pinch gesture.</p><p>&nbsp;<a href="http://files.channel9.msdn.com/wlwimages/b99a24a9f48a4ce2b672a09b015ae985/image4.png"><img title="image" src="http://files.channel9.msdn.com/wlwimages/b99a24a9f48a4ce2b672a09b015ae985/image_thumb2.png" alt="image" width="600" height="261" border="0"></a></p><p>This gives us a great high level, low level metaphor we can leverage in our apps, and is very effective when we want to provide the experience of &quot;zooming out&quot; on a data set and simplifying or aggregating the smaller pieces of content. Here is how it works.</p><p>If we look at the default landing page of a Grid App template project, we see the following structure:</p><p><img title="clip_image012" src="http://files.channel9.msdn.com/wlwimages/b99a24a9f48a4ce2b672a09b015ae985/clip_image012%5B3%5D.png" alt="clip_image012" width="678" height="655" border="0"></p><p>After the Page is declared and has its Resources defined, the <strong>LayoutRootStyle</strong> grid is created with two main rows: a row for the header that meets the Windows 8 app styling guidelines, and a row for our content.</p><p>The template defines two elements that want to occupy <strong>Grid.Row=&quot;1&quot;.</strong> A <strong>GridView</strong> that is visible when the app is at normal size, and a <strong>ListView</strong> that is visible when the app is snapped. We will look at snapping in the next quickstart, but for now just realize that this collapsing of visibility is taken care of by the <strong>VisualStateManager</strong> also on the page.</p><p>If we look at <strong>HubPage.xaml</strong> in the Khan Academy app, though, we can see where <strong>SemanticZoom</strong> fits into the entire page structure.</p><p><img title="clip_image013" src="http://files.channel9.msdn.com/wlwimages/b99a24a9f48a4ce2b672a09b015ae985/clip_image013%5B3%5D.png" alt="clip_image013" width="676" height="809" border="0"></p><p>With this change, we make <strong>SemanticZoom</strong> is the primary element in <strong>Grid.Row=&quot;1&quot;</strong> as long as the app isn't snapped. The <strong>GridView</strong> element that used to be there can now be nested under the <strong>SemanticZoom.ZoomedInView</strong> property and will appear as expected. However, you now have a <strong>SemanticZoom.ZoomedOutView</strong> element you can fill with whatever you want.</p><p>The control is setup to support gestures automatically. By pinching the screen closed, the user will zoom out and the control will transition between the two containers automatically. While in a zoomed out state, if the user pinches outward, they will return to the default Zoomed In view.</p><p>But what about all that business with snapping we quickly brushed over? Snapping and other OS features will be the subject of our next quickstart.</p><p>If you have any questions, comments, or feedback feel free to join in the discussion.</p><p>Twitter: @<a href="http://twitter.com/rickbarraza">rickbarraza</a>, <a href="http://twitter.com/joelmartinez">@joelmartinez</a></p> <img src="http://m.webtrends.com/dcs1wotjh10000w0irc493s0e_6x1g/njs.gif?dcssip=channel9.msdn.com&dcsuri=http://channel9.msdn.com/Series/Migrating-apps-from-Windows-Phone-to-Windows-8/feed&WT.dl=0&WT.entryid=Entry:RSSView:c31eb425be3640858510a0a00156c1a8">]]></description>
      <comments>http://channel9.msdn.com/Series/Migrating-apps-from-Windows-Phone-to-Windows-8/Custom-Styling-in-Windows-Store-Apps</comments>
      <itunes:summary>&amp;nbsp; Now that we have the data properly formatted and bound to the controls, this video will focus on custom styling and interface elements in our app. &amp;nbsp; Setting up Custom StylesAs we&#39;ve discussed in the previous Quickstarts, by basing our migration effort on one of the Windows 8 Templates in Visual Studio 2012, our project came with a Common and Data folder filled with classes and resources ready to use. The Common\StandardStyles.xaml file provides the default styling for all the elements in the template and is a great place to start when customizing your own interface. However, to keep things organized, we created a new file and also placed it in the Common folder called CustomStyles.xaml. By using inheritance, we are able to keep most of our custom edits in CustomStyles.xaml and leave StandardStyles.xaml relatively unchanged.  It may be designer preference, but one exception to this separation between CustomStyles.xaml and StandardStyles.xaml was the inclusion of custom of global colors, which we put at the very top of the StandardStyles.xaml file since we would want them to affect all subsequent styles, including the defaults. StandardStyles.xaml 
&amp;lt;ResourceDictionary
    xmlns=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&amp;quot;
    xmlns:x=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml&amp;quot;
    xmlns:vsm=&amp;quot;using:Windows.UI.Xaml&amp;quot;
    &amp;gt;
&amp;lt;!-- Non-brush values that vary across themes –&amp;gt;
&amp;lt;ResourceDictionary.ThemeDictionaries  […]  &amp;gt;

&amp;lt;!-- System Wide Overrides --&amp;gt;
&amp;lt;SolidColorBrush x:Key=&amp;quot;ApplicationForegroundThemeBrush&amp;quot;
    Color=&amp;quot;#FF222E3D&amp;quot; /&amp;gt;
&amp;lt;SolidColorBrush x:Key=&amp;quot;ApplicationPageBackgroundThemeBrush&amp;quot;
    Color=&amp;quot;#FFD4DEB7&amp;quot; /&amp;gt;
&amp;lt;SolidColorBrush x:Key=&amp;quot;ApplicationPointerOverForegroundThemeBrush&amp;quot;
    Color=&amp;quot;#FFFFFFFF&amp;quot; /&amp;gt;
&amp;lt;SolidColorBrush x:Key=&amp;quot;ApplicationPressedForegroundThemeBrush&amp;quot;
    Color=&amp;quot;</itunes:summary>
      <itunes:duration>1171</itunes:duration>
      <link>http://channel9.msdn.com/Series/Migrating-apps-from-Windows-Phone-to-Windows-8/Custom-Styling-in-Windows-Store-Apps</link>
      <pubDate>Wed, 26 Sep 2012 19:53:26 GMT</pubDate>
      <guid isPermaLink="false">http://channel9.msdn.com/Series/Migrating-apps-from-Windows-Phone-to-Windows-8/Custom-Styling-in-Windows-Store-Apps</guid>
      <media:thumbnail url="http://media.ch9.ms/ch9/7dd3/3ae90ef2-a9cd-4116-a757-cbeb55067dd3/Phone7toWin8QS04_100.jpg" height="56" width="100"></media:thumbnail>
      <media:thumbnail url="http://media.ch9.ms/ch9/7dd3/3ae90ef2-a9cd-4116-a757-cbeb55067dd3/Phone7toWin8QS04_220.jpg" height="123" width="220"></media:thumbnail>
      <media:thumbnail url="http://media.ch9.ms/ch9/7dd3/3ae90ef2-a9cd-4116-a757-cbeb55067dd3/Phone7toWin8QS04_512.jpg" height="288" width="512"></media:thumbnail>
      <media:group>
        <media:content url="http://media.ch9.ms/ch9/7dd3/3ae90ef2-a9cd-4116-a757-cbeb55067dd3/Phone7toWin8QS04.mp3" expression="full" duration="1171" fileSize="18741386" type="audio/mp3" medium="audio"></media:content>
        <media:content url="http://media.ch9.ms/ch9/7dd3/3ae90ef2-a9cd-4116-a757-cbeb55067dd3/Phone7toWin8QS04.mp4" expression="full" duration="1171" fileSize="110306809" type="video/mp4" medium="video"></media:content>
        <media:content url="http://media.ch9.ms/ch9/7dd3/3ae90ef2-a9cd-4116-a757-cbeb55067dd3/Phone7toWin8QS04.webm" expression="full" duration="1171" fileSize="42283894" type="video/webm" medium="video"></media:content>
        <media:content url="http://media.ch9.ms/ch9/7dd3/3ae90ef2-a9cd-4116-a757-cbeb55067dd3/Phone7toWin8QS04.wma" expression="full" duration="1171" fileSize="9476643" type="audio/x-ms-wma" medium="audio"></media:content>
        <media:content url="http://media.ch9.ms/ch9/7dd3/3ae90ef2-a9cd-4116-a757-cbeb55067dd3/Phone7toWin8QS04.wmv" expression="full" duration="1171" fileSize="55284449" type="video/x-ms-wmv" medium="video"></media:content>
        <media:content url="http://media.ch9.ms/ch9/7dd3/3ae90ef2-a9cd-4116-a757-cbeb55067dd3/Phone7toWin8QS04_high.mp4" expression="full" duration="1171" fileSize="241397583" type="video/mp4" medium="video"></media:content>
        <media:content url="http://media.ch9.ms/ch9/7dd3/3ae90ef2-a9cd-4116-a757-cbeb55067dd3/Phone7toWin8QS04_mid.mp4" expression="full" duration="1171" fileSize="169377939" type="video/mp4" medium="video"></media:content>
        <media:content url="http://media.ch9.ms/ch9/7dd3/3ae90ef2-a9cd-4116-a757-cbeb55067dd3/Phone7toWin8QS04_Source.wmv" expression="full" duration="1171" fileSize="138801092" type="video/x-ms-wmv" medium="video"></media:content>
        <media:content url="http://smooth.ch9.ms/ch9/7dd3/3ae90ef2-a9cd-4116-a757-cbeb55067dd3/Phone7toWin8QS04.ism/manifest" expression="full" duration="1171" fileSize="6076" type="video/x-ms-wmv" medium="video"></media:content>
      </media:group>      
      <enclosure url="http://media.ch9.ms/ch9/7dd3/3ae90ef2-a9cd-4116-a757-cbeb55067dd3/Phone7toWin8QS04.wmv" length="55284449" type="video/x-ms-wmv"></enclosure>
      <dc:creator>Rick Barraza</dc:creator>
      <itunes:author>Rick Barraza</itunes:author>
      <slash:comments>1</slash:comments>
      <wfw:commentRss>http://channel9.msdn.com/Series/Migrating-apps-from-Windows-Phone-to-Windows-8/Custom-Styling-in-Windows-Store-Apps/RSS</wfw:commentRss>
      <category>Windows Phone</category>
      <category>Windows Store App</category>
      <category>Microsoft Design Style</category>
      <category>WindowsContent</category>
    </item>
  <item>
      <title>Binding the Interface in Windows Store apps</title>
      <description><![CDATA[<p>&nbsp;</p><p>In the previous Quickstarts, we have introduced the app and looked at handling data requests and formatting. In this next video, we will look at binding that data to the interface.</p><h1><strong>Binding and Windows 8 Templates</strong></h1><p>Data binding plays a central role in the Windows&nbsp;Store project templates available in Visual Studio 2012. For our project, we used the <strong>Grid App template</strong> available in Visual Studio 2012 as our base for the Khan Academy app. So let's see how this template is setup.</p><p>As we discussed in the first Quickstart of this series, creating a new project based on the Grid template will populate your project with sample pages and assets, a common folder of useful classes, and a data folder with a view model all ready to go. The default XAML pages such as <strong>GroupedItemsPage.xaml</strong> will also be wired up as they will inherit from <strong>LayoutAwarePage.cs</strong> in the Common folder to common system events of initialization, navigation and orientation.</p><p>But also notice the inclusion of a new class called <strong>BindableBase.cs</strong> in the Common folder. The default Data Model comes with every Template project inherits its collection elements from this class and by studying how the sample pages are wired up to the default Data Model is a great way to get up to speed quickly on Data Binding basics in Windows 8.</p><p><img title="clip_image001" src="http://files.channel9.msdn.com/wlwimages/b99a24a9f48a4ce2b672a09b015ae985/clip_image001%5B3%5D-1.png" alt="clip_image001" width="280" height="480" border="0"></p><p>Let’s take a closer look at the Data Model for a Grid App Template project, <strong>DataModel\SampleDataSource.cs</strong>. This class has a collection of Groups in an <strong>ObservableCollection</strong> called <strong>AllGroups</strong>. Each group in <strong>AllGroups</strong> contains an <strong>ObservableCollection</strong> of <strong>DataItems</strong>. Both the <strong>SampleDataGroup</strong> and <strong>SampleDataItem</strong> inherit from the <strong>SampleDataCommon</strong> class.</p><p>The <strong>SampleDataCommon</strong> class, in turn, inherits from <strong>Common\BindableBase.cs</strong>, which we introduced above, and which allows all the objects to be bound by the UI controls.</p><p><strong>SampleDataSource.cs</strong></p><p><pre class="brush: csharp">
public abstract class SampleDataCommon : AppName.Common.BindableBase
</pre></p><p>In this Grid App Template, when the app first starts and <strong>App.xaml</strong> loads the landing page called <strong>GroupedItemsPage.xaml</strong>, the following code is run:</p><p><strong>GroupedItemsPage.xaml.cs</strong>:</p><p><pre class="brush: csharp">
protected override void LoadState(
    Object navigationParameter,
    Dictionary&lt;String, Object&gt; pageState)
{
    var sampleDataGroups = SampleDataSource.GetGroups(
        (String)navigationParameter);
    this.DefaultViewModel[&quot;Groups&quot;] = sampleDataGroups;
}
</pre></p><p>In this template sample, we create our Data Model by calling the SampleDataSource’s <strong>GetGroups()</strong> function, which returns an <strong>IEnumerable</strong> of <strong>SampleDataGroup</strong> values. This bindable collection of <strong>Groups</strong> is then assigned to the DefaultViewModel's <strong>Group</strong> element.</p><p>But what is a <strong>DefaultViewModel[“Groups”]</strong> element anyway? Remember, these UI Pages we are exploring in the Template project all inherit from <strong>Common\LayoutAwarePage.cs</strong>:</p><p><strong>GroupedItemsPage.xaml.cs</strong></p><p><pre class="brush: csharp">
public sealed partial class GroupedItemsPage
    : AppName.Common.LayoutAwarePage
{
    public GroupedItemsPage()
    {
        this.InitializeComponent();
    }
    […]
</pre></p><p>And here we see the true power of leveraging the Windows&nbsp;Store Project&nbsp;Templates as a basis for projects. <strong>LayoutAwarePage.cs</strong> is a robust implementation of a Windows 8 app page that provides several important conveniences: app view state to visual state mapping, page navigation event handlers and mouse and keyboard shortcuts, state management for navigation and process lifetime management, and most relevant to us right now, a default view model too:</p><p><strong>C#</strong></p><p><pre class="brush: csharp">
public LayoutAwarePage()
{
    if (Windows.ApplicationModel.DesignMode.DesignModeEnabled)
        return;
 
    // Create an empty default view model
    this.DefaultViewModel =
        new ObservableDictionary&lt;String, Object&gt;();   
    […]
</pre></p><p>The last piece of the puzzle for binding is found in the resources of the page:</p><p><strong>GroupedItemsPage.xaml</strong></p><p><pre class="brush: text">
&lt;Page.Resources&gt;
    &lt;CollectionViewSource
        x:Name=&quot;groupedItemsViewSource&quot;
        Source=&quot;{Binding Groups}&quot;
        IsSourceGrouped=&quot;true&quot;
        ItemsPath=&quot;TopItems&quot;
        d:Source=&quot;{Binding AllGroups,
            Source={d:DesignInstance
            Type=data:SampleDataSource,
            IsDesignTimeCreatable=True}}&quot;/&gt;
&lt;/Page.Resources&gt;
</pre></p><p>Here, a <strong>CollectionViewSource</strong> is being bound to the <strong>Groups</strong> element of the <strong>DefaultViewModel</strong>, which we just set to the response of <strong>SampleDataSource.GetGroups().</strong> A <strong>CollectionViewSource</strong> allows you to sort, filter and group the underlying data without directly manipulating the data.</p><p>Finally, the control on the page that will display the information has its <strong>ItemsSource</strong> property bound to the <strong>groupedItemsViewSource</strong>, which is a <strong>CollectionViewSource</strong>.</p><p><strong>XAML</strong>&nbsp;</p><p><pre class="brush: text">
&lt;GridView
    x:Name=&quot;itemGridView&quot;
    AutomationProperties.AutomationId=&quot;ItemGridView&quot;
    AutomationProperties.Name=&quot;Grouped Items&quot;
    Grid.RowSpan=&quot;2&quot;
    Padding=&quot;116,137,40,46&quot;
    ItemsSource=
        &quot;{Binding Source={StaticResource groupedItemsViewSource}}&quot;
    ItemTemplate=&quot;{StaticResource Standard250x250ItemTemplate}&quot;
    SelectionMode=&quot;None&quot;
    IsSwipeEnabled=&quot;false&quot;
    IsItemClickEnabled=&quot;True&quot;
    ItemClick=&quot;ItemView_ItemClick&quot;&gt;
</pre></p><p>Since there are no custom styles yet, the Item Template pulls from some standard templates also found in the Common folder to make everything work. If the <strong>CollectionViewSource</strong> has properly grouped data and the <strong>IsSourceGrouped</strong> property is set to true, the <strong>GridView</strong> takes care of the rest.</p><p>&nbsp;</p><h1><strong>The Khan Academy View Model</strong></h1><p>In the Khan Academy app, we follow a very similar pattern with a couple of changes.</p><p>First, as we’ve seen in the previous two Quickstarts, we are instantiating our <strong>KhanDataSource</strong> View Model from <strong>App.xaml</strong> directly in it’s<strong> LaunchApp()</strong> handler and then passing it along when we navigate to our landing page of choice.</p><p><strong>App.xaml.cs</strong></p><p><pre class="brush: csharp">
public async void LaunchApp(
     ApplicationExecutionState previousExecutedState)
{
     DataSource = new KhanDataSource();
     await DataSource.LoadAllData();
     var rootFrame = new Frame();
[…]
     if ( rootFrame.Content == null)
     {
          if ( !rootFrame.Navigate(
               typeof(HubPage),
               JsonSerializer.Serialize(DataSource.TopicGroups)))
          {
               throw new Exception(“Failed to create initial page”);
          }
     }
     Window.Current.Content = rootFrame;
     Window.Current.Activate();
}
</pre></p><p>When <strong>HubPage.xaml.cs</strong>, receives our Data Model upon initialization in its <strong>LoadState()</strong> handler, it uses this Data Model for its own local binding as shown below:</p><p><strong>HubPage.xaml.cs</strong><strong>&nbsp;</strong></p><p><pre class="brush: csharp">
protected override void LoadState(
     Object navigationParameter,
     Dictionary&lt;String, Object&gt; pageState)
{
     ObservableCollection&lt;TopicItem&gt; items =
          JsonSerializer.Deserialize&lt;ObservableCollection&lt;TopicItem&gt;&gt;(
               navigationParameter as string);
     this.DefaultViewModel[“Groups”] = items;
     this.groupGridView.ItemsSource = items;
}
</pre></p><p>Another difference between the <strong>KhanDataSource</strong> and the default <strong>SampleDataSource</strong> that comes with Template projects is an additional tier of data. Instead of having a simple collection of groups that contain items, the data returned from Khan Academy is organized by the app into top level Topics ( such as Math, Science, Hummanities, etc.), which each contain a collection of playlists ( Algebra, Arithmetic, Calculus, etc..). Each of these playlists is made up of a series of <strong>VideoItems</strong> that play the actual lessons.</p><p>To add an additional layer of complexity, to achieve a Hub experience in our welcoming page, we wanted to display multiple types of content to give the user a richer selection of items. However, having multiple types of content on the same container creates both a visual and navigational challenge.</p><p>For example, most of the groups displayed in <strong>HubPage.xaml</strong> are made up of playlist objects that have a title and description but no associated graphic.</p><p>&nbsp;<a href="http://files.channel9.msdn.com/wlwimages/b99a24a9f48a4ce2b672a09b015ae985/image%5B12%5D.png"><img title="image" src="http://files.channel9.msdn.com/wlwimages/b99a24a9f48a4ce2b672a09b015ae985/image_thumb%5B6%5D.png" alt="image" width="497" height="303" border="0"></a></p><p>Selecting a playlist object should take you to the <strong>ItemDetail.xaml</strong> page.</p><p>But we also wanted to feature at a top level videos from two specific playlists, <em>New &amp; Noteworthy</em> and <em>Talks &amp; Interviews.</em> These <strong>videoItems</strong> do have a associated thumbnail of the video they represent and clicking on these elements should take you to the <strong>VideoPage.xaml</strong> instead of the ItemDetail.xaml page.</p><p>&nbsp;<a href="http://files.channel9.msdn.com/wlwimages/b99a24a9f48a4ce2b672a09b015ae985/image%5B4%5D.png"><img title="image" src="http://files.channel9.msdn.com/wlwimages/b99a24a9f48a4ce2b672a09b015ae985/image_thumb%5B2%5D.png" alt="image" width="497" height="303" border="0"></a></p><p>We will discuss how we visually differentiate the styling of these two different types of objects in the next Quickstart. But for now, let us look at how we handle the Items being selected:</p><p><strong>C#</strong></p><p><pre class="brush: csharp">
void ItemView_ItemClick(object sender, ItemClickEventArgs e)
{
    if ( e.ClickItem.GetType() == typeof(PlaylistItem))
    {
        this.Frame.Navigate(
            typeof(ItemDetailPage),
           JsonSerializer.Serialize(e.ClickedItem));
    }
    else if ( e.ClickedItem.GetType() == typeof(VideoItem))
    {
        this.Frame.Navigate(
            typeof(VideoPage),
            JsonSerializer.Serialize(e.ClickedItem));
    }
}
</pre></p><p>Since we are sharing a data binding between two different types of content, we query the type of the item and pass the clicked item to the appropriate page.</p><p>If the user selected a video, we would go to the video player page which uses the video player from the <strong>Microsoft.Metro.PlayerFramework</strong> referenced in the Project. Selecting a playlist, though, takes you to the <strong>ItemDetailPage.xaml</strong> to show you the list of videos in that list. The data binding on the <strong>ItemDetailPage.xaml</strong> page works the same way once it receives the serialized ClickedItem as a <strong>navigationParameter</strong> in its <strong>LoadState()</strong> method.</p><p><strong>C#</strong></p><p><pre class="brush: csharp">
protected override void LoadState(
    Object navigationParameter,
    Dictionary&lt;String, Object&gt; pageState)
{
    PlaylistItem playlist =
        JsonSerializer.Deserialize&lt;PlaylistItem&gt;(
            navigationParameter as string);
    this.DefaultViewModel[“Group”] = playlist;
    this.DefaultViewModel[“Items”] = playlist.Videos;
}
</pre></p><p>The other pages in the Khan Academy app follow the same pattern. An item is selected, the app's Frame then Navigates to the appropriate Page, passing the selected item as a parameter, and finally the loaded Page parses the passed in object, and populates its local View Model with the appropriate data.</p><p>Now that our components are displaying the appropriate data and navigating to the correct Pages, it's time to add visual identity. In the next Quickstart, we will look at custom styling.</p><p>If you have any questions, comments, or feedback feel free to join in the discussion.</p><p>Twitter: @<a href="http://twitter.com/rickbarraza">rickbarraza</a>, <a href="http://twitter.com/joelmartinez">@joelmartinez</a></p> <img src="http://m.webtrends.com/dcs1wotjh10000w0irc493s0e_6x1g/njs.gif?dcssip=channel9.msdn.com&dcsuri=http://channel9.msdn.com/Series/Migrating-apps-from-Windows-Phone-to-Windows-8/feed&WT.dl=0&WT.entryid=Entry:RSSView:a64376560fcd472da348a0a001408801">]]></description>
      <comments>http://channel9.msdn.com/Series/Migrating-apps-from-Windows-Phone-to-Windows-8/Binding-the-Interface-in-Windows-Store-apps</comments>
      <itunes:summary>&amp;nbsp; In the previous Quickstarts, we have introduced the app and looked at handling data requests and formatting. In this next video, we will look at binding that data to the interface. Binding and Windows 8 TemplatesData binding plays a central role in the Windows&amp;nbsp;Store project templates available in Visual Studio 2012. For our project, we used the Grid App template available in Visual Studio 2012 as our base for the Khan Academy app. So let&#39;s see how this template is setup. As we discussed in the first Quickstart of this series, creating a new project based on the Grid template will populate your project with sample pages and assets, a common folder of useful classes, and a data folder with a view model all ready to go. The default XAML pages such as GroupedItemsPage.xaml will also be wired up as they will inherit from LayoutAwarePage.cs in the Common folder to common system events of initialization, navigation and orientation. But also notice the inclusion of a new class called BindableBase.cs in the Common folder. The default Data Model comes with every Template project inherits its collection elements from this class and by studying how the sample pages are wired up to the default Data Model is a great way to get up to speed quickly on Data Binding basics in Windows 8.  Let’s take a closer look at the Data Model for a Grid App Template project, DataModel\SampleDataSource.cs. This class has a collection of Groups in an ObservableCollection called AllGroups. Each group in AllGroups contains an ObservableCollection of DataItems. Both the SampleDataGroup and SampleDataItem inherit from the SampleDataCommon class. The SampleDataCommon class, in turn, inherits from Common\BindableBase.cs, which we introduced above, and which allows all the objects to be bound by the UI controls. SampleDataSource.cs 
public abstract class SampleDataCommon : AppName.Common.BindableBase
 In this Grid App Template, when the app first starts and App.xaml loads the landing page ca</itunes:summary>
      <itunes:duration>1131</itunes:duration>
      <link>http://channel9.msdn.com/Series/Migrating-apps-from-Windows-Phone-to-Windows-8/Binding-the-Interface-in-Windows-Store-apps</link>
      <pubDate>Wed, 26 Sep 2012 19:52:54 GMT</pubDate>
      <guid isPermaLink="false">http://channel9.msdn.com/Series/Migrating-apps-from-Windows-Phone-to-Windows-8/Binding-the-Interface-in-Windows-Store-apps</guid>
      <media:thumbnail url="http://media.ch9.ms/ch9/53b9/33a600f1-09b3-4c43-acfb-47e7e10753b9/Phone7toWin8QS03_100.jpg" height="56" width="100"></media:thumbnail>
      <media:thumbnail url="http://media.ch9.ms/ch9/53b9/33a600f1-09b3-4c43-acfb-47e7e10753b9/Phone7toWin8QS03_220.jpg" height="123" width="220"></media:thumbnail>
      <media:thumbnail url="http://media.ch9.ms/ch9/53b9/33a600f1-09b3-4c43-acfb-47e7e10753b9/Phone7toWin8QS03_512.jpg" height="288" width="512"></media:thumbnail>
      <media:group>
        <media:content url="http://media.ch9.ms/ch9/53b9/33a600f1-09b3-4c43-acfb-47e7e10753b9/Phone7toWin8QS03.mp3" expression="full" duration="1131" fileSize="18105266" type="audio/mp3" medium="audio"></media:content>
        <media:content url="http://media.ch9.ms/ch9/53b9/33a600f1-09b3-4c43-acfb-47e7e10753b9/Phone7toWin8QS03.mp4" expression="full" duration="1131" fileSize="108044761" type="video/mp4" medium="video"></media:content>
        <media:content url="http://media.ch9.ms/ch9/53b9/33a600f1-09b3-4c43-acfb-47e7e10753b9/Phone7toWin8QS03.webm" expression="full" duration="1131" fileSize="41293191" type="video/webm" medium="video"></media:content>
        <media:content url="http://media.ch9.ms/ch9/53b9/33a600f1-09b3-4c43-acfb-47e7e10753b9/Phone7toWin8QS03.wma" expression="full" duration="1131" fileSize="9155215" type="audio/x-ms-wma" medium="audio"></media:content>
        <media:content url="http://media.ch9.ms/ch9/53b9/33a600f1-09b3-4c43-acfb-47e7e10753b9/Phone7toWin8QS03.wmv" expression="full" duration="1131" fileSize="52905767" type="video/x-ms-wmv" medium="video"></media:content>
        <media:content url="http://media.ch9.ms/ch9/53b9/33a600f1-09b3-4c43-acfb-47e7e10753b9/Phone7toWin8QS03_high.mp4" expression="full" duration="1131" fileSize="237816063" type="video/mp4" medium="video"></media:content>
        <media:content url="http://media.ch9.ms/ch9/53b9/33a600f1-09b3-4c43-acfb-47e7e10753b9/Phone7toWin8QS03_mid.mp4" expression="full" duration="1131" fileSize="166122925" type="video/mp4" medium="video"></media:content>
        <media:content url="http://media.ch9.ms/ch9/53b9/33a600f1-09b3-4c43-acfb-47e7e10753b9/Phone7toWin8QS03_Source.wmv" expression="full" duration="1131" fileSize="133546125" type="video/x-ms-wmv" medium="video"></media:content>
        <media:content url="http://smooth.ch9.ms/ch9/53b9/33a600f1-09b3-4c43-acfb-47e7e10753b9/Phone7toWin8QS03.ism/manifest" expression="full" duration="1131" fileSize="6076" type="video/x-ms-wmv" medium="video"></media:content>
      </media:group>      
      <enclosure url="http://media.ch9.ms/ch9/53b9/33a600f1-09b3-4c43-acfb-47e7e10753b9/Phone7toWin8QS03.wmv" length="52905767" type="video/x-ms-wmv"></enclosure>
      <dc:creator>Rick Barraza</dc:creator>
      <itunes:author>Rick Barraza</itunes:author>
      <slash:comments>0</slash:comments>
      <wfw:commentRss>http://channel9.msdn.com/Series/Migrating-apps-from-Windows-Phone-to-Windows-8/Binding-the-Interface-in-Windows-Store-apps/RSS</wfw:commentRss>
      <category>Windows Phone</category>
      <category>Windows Store App</category>
      <category>Microsoft Design Style</category>
    </item>
  <item>
      <title>Handling Asynchronous Data in Windows Store Apps</title>
      <description><![CDATA[<p>&nbsp;</p><p>This video covers the basics of working with data in the Windows 8 Khan Academy app. We go over the new asynchronous pattern in <strong>WinRT</strong> for handling requests to and from the server, as well as putting together the Data Model for our app.</p><p>If you have never worked with async patterns before, the following <a href="http://msdn.microsoft.com/en-us/library/windows/apps/hh452713.aspx">async overview</a> may be helpful before proceeding with our Khan Academy samples.&nbsp;</p><h1><strong>An Overview of Async / Await</strong></h1><p>As referenced above, asynchronous APIs are found all over the Windows 8 runtime and they are a key concept in Windows 8 app development. We have already seen the async / await pattern in action in the first Quickstart of this series when discussing the <strong>LaunchApp()</strong> method on startup:</p><p><strong>App.xaml.cs</strong></p><p><pre class="brush: csharp">
public async void LaunchApp(
     ApplicationExecutionState previousExecutionState)
{
     DataSource = new KhanDataSource();
     await DataSource.LoadAllData();
</pre></p><p>Notice the use of the <strong>async</strong> keyword in the method’s declaration. Since this method is going to use an <strong>await</strong> operator for an asynchronous task, we need to use the <strong>async</strong> keyword in the declaration. In our case, we use <strong>await</strong> after we create our Data Model named <strong>DataSource</strong> and request it to populate itself by calling its <strong>LoadAllData()</strong> function. <strong>LoadAllData()</strong> handles both local and remote requests for Khan Academy video playlist data.</p><p>The Windows 8 Khan Academy video app ships with a cached snapshot of the entire playlist library stored locally. This keeps the UI fast and fluid since the app doesn’t need to request and parse the entire collection of videos from the internet before launching for the first time. Each time the app runs, though, the <strong>KhanDataSource.LoadAllData()</strong> function in our Data Model also makes a call to the Khan Academy server and updates the local cache with any updates behinds the scenes, before reloading the local data to update any bindings.</p><p><strong>LoadRemoteData()</strong> is also implements the async/await pattern and is shown below:</p><p>&nbsp;</p><p><strong>C#</strong></p><p><pre class="brush: csharp">
private async void LoadRemoteData()
{
     HttpClient client = new HttpClient();
     client.MaxResponseContentBufferSize = Megabyte * 20;
     HttpResponseMessage response = await client.GetAsync(
          new Uri(“http://www.khanacademy.org/api/v1/topictree”));
     await WriteLocalCacheAsync(
          await response.Content.ReadAsStringAsync(),
          @”cache\topictree”);
     await LoadCachedData();
}
</pre></p><p><strong>LoadRemoteData()</strong> first creates and qualifies an <em>HttpClient</em> object but then needs to await the asynchronous <em>HttpResponseMessage</em> from the server before continuing. So far, this is a straightforward async/await pattern.</p><p>But some tasks may require a nesting of await commands to complete the desired transaction. We can see this in the code once we want to write the response locally. In order to write to the local cache, which is itself an async operation, we first need to read the response as a string, which also requires an await command:</p><p><strong>C#</strong></p><p><pre class="brush: csharp">
await WriteLocalCacheAsync(
     await response.Content.ReadAsStringAsync(),
     @”cache\topictree”);
</pre></p><p>Once the local cache has been updated with the most recent data retrieved from the Khan Academy web servers, we refresh the local Data Source from this updated cache.</p><p>In the Khan Academy Windows 8 app, the majority of code that handles the asynchronous data is contained in the <strong>KhanDataSource.cs</strong> file and follows the similar structure as shown above.</p><p>&nbsp;</p><h1><strong>Handling the JSON Response</strong></h1><p>As we saw in the previous section, the Khan Academy app keeps the local cache of app data up to date by overwriting the local cache with updated JSON data from the Khan Academy servers.</p><p>With Windows 8, there are multiple ways of processing JSON data, based on your needs and situation. For our scenario, we knew the shape of the data being returned by Khan Academy, so we first created a custom class that would represent each logical node of the response:</p><p><strong>C#</strong></p><p><pre class="brush: csharp">
[DataContract]
public class JsonNode
{
     [DataMember(Name = “children”)]
     public JsonNode[] Children { get; set; }
     [DataMember(Name = “kind”)]
     public string Kind { get; set; }
     [DataMember(Name = “ka_url”)]
     public string Url { get; set; }
     [DataMember(Name = “title”)]
     public JsonNode[] Title{ get; set; }
     [DataMember(Name = “description”)]
     public string Description { get; set; }
     […]
}
</pre></p><p>When it is time to read this locally cached JSON response, we invoke the following method and pass in our custom class type:</p><p><strong>KhanDataSource.cs</strong></p><p><pre class="brush: csharp">
private async Task LoadCachedData()
{
    JsonNode cached = await ReadLocalCacheAsync&lt;JsonNode&gt;(
        @&quot;cache\topictree.json&quot;,
        @&quot;data\topictree.json&quot;);
    PopulateGroups(cached);
}
private static async Task&lt;T&gt; ReadLocalCacheAsync&lt;T&gt;(
    string filename,
    StorageFolder folder)
    where T : class
{
    try
    {
        var file = await folder.GetFileAsync(filename);
        string result = await FileIO.ReadTextAsync(file);
        var serializer = new DataContractJsonSerializer(typeof(T));
        var memStream = new MemoryStream(
            Encoding.UTF8.GetBytes(result));
        var serializedResult = serializer.ReadObject(memStream) as T;
        return serializedResult;
    }
    catch (FileNotFoundException)
    {
        return default(T);
    }
}
</pre></p><p>As you can see, <strong>ReadLocalCacheAsync</strong> creates a new <strong>DataContractJsonSerializer</strong> of the type specified. The string result of reading the local cache file is wrapped in a <strong>MemoryStream</strong> and passed to the JSON serializer. Once serialized, we have an object representation of the cached text data. The cached response is then sent to the <strong>PopulateGroups()</strong> function to update our Data Model.</p><p>If we look at the first part of the <strong>PopulateGroups()</strong> function, you'll see how we are using LINQ to pull out a properly formatted collection of elements for use in our Data Model.</p><p>&nbsp;</p><p><strong>C#</strong></p><p><pre class="brush: csharp">
private void PopulateGroups(JsonNode root)
{
    if (root == null) return;
    Func&lt;JsonNode, bool&gt; videoClause = v =&gt; v.Kind == &quot;Video&quot;;
    Func&lt;JsonNode, bool&gt; topicClause = c =&gt; c.Kind == &quot;Topic&quot;;
    var playlists = root.Children 
        .SelectMany(group =&gt; group.Children.Where(topicClause)
                        .Flatten(g =&gt; g.Children.Where(topicClause))
                        .Select(k =&gt; new PlaylistItem
                        {
                            Name = k.Title,
                            Description = k.Description,
                            Slug = group.Title,
                            SourceNode = k
                        })
                        .OrderBy(k =&gt; k.Slug));
    […]
}
</pre></p><p>&nbsp;</p><h1><strong>Populating the Data Model</strong></h1><p>The Khan Academy API returns a series of playlists, made up of video items. However, the content of these playlists spans many different academic topics, so we want to make sure we further organize the playlists according to these topics. Here is a part of the Class Diagram to illustrate the relationship.</p><p><img title="clip_image007" src="http://files.channel9.msdn.com/wlwimages/b99a24a9f48a4ce2b672a09b015ae985/clip_image007%5B3%5D-1.png" alt="clip_image007" width="672" height="639" border="0"></p><p>If we look at the last part of the <strong>PopulateGroups()</strong> method , the videos are subsequently organized under their individual playlists. This ungrouped collection of populated playlists is then sent to <strong>CreateGroups()</strong> which organizes them into their respective Topics. The relevant code looks like this:</p><p><strong>C#</strong></p><p><pre class="brush: csharp">
private void PopulateGroups(JsonNode root)
{
    […]
    foreach (var playlist in playlists)
    {
        // now load all the videos
        var videos = playlist.SourceNode
            .Children
            .Flatten(v =&gt; v.Children);
        foreach (var video in videos.Where(videoClause).Select(
            v =&gt; new VideoItem
            {
                Name = v.Title,
                Description = v.Description,
                ImagePath = v.Downloads != null ?
                              new Uri(v.Downloads.Screenshot) : null,
                VideoPath = v.Downloads != null ?
                              new Uri(v.Downloads.Video) : null,
                KhanPath = new Uri(v.Url),
                Parent = playlist.Name,
                DateAdded = DateTime.Parse(v.DateAdded)
            }))
        {
            playlist.Videos.Add(video);
        }
    }
    if (playlists.Count() &gt; 0)
    {
        SortGroups(
            TopicItem.CreateGroups(
                playlists.Where(p =&gt; p.Videos.Count &gt; 0)));
    }
}
public static IEnumerable&lt;TopicItem&gt;
CreateGroups(IEnumerable&lt;PlaylistItem&gt; ungroupedPlaylists)
{
    var grouped = ungroupedPlaylists
        .GroupBy(i =&gt; i.GroupKey)
        .Select(g =&gt; new TopicItem(g.Key, g.Key &#43; &quot; description&quot;)
        {
            ListSetter = g
        });
    var res = grouped
        .OrderBy(i =&gt; i.Order)
        .ThenByDescending(i =&gt; i.Playlists.Count);
    return res;
}

 
</pre></p><p>In this way, we are able to get unsorted JSON data from Khan Academy and organize it into a series of classes that represent the actual videos, their topical playlist and their high level, academic grouping of topics. All this information is stored in <strong>ObservableCollections</strong> which we will bind to the UI in the next Quickstart.</p><p>If you have any questions, comments, or feedback feel free to join in the discussion.</p><p>Twitter: @<a href="http://twitter.com/rickbarraza">rickbarraza</a>, <a href="http://twitter.com/joelmartinez">@joelmartinez</a></p> <img src="http://m.webtrends.com/dcs1wotjh10000w0irc493s0e_6x1g/njs.gif?dcssip=channel9.msdn.com&dcsuri=http://channel9.msdn.com/Series/Migrating-apps-from-Windows-Phone-to-Windows-8/feed&WT.dl=0&WT.entryid=Entry:RSSView:c13026695b1b455eb308a09f0189234e">]]></description>
      <comments>http://channel9.msdn.com/Series/Migrating-apps-from-Windows-Phone-to-Windows-8/Handling-Asynchronous-Data-in-Windows-Store-Apps</comments>
      <itunes:summary>&amp;nbsp; This video covers the basics of working with data in the Windows 8 Khan Academy app. We go over the new asynchronous pattern in WinRT for handling requests to and from the server, as well as putting together the Data Model for our app. If you have never worked with async patterns before, the following async overview may be helpful before proceeding with our Khan Academy samples.&amp;nbsp; An Overview of Async / AwaitAs referenced above, asynchronous APIs are found all over the Windows 8 runtime and they are a key concept in Windows 8 app development. We have already seen the async / await pattern in action in the first Quickstart of this series when discussing the LaunchApp() method on startup: App.xaml.cs 
public async void LaunchApp(
     ApplicationExecutionState previousExecutionState)
{
     DataSource = new KhanDataSource();
     await DataSource.LoadAllData();
 Notice the use of the async keyword in the method’s declaration. Since this method is going to use an await operator for an asynchronous task, we need to use the async keyword in the declaration. In our case, we use await after we create our Data Model named DataSource and request it to populate itself by calling its LoadAllData() function. LoadAllData() handles both local and remote requests for Khan Academy video playlist data. The Windows 8 Khan Academy video app ships with a cached snapshot of the entire playlist library stored locally. This keeps the UI fast and fluid since the app doesn’t need to request and parse the entire collection of videos from the internet before launching for the first time. Each time the app runs, though, the KhanDataSource.LoadAllData() function in our Data Model also makes a call to the Khan Academy server and updates the local cache with any updates behinds the scenes, before reloading the local data to update any bindings. LoadRemoteData() is also implements the async/await pattern and is shown below: &amp;nbsp; C# 
private async void LoadRemoteData()
{
     </itunes:summary>
      <itunes:duration>938</itunes:duration>
      <link>http://channel9.msdn.com/Series/Migrating-apps-from-Windows-Phone-to-Windows-8/Handling-Asynchronous-Data-in-Windows-Store-Apps</link>
      <pubDate>Wed, 26 Sep 2012 19:52:40 GMT</pubDate>
      <guid isPermaLink="false">http://channel9.msdn.com/Series/Migrating-apps-from-Windows-Phone-to-Windows-8/Handling-Asynchronous-Data-in-Windows-Store-Apps</guid>
      <media:thumbnail url="http://media.ch9.ms/ch9/5c1e/f4c8edf4-6a7d-4b94-aad3-17157dac5c1e/Phone7toWin8QS02_100.jpg" height="56" width="100"></media:thumbnail>
      <media:thumbnail url="http://media.ch9.ms/ch9/5c1e/f4c8edf4-6a7d-4b94-aad3-17157dac5c1e/Phone7toWin8QS02_220.jpg" height="123" width="220"></media:thumbnail>
      <media:thumbnail url="http://media.ch9.ms/ch9/5c1e/f4c8edf4-6a7d-4b94-aad3-17157dac5c1e/Phone7toWin8QS02_512.jpg" height="288" width="512"></media:thumbnail>
      <media:group>
        <media:content url="http://media.ch9.ms/ch9/5c1e/f4c8edf4-6a7d-4b94-aad3-17157dac5c1e/Phone7toWin8QS02.mp3" expression="full" duration="938" fileSize="15009871" type="audio/mp3" medium="audio"></media:content>
        <media:content url="http://media.ch9.ms/ch9/5c1e/f4c8edf4-6a7d-4b94-aad3-17157dac5c1e/Phone7toWin8QS02.mp4" expression="full" duration="938" fileSize="91118484" type="video/mp4" medium="video"></media:content>
        <media:content url="http://media.ch9.ms/ch9/5c1e/f4c8edf4-6a7d-4b94-aad3-17157dac5c1e/Phone7toWin8QS02.webm" expression="full" duration="938" fileSize="33752785" type="video/webm" medium="video"></media:content>
        <media:content url="http://media.ch9.ms/ch9/5c1e/f4c8edf4-6a7d-4b94-aad3-17157dac5c1e/Phone7toWin8QS02.wma" expression="full" duration="938" fileSize="7590131" type="audio/x-ms-wma" medium="audio"></media:content>
        <media:content url="http://media.ch9.ms/ch9/5c1e/f4c8edf4-6a7d-4b94-aad3-17157dac5c1e/Phone7toWin8QS02.wmv" expression="full" duration="938" fileSize="43641803" type="video/x-ms-wmv" medium="video"></media:content>
        <media:content url="http://media.ch9.ms/ch9/5c1e/f4c8edf4-6a7d-4b94-aad3-17157dac5c1e/Phone7toWin8QS02_high.mp4" expression="full" duration="938" fileSize="199110830" type="video/mp4" medium="video"></media:content>
        <media:content url="http://media.ch9.ms/ch9/5c1e/f4c8edf4-6a7d-4b94-aad3-17157dac5c1e/Phone7toWin8QS02_mid.mp4" expression="full" duration="938" fileSize="139060890" type="video/mp4" medium="video"></media:content>
        <media:content url="http://media.ch9.ms/ch9/5c1e/f4c8edf4-6a7d-4b94-aad3-17157dac5c1e/Phone7toWin8QS02_Source.wmv" expression="full" duration="938" fileSize="113322789" type="video/x-ms-wmv" medium="video"></media:content>
        <media:content url="http://smooth.ch9.ms/ch9/5c1e/f4c8edf4-6a7d-4b94-aad3-17157dac5c1e/Phone7toWin8QS02.ism/manifest" expression="full" duration="938" fileSize="6076" type="video/x-ms-wmv" medium="video"></media:content>
      </media:group>      
      <enclosure url="http://media.ch9.ms/ch9/5c1e/f4c8edf4-6a7d-4b94-aad3-17157dac5c1e/Phone7toWin8QS02.wmv" length="43641803" type="video/x-ms-wmv"></enclosure>
      <dc:creator>Rick Barraza</dc:creator>
      <itunes:author>Rick Barraza</itunes:author>
      <slash:comments>0</slash:comments>
      <wfw:commentRss>http://channel9.msdn.com/Series/Migrating-apps-from-Windows-Phone-to-Windows-8/Handling-Asynchronous-Data-in-Windows-Store-Apps/RSS</wfw:commentRss>
      <category>Windows Phone</category>
      <category>Windows Store App</category>
      <category>Microsoft Design Style</category>
    </item>
  <item>
      <title>Setting Up Your Windows Store App Project</title>
      <description><![CDATA[<p>&nbsp;This video covers the basics of setting up a Windows&nbsp;Store app&nbsp;project in Visual Studio 2012 for the Windows Phone 7 app we are going to migrate. We also discuss the migration strategy, scoping the features within the port, and the advantages of using a Windows&nbsp;Store project template as our solution base. For more information on migration, please visit the <a href="http://msdn.microsoft.com/en-us/library/windows/apps/hh465136.aspx">Migrating a Windows Phone 7 app to a Windows Store app</a> guidance.</p><p>The final source code for the WIndows Store App <strong><em>Viewer for Khan Academy</em></strong> is <a href="https://github.com/joelmartinez/Khan-Academy-for-WinRT">available for download</a>.&nbsp;</p><p>&nbsp;</p><h1>Installing the Developer Tools</h1><p>You can download and install everything necessary to follow along as we build the Windows&nbsp;Store project in this series. However, you must first install a copy of Windows 8. To view and build the project files, you will also need to download <a href="http://www.microsoft.com/express">Microsoft Visual Studio Express 2012 for Windows 8</a>.</p><p>&nbsp;</p><h1><strong>The Khan Academy Phone App</strong></h1><p>To show the migration in action, we will use the open source Khan Academy Windows Phone 7 app, developed by <a href="http://www.codecube.net">Joel Martinez</a>. This app retrieves a list of video playlists from the Khan Academy website and lets the user watch them. Our Windows 8 Store app will be called “Viewer for Khan Academy”.</p><p>If you’re not familiar with Khan Academy, they are a “not-for-profit organization with the goal of changing education for the better by providing a free world-class education for anyone anywhere.” Their website, <a href="http://www.khanacademy.com">www.khanacademy.com</a> hosts thousands of videos over a wide collection of topics and are offered freely to anyone with an interest in learning. They support Open Source data and have a rich collection of APIs that expose their library to the developer community as well.</p><p>Joel Martinez is a mobile app developer who created a popular Windows Phone 7 app that accesses this rich collection of videos. By providing his original Windows Phone 7 viewer of Khan Academy app as an Open Source project and writing about the process extensively on his blog at <a href="http://www.codecube.net">http://www.codecube.net</a>, he has helped developers learn the basics of Windows Phone 7 development leveraging public videos found online.</p><p>If you have a Windows Phone and want to try out the original Windows Phone 7 version, you can download it from the Windows Phone Store. The app's source code is also available for&nbsp;<a href="https://github.com/joelmartinez/Khan-Academy-for-Windows-Phone">download</a>.</p><p>The Windows Phone app was developed in Silverlight so uses XAML for its interface syntax with C# code behind. When the app is first run, it calls the public Khan Academy APIs which return a collection of video playlists. In the phone app, these playlists are not organized by topic:</p><p>&nbsp;</p><p><img title="Screen Capture" src="http://files.channel9.msdn.com/wlwimages/b99a24a9f48a4ce2b672a09b015ae985/Screen%20Capture%5B3%5D.jpg" alt="Screen Capture" width="288" height="480" border="0"></p><p>Selecting a playlist brings up a collections of videos, which when clicked send the user to the video player on the phone to stream in the video content:</p><p>&nbsp;</p><p><img title="Screen Capture (1)" src="http://files.channel9.msdn.com/wlwimages/b99a24a9f48a4ce2b672a09b015ae985/Screen%20Capture%20(1)%5B3%5D.jpg" alt="Screen Capture (1)" width="288" height="480" border="0"></p><p>Joel Martinez developed the phone app with solid logical abstraction following an MVVM pattern. The Phone app also leverages both network calls to the Khan Academy APIs as well as local storage of retrieved data for improved responsiveness:</p><p>&nbsp;</p><p><img title="khanPhoneLayout" src="http://files.channel9.msdn.com/wlwimages/b99a24a9f48a4ce2b672a09b015ae985/khanPhoneLayout%5B2%5D.png" alt="khanPhoneLayout" width="500" height="370" border="0"></p><p>If requested data has not previously been retrieved and stored locally, the app makes a request to the cloud and stores the data in <strong>IsolatedStorage</strong>. Updating local storage data with cloud responses is done in the background.</p><p>&nbsp;</p><h1><strong>Determining the Migration Strategy</strong></h1><p>When porting a Silverlight for Windows Phone 7 app to Windows 8, there are several considerations you should take into account. Do you want to migrate as quickly as possible, or do you want to invest more time in the new features Windows 8 makes available? Are you going to want to share as much reusable code as possible, or maintain different solutions per platform? How greatly will the User Interface be affected as you migrate from a smaller form factor to a larger tablet or desktop Interface?</p><p><img title="clip_image001[5]" src="http://files.channel9.msdn.com/wlwimages/b99a24a9f48a4ce2b672a09b015ae985/clip_image001%5B5%5D%5B2%5D.png" alt="clip_image001[5]" width="500" height="115" border="0">&nbsp;</p><p>In our case, the Windows Phone app relies heavily on hitting the Khan Academy servers and requesting data as discussed above. It also makes use of Windows Phone's <strong>IsolatedStorage</strong>. C# 5.0 introduced two new keywords <strong><em>async</em></strong> and <strong><em>await</em></strong> and this Async Pattern is used extensively in modern Windows 8 apps for handling I/O functions. Since our app uses these types of commands extensively, this would be a big change.</p><p>While it is possible to convert synchronous methods written in C# that do I/O internally to functions that return Task&lt;T&gt; to a task continuation middle man, this method would be inherited more from the current <strong>.NET</strong> way of handling asynchronous tasks. We decided to invest in learning the modern asynchronous pattern implementations in <strong>WinRT</strong> for both handling server requests and storing app specific data. The Async / Await pattern is a significant addition to how all developers will be creating Windows 8 apps moving forward, so after our early explorations, we decided to create a fresh code base.</p><p><a name="_msocom_1"></a></p><p>If your phone app does not use extensive I/O code that would benefit from the new Async / Await pattern, you may wish port primarily your models and view models, versus starting from scratch as outlined in such MSDN articles as <a href="http://msdn.microsoft.com/en-us/library/windows/apps/hh465136%28v=VS.85%29.aspx">http://msdn.microsoft.com/en-us/library/windows/apps/hh465136%28v=VS.85%29.aspx</a>.</p><p>However, in either case, it is recommended that you don't try and bring over your XAML UI files directly. We discuss this further below.</p><p>&nbsp;</p><h1><strong>Scoping the Solution</strong></h1><p>Once we determined a migration strategy for the existing Phone features, we wanted to see what benefits the new form factor and platform would afford. A core design principle for Windows 8 apps is “Winning as One”. This means that to the degree you app can leverage common features provided in the operating system and implemented consistently across apps, the greater the overall experience for the user will be. To that end, the Windows 8 operating system introduces Contracts and other features that apps can leverage to extend their functionality and provide a consistent, polished experience for their users.</p><p><img title="clip_image002" src="http://files.channel9.msdn.com/wlwimages/b99a24a9f48a4ce2b672a09b015ae985/clip_image002%5B3%5D.png" alt="clip_image002" width="500" height="116" border="0"></p><p>While staying true to the functional goals of the phone app, there were three Contracts we wanted to leverage in the port to Windows 8. Since Khan Academy contains thousands of videos that cover a wide range of topics, exposing this data in our viewer through a <strong>Search</strong> <strong>Contract</strong> was essential. Once the app has loaded a video, the ability to send a link to a someone also made a lot of sense, so we would add this through the <strong>Sharing</strong> <strong>Contract</strong>. Since the primary content of the app are videos, leveraging the <strong>PlayTo</strong> <strong>Contract</strong> would allow the user to enjoy the experience on a larger screen if available.</p><p>Other than taking advantage of the Contracts made available through Windows 8, we wanted to keep the core functionality similar between phone and tablet. However, we decided to aggregate the information a little better in the Windows 8 version and group the playlists together by topic, something that is missing in the simple list interface of the Phone app.</p><p>&nbsp;</p><h1>Working with the Project Templates</h1><p>To whatever degree you want to tweak versus rewrite your code, your XAML files are a different matter. The general advice is to start fresh, preferably from one of the new Windows 8 Project Templates found in Visual Studio, and then bring in the relevant UI elements under the root node. There are several reasons for this.</p><p><img title="clip_image003" src="http://files.channel9.msdn.com/wlwimages/b99a24a9f48a4ce2b672a09b015ae985/clip_image003%5B3%5D.png" alt="clip_image003" width="500" height="149" border="0"></p><p>For one thing, the platform changes how navigation is handled. While on Windows Phone, navigation is usually handled with the <strong>NavigationService</strong> object, in Windows 8 it is primarily handled through <strong>Frames</strong> and <strong>Pages</strong>. Also, all the form factor considerations of Windows 8, including snapping, orientation and variable resolution support, require a common structure that doesn't exist in Windows Phone. If your existing phone app was designed with good view models and proper use of MVVM patterns, this UI migration will be much easier.</p><p>&nbsp;</p><p><img title="clip_image004" src="http://files.channel9.msdn.com/wlwimages/b99a24a9f48a4ce2b672a09b015ae985/clip_image004%5B3%5D.png" alt="clip_image004" width="446" height="340" border="0"></p><p>&nbsp;</p><p>The best way to understand the differences between UI design from Windows Phone to Windows 8 is to open up the blank templates for Windows 8 Applications in Visual Studio 2012 and see how they work. We chose the <strong>Grid App template </strong>as the basis for our migration project.The Grid App template is a multi-page project that navigates among groups of items, so this template worked perfect for our list of Khan Academy videos.</p><p><img title="clip_image005" src="http://files.channel9.msdn.com/wlwimages/b99a24a9f48a4ce2b672a09b015ae985/clip_image005%5B3%5D.png" alt="clip_image005" width="386" height="624" border="0"></p><p>There are several advantages of using a Windows&nbsp;Store Template as your starter project, instead of simply creating a “Blank Project” in Visual Studio. These include:</p><ul><li>A Common Folder that comes packed with very usefull classes and assets to assist in Windows 8 app development, including BindableBase.cs. </li><li>Common\LayoutAwarePage.cs from which you can inherit your pages and have instant hooks into the system events when dealing with snapping, rotation and orientation. </li><li>Common\StandardStyles.xaml which gives you a default template on which to extend your app styles and templates. </li><li>A DataModel folder with provides a strong foundation for data binding and MVVM architecture for your app. </li></ul><p>Unlike Windows Phone apps which handle navigation through a URI based navigation service, Windows 8 handles initialization and navigation through frames and container view models.</p><p>If you create open up a new Grid App Template, you will notice an <strong>App.xaml</strong> file. This is the first page loaded when a Windows 8 app stats. <strong>App.xaml.cs</strong> in turn calls its <strong>LaunchApp()</strong> function to direct the app to whatever startup page you wish to present.&nbsp;</p><p>We took this opportunity to create our data model for the app. With our <strong>KhanDataSource</strong> created, the common initialization practice is to create a <strong>Frame</strong> and use it to navigate to your startup page, passing along your Data Model if applicable. In our case, our startup page will be <strong>HubPage.xaml</strong>. Both the XAML elements of<strong> HubPage.xaml</strong> and the structure of our Data Model, <strong>KhanDataSource</strong> will be analyzed more in the next Quickstarts.</p><p><strong>C#</strong></p><p><pre class="brush: csharp">
public async void LaunchApp(
     ApplicationExecutionState previousExecutedState)
{
     DataSource = new KhanDataSource();
     await DataSource.LoadAllData();
     var rootFrame = new Frame();
[…]
     if ( rootFrame.Content == null)
     {
          if ( !rootFrame.Navigate(
               typeof(HubPage),
               JsonSerializer.Serialize(DataSource.TopicGroups)))
          {
               throw new Exception(“Failed to create initial page”);
          }
     }
     Window.Current.Content = rootFrame;
     Window.Current.Activate();
}
</pre></p><p>All the C# templates and most apps will follow this same routine. When an app is launched,<strong> App.xaml</strong> fires its <strong>LaunchApp()</strong> event. If a Data Model is required, it may be created at this time and loaded from data either locally or from the cloud, and get passed into the startup page of your app for data binding to the UI. During the subsequent series of Quickstarts, we will look closely at each of these steps and how we implemented them in the Windows&nbsp;Store Khan Academy App.</p><p>There are also some great posts on <strong>Dev Center</strong> that dive deeper into general migration strategies if you want to research the specifics of this topic further:</p><ul><li><a href="http://msdn.microsoft.com/en-us/library/windows/apps/hh465136%28v=VS.85%29.aspx">Migrate/port a Windows Phone 7 app to a Windows Store app</a> </li><li><a href="http://msdn.microsoft.com/en-us/library/windows/apps/br229583.aspx">Roadmap for Windows Store apps using C# or Visual Basic</a> </li><li><a href="http://msdn.microsoft.com/en-us/library/windows/apps/hh768232.aspx">C#, VB, and C&#43;&#43; Project templates for Windows Store apps</a> </li></ul><p>In the next Quickstart, we'll jump straight into working with data and the new asynchronous pattern in Windows 8.</p><p>If you have any questions, comments, or feedback feel free to join in the discussion.</p><p>Twitter: @<a href="http://twitter.com/rickbarraza">rickbarraza</a>, <a href="http://twitter.com/joelmartinez">@joelmartinez</a></p> <img src="http://m.webtrends.com/dcs1wotjh10000w0irc493s0e_6x1g/njs.gif?dcssip=channel9.msdn.com&dcsuri=http://channel9.msdn.com/Series/Migrating-apps-from-Windows-Phone-to-Windows-8/feed&WT.dl=0&WT.entryid=Entry:RSSView:b7a8f7c6f18c4b358aa4a09e0133d629">]]></description>
      <comments>http://channel9.msdn.com/Series/Migrating-apps-from-Windows-Phone-to-Windows-8/Setting-Up-Your-Windows-Store-App-Project</comments>
      <itunes:summary>&amp;nbsp;This video covers the basics of setting up a Windows&amp;nbsp;Store app&amp;nbsp;project in Visual Studio 2012 for the Windows Phone 7 app we are going to migrate. We also discuss the migration strategy, scoping the features within the port, and the advantages of using a Windows&amp;nbsp;Store project template as our solution base. For more information on migration, please visit the Migrating a Windows Phone 7 app to a Windows Store app guidance. The final source code for the WIndows Store App Viewer for Khan Academy is available for download.&amp;nbsp; &amp;nbsp; Installing the Developer ToolsYou can download and install everything necessary to follow along as we build the Windows&amp;nbsp;Store project in this series. However, you must first install a copy of Windows 8. To view and build the project files, you will also need to download Microsoft Visual Studio Express 2012 for Windows 8. &amp;nbsp; The Khan Academy Phone AppTo show the migration in action, we will use the open source Khan Academy Windows Phone 7 app, developed by Joel Martinez. This app retrieves a list of video playlists from the Khan Academy website and lets the user watch them. Our Windows 8 Store app will be called “Viewer for Khan Academy”. If you’re not familiar with Khan Academy, they are a “not-for-profit organization with the goal of changing education for the better by providing a free world-class education for anyone anywhere.” Their website, www.khanacademy.com hosts thousands of videos over a wide collection of topics and are offered freely to anyone with an interest in learning. They support Open Source data and have a rich collection of APIs that expose their library to the developer community as well. Joel Martinez is a mobile app developer who created a popular Windows Phone 7 app that accesses this rich collection of videos. By providing his original Windows Phone 7 viewer of Khan Academy app as an Open Source project and writing about the process extensively on his blog at http://www.codecube.net, he</itunes:summary>
      <itunes:duration>907</itunes:duration>
      <link>http://channel9.msdn.com/Series/Migrating-apps-from-Windows-Phone-to-Windows-8/Setting-Up-Your-Windows-Store-App-Project</link>
      <pubDate>Wed, 26 Sep 2012 19:52:18 GMT</pubDate>
      <guid isPermaLink="false">http://channel9.msdn.com/Series/Migrating-apps-from-Windows-Phone-to-Windows-8/Setting-Up-Your-Windows-Store-App-Project</guid>
      <media:thumbnail url="http://media.ch9.ms/ch9/cb14/bf581a56-dc1f-4a34-8f17-67499e99cb14/Phone7toWin8QS01_100.jpg" height="56" width="100"></media:thumbnail>
      <media:thumbnail url="http://media.ch9.ms/ch9/cb14/bf581a56-dc1f-4a34-8f17-67499e99cb14/Phone7toWin8QS01_220.jpg" height="123" width="220"></media:thumbnail>
      <media:thumbnail url="http://media.ch9.ms/ch9/cb14/bf581a56-dc1f-4a34-8f17-67499e99cb14/Phone7toWin8QS01_512.jpg" height="288" width="512"></media:thumbnail>
      <media:group>
        <media:content url="http://media.ch9.ms/ch9/cb14/bf581a56-dc1f-4a34-8f17-67499e99cb14/Phone7toWin8QS01.mp3" expression="full" duration="907" fileSize="14525924" type="audio/mp3" medium="audio"></media:content>
        <media:content url="http://media.ch9.ms/ch9/cb14/bf581a56-dc1f-4a34-8f17-67499e99cb14/Phone7toWin8QS01.mp4" expression="full" duration="907" fileSize="86152893" type="video/mp4" medium="video"></media:content>
        <media:content url="http://media.ch9.ms/ch9/cb14/bf581a56-dc1f-4a34-8f17-67499e99cb14/Phone7toWin8QS01.webm" expression="full" duration="907" fileSize="32105397" type="video/webm" medium="video"></media:content>
        <media:content url="http://media.ch9.ms/ch9/cb14/bf581a56-dc1f-4a34-8f17-67499e99cb14/Phone7toWin8QS01.wma" expression="full" duration="907" fileSize="7346807" type="audio/x-ms-wma" medium="audio"></media:content>
        <media:content url="http://media.ch9.ms/ch9/cb14/bf581a56-dc1f-4a34-8f17-67499e99cb14/Phone7toWin8QS01.wmv" expression="full" duration="907" fileSize="50340719" type="video/x-ms-wmv" medium="video"></media:content>
        <media:content url="http://media.ch9.ms/ch9/cb14/bf581a56-dc1f-4a34-8f17-67499e99cb14/Phone7toWin8QS01_high.mp4" expression="full" duration="907" fileSize="189053829" type="video/mp4" medium="video"></media:content>
        <media:content url="http://media.ch9.ms/ch9/cb14/bf581a56-dc1f-4a34-8f17-67499e99cb14/Phone7toWin8QS01_mid.mp4" expression="full" duration="907" fileSize="131701385" type="video/mp4" medium="video"></media:content>
        <media:content url="http://media.ch9.ms/ch9/cb14/bf581a56-dc1f-4a34-8f17-67499e99cb14/Phone7toWin8QS01_Source.wmv" expression="full" duration="907" fileSize="167785165" type="video/x-ms-wmv" medium="video"></media:content>
        <media:content url="http://smooth.ch9.ms/ch9/cb14/bf581a56-dc1f-4a34-8f17-67499e99cb14/Phone7toWin8QS01.ism/manifest" expression="full" duration="907" fileSize="6076" type="video/x-ms-wmv" medium="video"></media:content>
      </media:group>      
      <enclosure url="http://media.ch9.ms/ch9/cb14/bf581a56-dc1f-4a34-8f17-67499e99cb14/Phone7toWin8QS01.wmv" length="50340719" type="video/x-ms-wmv"></enclosure>
      <dc:creator>Rick Barraza</dc:creator>
      <itunes:author>Rick Barraza</itunes:author>
      <slash:comments>3</slash:comments>
      <wfw:commentRss>http://channel9.msdn.com/Series/Migrating-apps-from-Windows-Phone-to-Windows-8/Setting-Up-Your-Windows-Store-App-Project/RSS</wfw:commentRss>
      <category>Windows Phone</category>
      <category>Windows Store App</category>
      <category>Microsoft Design Style</category>
      <category>WindowsContent</category>
    </item>    
</channel>
</rss>