<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://mobileworld.appamundi.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"><channel><title>APPA Mundi</title><link>http://mobileworld.appamundi.com/blogs/</link><description>software solutions for a mobile world</description><dc:language>en-US</dc:language><generator>CommunityServer 2008.5 (Build: 30912.2823)</generator><item><title>Windows Marketplace for Mobile 6.x to be Discontinued</title><link>http://mobileworld.appamundi.com/blogs/peterfoot/archive/2012/05/03/windows-marketplace-for-mobile-6-x-to-be-discontinued.aspx</link><pubDate>Wed, 02 May 2012 16:25:00 GMT</pubDate><guid isPermaLink="false">989b12f5-6f26-47d9-9f0d-67fe982b88db:465</guid><dc:creator>Peter Foot</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;If you publish apps on the old Marketplace for Windows Mobile 6.x you should have received reminders that the service will be discontinued in two weeks. If you have been using our &lt;a target="_blank" href="http://inthehand.com/content/Mobile.aspx" title="Mobile In The Hand"&gt;Mobile In The Hand&lt;/a&gt; product with a managed code app there are a couple of issues to be aware of. Our libraries contain the following two classes to provide programmatic access to the Marketplace client on Windows Mobile 6.x:-&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;InTheHand.Phone.Tasks.MarketplaceDetailTask&lt;/li&gt;
&lt;li&gt;InTheHand.Phone.Tasks.MarketplaceLauncher&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If these are called on a device with the Marketplace client&amp;nbsp;installed they will launch the client application however once the service is discontinued no application details will be accessible so this may result in a confusing experience for your users. Consider these classes obsolete as they will no longer be supported and&amp;nbsp;will be removed from the next release.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://inthehand.uservoice.com/knowledgebase/articles/72785-windows-marketplace-for-mobile-6-x-to-be-discontin"&gt;https://inthehand.uservoice.com/knowledgebase/articles/72785-windows-marketplace-for-mobile-6-x-to-be-discontin&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://mobileworld.appamundi.com/aggbug.aspx?PostID=465" width="1" height="1"&gt;</description><category domain="http://mobileworld.appamundi.com/blogs/peterfoot/archive/tags/Windows+Mobile/default.aspx">Windows Mobile</category><category domain="http://mobileworld.appamundi.com/blogs/peterfoot/archive/tags/Compact+Framework/default.aspx">Compact Framework</category></item><item><title>Windows Phone User Group North West - Next meeting 29th May 2012 at MadLab Manchester</title><link>http://mobileworld.appamundi.com/blogs/petevickers/archive/2012/04/25/windows-phone-user-group-north-west-next-meeting-29th-may-2012-at-madlab-manchester.aspx</link><pubDate>Wed, 25 Apr 2012 13:55:00 GMT</pubDate><guid isPermaLink="false">989b12f5-6f26-47d9-9f0d-67fe982b88db:463</guid><dc:creator>Pete Vickers</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;We have finally arranged the next meeting of the Windows Phone User Group North West.&lt;/p&gt;
&lt;p&gt;It will again be at &lt;a href="http://madlab.org.uk/"&gt;MadLab&lt;/a&gt;&amp;nbsp;on the 29th May 2010 at 18:30 and you can register for it &lt;a href="http://wpugmcr10.eventbrite.co.uk/"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;We will be having 2 speakers - Chris Hardy will be talking about &lt;span style="font-family:Tahoma;"&gt;&amp;#39;Cross Platform Mobile Application Development With C# and .Net&amp;#39; and our own Andy Wigley will be talking about &amp;#39;MVVM and Unit Testing on Windows Phone&amp;#39;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:Tahoma;"&gt;Usual start at 18:30 and we will go on until 21:30 - probably across the road for &amp;#39;refreshments&amp;#39;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://mobileworld.appamundi.com/aggbug.aspx?PostID=463" width="1" height="1"&gt;</description><category domain="http://mobileworld.appamundi.com/blogs/petevickers/archive/tags/appamundi/default.aspx">appamundi</category><category domain="http://mobileworld.appamundi.com/blogs/petevickers/archive/tags/Manchester/default.aspx">Manchester</category><category domain="http://mobileworld.appamundi.com/blogs/petevickers/archive/tags/windows+phone/default.aspx">windows phone</category><category domain="http://mobileworld.appamundi.com/blogs/petevickers/archive/tags/wpug/default.aspx">wpug</category><category domain="http://mobileworld.appamundi.com/blogs/petevickers/archive/tags/wp7/default.aspx">wp7</category><category domain="http://mobileworld.appamundi.com/blogs/petevickers/archive/tags/_2300_wpug/default.aspx">#wpug</category><category domain="http://mobileworld.appamundi.com/blogs/petevickers/archive/tags/madlab/default.aspx">madlab</category><category domain="http://mobileworld.appamundi.com/blogs/petevickers/archive/tags/_2300_wpugnw/default.aspx">#wpugnw</category></item><item><title>What happens to network calls when your WP7 app goes dormant?</title><link>http://mobileworld.appamundi.com/blogs/andywigley/archive/2012/04/08/what-happens-to-network-calls-when-your-wp7-app-goes-dormant.aspx</link><pubDate>Sun, 08 Apr 2012 19:29:00 GMT</pubDate><guid isPermaLink="false">989b12f5-6f26-47d9-9f0d-67fe982b88db:458</guid><dc:creator>Andy Wigley</dc:creator><slash:comments>2</slash:comments><description>&lt;p&gt;&lt;font size="2"&gt;Download&lt;/font&gt; &lt;a href="http://mobileworld.appamundi.com/cfs-file.ashx/__key/CommunityServer.Components.PostAttachments/00.00.00.04.58/NetworkingRecoveryOnReactivationSample.zip"&gt;sample code&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;In my Windows Phone training courses and workshops, I explain how the application lifecycle works, and how when your app loses focus – because the lock screen comes up, because your app is interrupted by an incoming phone call, because your code has called a launcher or a chooser, or because the user has pressed the start button to go and run something else – the OS takes a copy of the working memory of your app, suspends all threads and at this moment, your app has become &lt;strong&gt;&lt;em&gt;dormant&lt;/em&gt;&lt;/strong&gt;. Since the OS has simply stuck this memory snapshot into a cache, once the user has finished with the interruption and returns to your app, the memory snapshot is quickly reloaded and your app continues from where it left off, as if it has never been away. If however, your user runs *lots* of apps after your app is made dormant, then the OSs cache may become exhausted, so the memory snapshot for your app may be discarded and in this case, your app becomes tombstoned.&lt;/p&gt; &lt;p&gt;When your app reactivates, you can find out whether it has come back from dormant or from the ‘deader’ state of tombstoned, by looking at the &lt;font face="Consolas"&gt;IsApplicationinstancePreserved&lt;/font&gt; property of the &lt;font face="Consolas"&gt;ActivatedEventArgs&lt;/font&gt; object in the Application_Activated event handler:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color:green;"&gt;// Code to execute when the application is activated (brought to foreground)
// This code will not execute when the application is first launched
&lt;/span&gt;&lt;span style="color:blue;"&gt;private void &lt;/span&gt;Application_Activated(&lt;span style="color:blue;"&gt;object &lt;/span&gt;sender, &lt;span style="color:#2b91af;"&gt;ActivatedEventArgs &lt;/span&gt;e)
{
    &lt;span style="color:blue;"&gt;if &lt;/span&gt;(e.IsApplicationInstancePreserved)
    {
        &lt;span style="color:green;"&gt;// Back from dormant – generally not a lot you need to do
&lt;/span&gt;    }
    &lt;span style="color:blue;"&gt;else
    &lt;/span&gt;{
        &lt;span style="color:green;"&gt;// Back from Tombstoned – usually need to execute some logic to restore state
        &lt;font color="#000000"&gt;…&lt;/font&gt;&lt;/span&gt;
    }
}&lt;br /&gt;&lt;/pre&gt;
&lt;p&gt;So I have always taught that in general, you don’t really have to write any special code to handle the case where we are coming back from dormant.&lt;/p&gt;
&lt;p&gt;Except that is a bit of a simplification! It can &lt;u&gt;almost&lt;/u&gt; continue exactly from where it left off, but you still have to think about two specific scenarios where you might need to run some logic to get everything truly back to where you left off:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;- Time-dependent logic, where your app is waiting for something to happen on a specific timing, so you were using a timer object to trigger some action after some particular time interval. You will probably need to execute some logic on reactivation here to get everything straight. 
&lt;li&gt;- Networking calls. All networking calls are asynchronous, so what happens if your app becomes dormant when a networking request has been made, but the response hasn’t come back yet? &lt;/li&gt;&lt;/ul&gt;
&lt;h2&gt;Networking Calls and Dormant State&lt;/h2&gt;
&lt;p&gt;Well, what actually happens is that when your app is reactivated from a dormant state, any calls that were in progress will complete in error. The network call will complete by reporting a WebException with a Status of Request Cancelled. For example, if your are using the &lt;strong&gt;WebClient&lt;/strong&gt; API, the Request Cancelled status can be detected like this:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color:blue;"&gt;public class &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;WebDataService
&lt;/span&gt;{
    &lt;span style="color:blue;"&gt;private &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;WebClient &lt;/span&gt;webClient = &lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;WebClient&lt;/span&gt;();

    &lt;span style="color:blue;"&gt;public &lt;/span&gt;WebDataService()
    {
        webClient.DownloadStringCompleted += &lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;DownloadStringCompletedEventHandler&lt;/span&gt;(webClient_DownloadStringCompleted);
    }

    &lt;span style="color:blue;"&gt;public void &lt;/span&gt;FetchUsingWebClient()
    {
         webClient.DownloadStringAsync(&lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;Uri&lt;/span&gt;(&lt;span style="color:#a31515;"&gt;&amp;quot;http://localhost:8414/MyDataService.svc/DataObjects&amp;quot;&lt;/span&gt;, &lt;span style="color:#2b91af;"&gt;UriKind&lt;/span&gt;.Absolute));
    }

    &lt;span style="color:blue;"&gt;void &lt;/span&gt;webClient_DownloadStringCompleted(&lt;span style="color:blue;"&gt;object &lt;/span&gt;sender, &lt;span style="color:#2b91af;"&gt;DownloadStringCompletedEventArgs &lt;/span&gt;e)
    {
        &lt;span style="color:blue;"&gt;if &lt;/span&gt;(e.Error != &lt;span style="color:blue;"&gt;null&lt;/span&gt;)
        {
            &lt;span style="color:blue;"&gt;if &lt;/span&gt;(e.Error &lt;span style="color:blue;"&gt;is &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;WebException&lt;/span&gt;)
            {
                &lt;span style="color:blue;"&gt;var &lt;/span&gt;wEx = e.Error &lt;span style="color:blue;"&gt;as &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;WebException&lt;/span&gt;;
                &lt;span style="color:blue;"&gt;if &lt;/span&gt;(wEx.Status == &lt;span style="color:#2b91af;"&gt;WebExceptionStatus&lt;/span&gt;.RequestCanceled)
                {
                    System.Diagnostics.&lt;span style="color:#2b91af;"&gt;Debug&lt;/span&gt;.WriteLine(&lt;span style="color:#a31515;"&gt;&amp;quot;Request was cancelled&amp;quot;&lt;/span&gt;);
                }
                &lt;span style="color:blue;"&gt;else
                &lt;/span&gt;{
                    &lt;span style="color:green;"&gt;// Some other WebException. Do something…
&lt;/span&gt;                }
            }
            &lt;span style="color:blue;"&gt;else
            &lt;/span&gt;{
                System.Diagnostics.&lt;span style="color:#2b91af;"&gt;Debug&lt;/span&gt;.WriteLine(&lt;span style="color:#a31515;"&gt;&amp;quot;WebClient failed with &amp;quot; &lt;/span&gt;+ e.Error.Message);

                &lt;span style="color:green;"&gt;// Some other Exception. Do something…
&lt;/span&gt;            }
        }
        &lt;span style="color:blue;"&gt;else
        &lt;/span&gt;{
            System.Diagnostics.&lt;span style="color:#2b91af;"&gt;Debug&lt;/span&gt;.WriteLine(&lt;span style="color:#a31515;"&gt;&amp;quot;Request completed successfully&amp;quot;&lt;/span&gt;);

            &lt;span style="color:green;"&gt;// Got response! Do something…
&lt;/span&gt;        }
    } 
} &lt;/pre&gt;&lt;pre class="code"&gt;&amp;nbsp;&lt;/pre&gt;
&lt;h2&gt;Networking Calls and Tombstoned State&lt;/h2&gt;
&lt;p&gt;When your app is reactivated from a tombstoned state, any record or trace of networking calls that were in progress when the app was deactivated has disappeared. It is up to you to store some kind of state relating to any in progress networking calls – in persistent storage, or the Application or Page state dictionaries - when the app is deactivated. You can then retrieve that state data when the app reactivates from tombstoned and execute whatever logic you need to recover.&lt;/p&gt;
&lt;h1&gt;Creating a Networking Class that Recovers from Dormant and Tombstoned&lt;/h1&gt;
&lt;p&gt;Armed with the information above, we can now start thinking about how to create a class to use in our Windows Phone apps that can complete networking calls if the app is deactivated when a request has been made but the response has not come back yet. To do this, I developed a simple ODATA web service that returns a list of four dummy data objects. It’s included in the sample code for this post so I’m not going to waste time explaining how it works, but for those who are interested, I built it to serve some simple POCO objects (Plain Old CLR Objects) using excellent instructions I found in &lt;a href="http://lostintangent.com/post/3189655590/you-want-to-wrap-odata-around-what"&gt;this post&amp;nbsp; here&lt;/a&gt;. &lt;/p&gt;
&lt;p&gt;In a browser, the output from this service looks like this:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://mobileworld.appamundi.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/andywigley/ODataService_5F00_55758CC8.png"&gt;&lt;img style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:inline;border-top:0px;border-right:0px;padding-top:0px;" title="ODataService" border="0" alt="ODataService" src="http://mobileworld.appamundi.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/andywigley/ODataService_5F00_thumb_5F00_6B2F4F58.png" width="654" height="445" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;However, the key feature of this service is that I’ve programmed in an artificial 5 second delay on any response, so this gives us time to deactivate our app after the request has been made and before the service sends the response back, so we can test our networking class.&lt;/p&gt;
&lt;p&gt;It’s always a good idea to encapsulate related logic together into a single class, and in this case I have created a class called WebDataService which will contain the logic to make a request to the web service, return the results (or report an exception) to any clients of this class and it will – by the time we’ve finished – contain logic to recover from dormant or tombstoned state.&lt;/p&gt;
&lt;h2&gt;First Iteration – Basic Networking Class&lt;/h2&gt;
&lt;p&gt;My first iteration simply contains the logic to make the call, handle the response and return the received objects by firing a &lt;strong&gt;WebDataRequestCompleted&lt;/strong&gt; event, or if an error is encountered fire a &lt;strong&gt;WebDataRequestException&lt;/strong&gt; event. The client – which is MainForm in the sample app for this post – subscribes to these events so that it is notified when the request completes. &lt;/p&gt;
&lt;p&gt;It includes a few nice embellishments: for one thing, it uses a BackgroundWorker to make the request and handle the deserialization of the response on a worker thread so that we keep all that processing off the UI thread, and it contains a private bool property called &lt;strong&gt;isRequestActive&lt;/strong&gt; which is used to ensure this class can only handle one request at a time. It also uses &lt;a href="http://www.jeff.wilcox.name/2011/07/creating-a-global-progressindicator-experience-using-the-windows-phone-7-1-sdk-beta-2/"&gt;Jeff Wilcox’s Global Progress Indicator solution&lt;/a&gt; to show a progress bar while a request is in progress.&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;FetchUsingWebClient&lt;/strong&gt; method sets the Accept header on the request to application/json to request the data from the ODATA service serialized as JSON, and in the &lt;strong&gt;webclient_DownloadStringCompleted&lt;/strong&gt; method, I use the LINQ to JSON capability of the JSON.NET library&amp;nbsp; (&lt;a title="http://json.codeplex.com/" href="http://json.codeplex.com/"&gt;http://json.codeplex.com/&lt;/a&gt;) to deserialize the JSON and to create the List of DataObject types that is the retrieved data.&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color:blue;"&gt;using &lt;/span&gt;System;
&lt;span style="color:blue;"&gt;using &lt;/span&gt;System.Collections.Generic;
&lt;span style="color:blue;"&gt;using &lt;/span&gt;System.ComponentModel;
&lt;span style="color:blue;"&gt;using &lt;/span&gt;System.Linq;
&lt;span style="color:blue;"&gt;using &lt;/span&gt;System.Net;
&lt;span style="color:blue;"&gt;using &lt;/span&gt;NetworkingRecoveryOnReactivationSample.Misc;
&lt;span style="color:blue;"&gt;using &lt;/span&gt;NetworkingRecoveryOnReactivationSample.MyDataServiceReference;
&lt;span style="color:blue;"&gt;using &lt;/span&gt;System.Collections;

&lt;span style="color:blue;"&gt;namespace &lt;/span&gt;NetworkingRecoveryOnReactivationSample
{
    &lt;span style="color:blue;"&gt;public class &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;WebDataService
    &lt;/span&gt;{
        &lt;span style="color:blue;"&gt;private &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;WebClient &lt;/span&gt;webClient = &lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;WebClient&lt;/span&gt;();

        &lt;span style="color:blue;"&gt;public event &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;EventHandler&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af;"&gt;WebDataRequestCompletedEventArgs&lt;/span&gt;&amp;gt; WebDataRequestCompleted;
        &lt;span style="color:blue;"&gt;public event &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;EventHandler&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af;"&gt;WebDataRequestExceptionEventArgs&lt;/span&gt;&amp;gt; WebDataRequestException;

        &lt;span style="color:blue;"&gt;private bool &lt;/span&gt;isRequestActive { &lt;span style="color:blue;"&gt;set&lt;/span&gt;; &lt;span style="color:blue;"&gt;get&lt;/span&gt;; }

        &lt;span style="color:blue;"&gt;public &lt;/span&gt;WebDataService()
        {
            webClient.DownloadStringCompleted += &lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;DownloadStringCompletedEventHandler&lt;/span&gt;(webClient_DownloadStringCompleted);
        }

        &lt;span style="color:blue;"&gt;public void &lt;/span&gt;FetchUsingWebClient()
        {
            &lt;span style="color:green;"&gt;// WebClient instance only allows one request at a time
            &lt;/span&gt;&lt;span style="color:blue;"&gt;if &lt;/span&gt;(!isRequestActive)
            {
                isRequestActive = &lt;span style="color:blue;"&gt;true&lt;/span&gt;;
                System.Diagnostics.&lt;span style="color:#2b91af;"&gt;Debug&lt;/span&gt;.WriteLine(&lt;span style="color:#a31515;"&gt;&amp;quot;Starting new Request&amp;quot;&lt;/span&gt;);

                &lt;span style="color:green;"&gt;// Let&amp;#39;s do this properly and do our network calls and response processing on a worker thread
                &lt;/span&gt;&lt;span style="color:blue;"&gt;var &lt;/span&gt;bgworker = &lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;BackgroundWorker&lt;/span&gt;();
                bgworker.DoWork += ((s, e) =&amp;gt;
                    {
                        webClient.Headers[&lt;span style="color:#a31515;"&gt;&amp;quot;Accept&amp;quot;&lt;/span&gt;] = &lt;span style="color:#a31515;"&gt;&amp;quot;application/json&amp;quot;&lt;/span&gt;;
                        webClient.DownloadStringAsync(&lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;Uri&lt;/span&gt;(&lt;span style="color:#a31515;"&gt;&amp;quot;http://localhost:8414/MyDataService.svc/DataObjects&amp;quot;&lt;/span&gt;, &lt;span style="color:#2b91af;"&gt;UriKind&lt;/span&gt;.Absolute));
                    }
                );
                bgworker.RunWorkerAsync();

                ((&lt;span style="color:#2b91af;"&gt;App&lt;/span&gt;)&lt;span style="color:#2b91af;"&gt;App&lt;/span&gt;.Current).RootFrame.Dispatcher.BeginInvoke(() =&amp;gt;
                    &lt;span style="color:#2b91af;"&gt;GlobalLoading&lt;/span&gt;.Instance.IsLoading = &lt;span style="color:blue;"&gt;true&lt;/span&gt;);
            }
        }

        &lt;span style="color:blue;"&gt;void &lt;/span&gt;webClient_DownloadStringCompleted(&lt;span style="color:blue;"&gt;object &lt;/span&gt;sender, &lt;span style="color:#2b91af;"&gt;DownloadStringCompletedEventArgs &lt;/span&gt;e)
        {
            isRequestActive = &lt;span style="color:blue;"&gt;false&lt;/span&gt;;

            ((&lt;span style="color:#2b91af;"&gt;App&lt;/span&gt;)&lt;span style="color:#2b91af;"&gt;App&lt;/span&gt;.Current).RootFrame.Dispatcher.BeginInvoke(()=&amp;gt;
                &lt;span style="color:#2b91af;"&gt;GlobalLoading&lt;/span&gt;.Instance.IsLoading = &lt;span style="color:blue;"&gt;false&lt;/span&gt;);

            &lt;span style="color:blue;"&gt;if &lt;/span&gt;(e.Error != &lt;span style="color:blue;"&gt;null&lt;/span&gt;)
            {
                System.Diagnostics.&lt;span style="color:#2b91af;"&gt;Debug&lt;/span&gt;.WriteLine(&lt;span style="color:#a31515;"&gt;&amp;quot;WebClient failed with &amp;quot; &lt;/span&gt;+ e.Error.Message);

                &lt;span style="color:green;"&gt;// report exception to client
                &lt;/span&gt;&lt;span style="color:blue;"&gt;if &lt;/span&gt;(WebDataRequestException != &lt;span style="color:blue;"&gt;null&lt;/span&gt;)
                    WebDataRequestException(&lt;span style="color:blue;"&gt;this&lt;/span&gt;, &lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;WebDataRequestExceptionEventArgs&lt;/span&gt;(e.Error));
            }
            &lt;span style="color:blue;"&gt;else
            &lt;/span&gt;{
                System.Diagnostics.&lt;span style="color:#2b91af;"&gt;Debug&lt;/span&gt;.WriteLine(&lt;span style="color:#a31515;"&gt;&amp;quot;Request completed successfully&amp;quot;&lt;/span&gt;);

                &lt;span style="color:green;"&gt;// Deserialize using LINQ to JSON
                &lt;/span&gt;Newtonsoft.Json.Linq.&lt;span style="color:#2b91af;"&gt;JObject &lt;/span&gt;jObject = Newtonsoft.Json.Linq.&lt;span style="color:#2b91af;"&gt;JObject&lt;/span&gt;.Parse(e.Result);

                &lt;span style="color:blue;"&gt;var &lt;/span&gt;results = &lt;span style="color:blue;"&gt;from &lt;/span&gt;item &lt;span style="color:blue;"&gt;in &lt;/span&gt;jObject[&lt;span style="color:#a31515;"&gt;&amp;quot;d&amp;quot;&lt;/span&gt;]
                              &lt;span style="color:blue;"&gt;select &lt;/span&gt;(&lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;DataObject
                                        &lt;/span&gt;{
                                            Id = (&lt;span style="color:blue;"&gt;int&lt;/span&gt;)item[&lt;span style="color:#a31515;"&gt;&amp;quot;Id&amp;quot;&lt;/span&gt;],
                                            Name = (&lt;span style="color:blue;"&gt;string&lt;/span&gt;)item[&lt;span style="color:#a31515;"&gt;&amp;quot;Name&amp;quot;&lt;/span&gt;],
                                            Description = (&lt;span style="color:blue;"&gt;string&lt;/span&gt;)item[&lt;span style="color:#a31515;"&gt;&amp;quot;Description&amp;quot;&lt;/span&gt;],
                                            ANumber1 = (&lt;span style="color:blue;"&gt;int&lt;/span&gt;)item[&lt;span style="color:#a31515;"&gt;&amp;quot;ANumber1&amp;quot;&lt;/span&gt;],
                                            ANumber2 = (&lt;span style="color:blue;"&gt;int&lt;/span&gt;)item[&lt;span style="color:#a31515;"&gt;&amp;quot;ANumber2&amp;quot;&lt;/span&gt;]
                                        });

                &lt;span style="color:green;"&gt;// Fire event to inform observers that results are ready
                &lt;/span&gt;&lt;span style="color:blue;"&gt;if &lt;/span&gt;(WebDataRequestCompleted != &lt;span style="color:blue;"&gt;null&lt;/span&gt;)
                {
                    WebDataRequestCompleted(&lt;span style="color:blue;"&gt;this&lt;/span&gt;, &lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;WebDataRequestCompletedEventArgs&lt;/span&gt;(results.ToList()));
                }
            }
        } 
    }

    &lt;span style="color:blue;"&gt;public class &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;WebDataRequestCompletedEventArgs &lt;/span&gt;: &lt;span style="color:#2b91af;"&gt;EventArgs
    &lt;/span&gt;{
        &lt;span style="color:blue;"&gt;public &lt;/span&gt;WebDataRequestCompletedEventArgs(&lt;span style="color:#2b91af;"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af;"&gt;DataObject&lt;/span&gt;&amp;gt; objects)
        {
            Data = objects;
        }
        &lt;span style="color:blue;"&gt;public &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af;"&gt;DataObject&lt;/span&gt;&amp;gt; Data { &lt;span style="color:blue;"&gt;get&lt;/span&gt;; &lt;span style="color:blue;"&gt;set&lt;/span&gt;; }
    }

    &lt;span style="color:blue;"&gt;public class &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;WebDataRequestExceptionEventArgs &lt;/span&gt;: &lt;span style="color:#2b91af;"&gt;EventArgs
    &lt;/span&gt;{
        &lt;span style="color:blue;"&gt;public &lt;/span&gt;WebDataRequestExceptionEventArgs(&lt;span style="color:#2b91af;"&gt;Exception &lt;/span&gt;exc)
        {
            Error = exc;
        }
        &lt;span style="color:blue;"&gt;public &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;Exception &lt;/span&gt;Error { &lt;span style="color:blue;"&gt;get&lt;/span&gt;; &lt;span style="color:blue;"&gt;set&lt;/span&gt;; }
    }
}&lt;/pre&gt;&lt;pre class="code"&gt;
&lt;/pre&gt;
&lt;p&gt;To use this class, I create it and expose an instance of this class through a property in App.xaml.cs:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color:blue;"&gt;public partial class &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;App &lt;/span&gt;: &lt;span style="color:#2b91af;"&gt;Application
&lt;/span&gt;{
    &lt;span style="color:blue;"&gt;private static &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;WebDataService &lt;/span&gt;webDataService;

    &lt;span style="color:blue;"&gt;public static &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;WebDataService &lt;/span&gt;WebDataService
    {
        &lt;span style="color:blue;"&gt;get
        &lt;/span&gt;{
            &lt;span style="color:blue;"&gt;if &lt;/span&gt;(webDataService == &lt;span style="color:blue;"&gt;null&lt;/span&gt;)
                webDataService = &lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;WebDataService&lt;/span&gt;();

            &lt;span style="color:blue;"&gt;return &lt;/span&gt;webDataService;
        }
    }&lt;/pre&gt;&lt;pre class="code"&gt;    …&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;}
&lt;/pre&gt;
&lt;p&gt;and in my MainPage.xaml.cs, I hook and unhook the events and make the call to the &lt;strong&gt;FetchUsingWebClient&lt;/strong&gt; method to make the request. I’m not showing the XAML of the UI here, but if you download the sample, you’ll see that it has a button on it to make the request, and a ListBox to show the results:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color:blue;"&gt;public partial class &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;MainPage &lt;/span&gt;: &lt;span style="color:#2b91af;"&gt;PhoneApplicationPage
&lt;/span&gt;{
    &lt;span style="color:green;"&gt;// Constructor
    &lt;/span&gt;&lt;span style="color:blue;"&gt;public &lt;/span&gt;MainPage()
    {
        InitializeComponent();
    }

    &lt;span style="color:blue;"&gt;protected override void &lt;/span&gt;OnNavigatedTo(System.Windows.Navigation.&lt;span style="color:#2b91af;"&gt;NavigationEventArgs &lt;/span&gt;e)
    {
        &lt;span style="color:blue;"&gt;base&lt;/span&gt;.OnNavigatedTo(e);

        &lt;span style="color:#2b91af;"&gt;App&lt;/span&gt;.WebDataService.WebDataRequestCompleted += &lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;EventHandler&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af;"&gt;WebDataRequestCompletedEventArgs&lt;/span&gt;&amp;gt;(WebDataService_WebDataRequestCompleted);
    }

    &lt;span style="color:blue;"&gt;protected override void &lt;/span&gt;OnNavigatedFrom(System.Windows.Navigation.&lt;span style="color:#2b91af;"&gt;NavigationEventArgs &lt;/span&gt;e)
    {
        &lt;span style="color:blue;"&gt;base&lt;/span&gt;.OnNavigatedFrom(e);

        &lt;span style="color:#2b91af;"&gt;App&lt;/span&gt;.WebDataService.WebDataRequestCompleted -= &lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;EventHandler&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af;"&gt;WebDataRequestCompletedEventArgs&lt;/span&gt;&amp;gt;(WebDataService_WebDataRequestCompleted);
    }

    &lt;span style="color:blue;"&gt;void &lt;/span&gt;WebDataService_WebDataRequestCompleted(&lt;span style="color:blue;"&gt;object &lt;/span&gt;sender, &lt;span style="color:#2b91af;"&gt;WebDataRequestCompletedEventArgs &lt;/span&gt;e)
    {
        Dispatcher.BeginInvoke(()=&amp;gt;
            &lt;span style="color:blue;"&gt;this&lt;/span&gt;.DataObjectsListBox.ItemsSource = e.Data
        );
    }

    &lt;span style="color:blue;"&gt;private void &lt;/span&gt;btnWebClient_Click(&lt;span style="color:blue;"&gt;object &lt;/span&gt;sender, &lt;span style="color:#2b91af;"&gt;RoutedEventArgs &lt;/span&gt;e)
    {
        &lt;span style="color:green;"&gt;// Clear context first
        &lt;/span&gt;&lt;span style="color:blue;"&gt;this&lt;/span&gt;.DataObjectsListBox.ItemsSource = &lt;span style="color:blue;"&gt;null&lt;/span&gt;;

        &lt;span style="color:#2b91af;"&gt;App&lt;/span&gt;.WebDataService.FetchUsingWebClient();
    }
}&lt;/pre&gt;&lt;pre class="code"&gt;
&lt;/pre&gt;
&lt;h2&gt;Implementing Automatic Recovery when Reactivating from Dormant&lt;/h2&gt;
&lt;p&gt;If you run the app using the code as shown above, and press the button on the main page, you’ll see the progress indicator at the top of the page and after about 5 seconds, the web service returns the data and it shows up in the ListBox. So far, so good!&lt;/p&gt;
&lt;p&gt;&lt;a href="http://mobileworld.appamundi.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/andywigley/NetworkRecoverySample_5F00_1239E8CE.png"&gt;&lt;img style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:inline;border-top:0px;border-right:0px;padding-top:0px;" title="NetworkRecoverySample" border="0" alt="NetworkRecoverySample" src="http://mobileworld.appamundi.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/andywigley/NetworkRecoverySample_5F00_thumb_5F00_55C17423.png" width="267" height="491" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;However, if you press the Windows ‘Start’ button on the phone after pressing the WebClient button and before the response comes back, then the app is deactivated and is dormant. Press the Back button on the phone and your app is reactivated but the data does not appear. The data service class fires the &lt;strong&gt;WebDataRequestException&lt;/strong&gt; event to report that the request failed with a WebException.&lt;/p&gt;
&lt;p&gt;We can easily update the WebDataService class to allow it to retry the request in this situation. A simple solution would simply be to implement an automatic retry when the request fails with a Request Cancelled status, but I’ve implemented a slightly more refined solution. I’ve added a public &lt;strong&gt;bool&lt;/strong&gt; property called &lt;strong&gt;IsReactivatingFromDormant&lt;/strong&gt; which we can set from our Application_Activating event handler if we are reactivating from dormant and is just a flag that the logic in webClient_DownloadStringCompleted can query the very next time it processes a response. If the flag is set, and the request fails with a Request cancelled status, then we just make the request again. Changes are shown here in italics:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color:gray;"&gt;&lt;strong&gt;&lt;em&gt;/// &amp;lt;summary&amp;gt;
/// &lt;/em&gt;&lt;/strong&gt;&lt;/span&gt;&lt;span style="color:green;"&gt;&lt;strong&gt;&lt;em&gt;Property that can be set from Application_Activating to allow retry of incomplete requests
&lt;/em&gt;&lt;/strong&gt;&lt;/span&gt;&lt;strong&gt;&lt;em&gt;&lt;span style="color:gray;"&gt;/// &amp;lt;/summary&amp;gt;
&lt;/span&gt;&lt;span style="color:blue;"&gt;public bool &lt;/span&gt;IsReactivatingFromDormant { &lt;span style="color:blue;"&gt;set&lt;/span&gt;; &lt;span style="color:blue;"&gt;private get&lt;/span&gt;;  }&lt;/em&gt;&lt;/strong&gt;

&lt;span style="color:blue;"&gt;&lt;/span&gt;&lt;font color="#0000ff"&gt;…&lt;/font&gt;&lt;/pre&gt;&lt;pre class="code"&gt;&lt;font color="#0000ff"&gt;&lt;/font&gt;
&lt;span style="color:blue;"&gt;void &lt;/span&gt;webClient_DownloadStringCompleted(&lt;span style="color:blue;"&gt;object &lt;/span&gt;sender, &lt;span style="color:#2b91af;"&gt;DownloadStringCompletedEventArgs &lt;/span&gt;e)
{
    isRequestActive = &lt;span style="color:blue;"&gt;false&lt;/span&gt;;

    ((&lt;span style="color:#2b91af;"&gt;App&lt;/span&gt;)&lt;span style="color:#2b91af;"&gt;App&lt;/span&gt;.Current).RootFrame.Dispatcher.BeginInvoke(()=&amp;gt;
        &lt;span style="color:#2b91af;"&gt;GlobalLoading&lt;/span&gt;.Instance.IsLoading = &lt;span style="color:blue;"&gt;false&lt;/span&gt;);

    &lt;span style="color:blue;"&gt;if &lt;/span&gt;(e.Error != &lt;span style="color:blue;"&gt;null&lt;/span&gt;)
    {
&lt;strong&gt;&lt;em&gt;        &lt;span style="color:blue;"&gt;if &lt;/span&gt;(e.Error &lt;span style="color:blue;"&gt;is &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;WebException&lt;/span&gt;)
        {
            &lt;span style="color:blue;"&gt;var &lt;/span&gt;wEx = e.Error &lt;span style="color:blue;"&gt;as &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;WebException&lt;/span&gt;;
            &lt;span style="color:blue;"&gt;if &lt;/span&gt;(wEx.Status == &lt;span style="color:#2b91af;"&gt;WebExceptionStatus&lt;/span&gt;.RequestCanceled)
            {
                System.Diagnostics.&lt;span style="color:#2b91af;"&gt;Debug&lt;/span&gt;.WriteLine(&lt;span style="color:#a31515;"&gt;&amp;quot;Request was cancelled&amp;quot;&lt;/span&gt;);

                &lt;/em&gt;&lt;/strong&gt;&lt;strong&gt;&lt;em&gt;&lt;span style="color:green;"&gt;// Are we just restarting from dormant?
                &lt;/span&gt;&lt;span style="color:blue;"&gt;if &lt;/span&gt;(&lt;span style="color:blue;"&gt;this&lt;/span&gt;.IsReactivatingFromDormant)
                {
                    &lt;/em&gt;&lt;/strong&gt;&lt;strong&gt;&lt;em&gt;&lt;span style="color:green;"&gt;// Request was probably cancelled due to the app going dormant
                    &lt;/span&gt;&lt;span style="color:blue;"&gt;this&lt;/span&gt;.IsReactivatingFromDormant = &lt;span style="color:blue;"&gt;false&lt;/span&gt;;
                    &lt;/em&gt;&lt;/strong&gt;&lt;strong&gt;&lt;em&gt;&lt;span style="color:green;"&gt;// Retry
                    &lt;/span&gt;FetchUsingWebClient();
                }
            }
            &lt;/em&gt;&lt;/strong&gt;&lt;strong&gt;&lt;em&gt;&lt;span style="color:blue;"&gt;else
            &lt;/span&gt;{
                System.Diagnostics.&lt;span style="color:#2b91af;"&gt;Debug&lt;/span&gt;.WriteLine(&lt;span style="color:#a31515;"&gt;&amp;quot;Request failed with WebException: &amp;quot; &lt;/span&gt;+ wEx.Message);

                &lt;/em&gt;&lt;/strong&gt;&lt;strong&gt;&lt;em&gt;&lt;span style="color:green;"&gt;// report exception to client
                &lt;/span&gt;&lt;span style="color:blue;"&gt;if &lt;/span&gt;(WebDataRequestException != &lt;span style="color:blue;"&gt;null&lt;/span&gt;)
                    WebDataRequestException(&lt;span style="color:blue;"&gt;this&lt;/span&gt;, &lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;WebDataRequestExceptionEventArgs&lt;/span&gt;(e.Error));
            }
        }
        &lt;/em&gt;&lt;/strong&gt;&lt;span style="color:blue;"&gt;&lt;strong&gt;&lt;em&gt;else&lt;/em&gt;&lt;/strong&gt;
        &lt;/span&gt;{
            System.Diagnostics.&lt;span style="color:#2b91af;"&gt;Debug&lt;/span&gt;.WriteLine(&lt;span style="color:#a31515;"&gt;&amp;quot;WebClient failed with &amp;quot; &lt;/span&gt;+ e.Error.Message);

            &lt;span style="color:green;"&gt;// report exception to client
            &lt;/span&gt;&lt;span style="color:blue;"&gt;if &lt;/span&gt;(WebDataRequestException != &lt;span style="color:blue;"&gt;null&lt;/span&gt;)
                WebDataRequestException(&lt;span style="color:blue;"&gt;this&lt;/span&gt;, &lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;WebDataRequestExceptionEventArgs&lt;/span&gt;(e.Error));
        }
    }
    &lt;span style="color:blue;"&gt;else
    &lt;/span&gt;{
        System.Diagnostics.&lt;span style="color:#2b91af;"&gt;Debug&lt;/span&gt;.WriteLine(&lt;span style="color:#a31515;"&gt;&amp;quot;Request completed successfully&amp;quot;&lt;/span&gt;);

        &lt;span style="color:green;"&gt;// Deserialize using LINQ to JSON
        &lt;font color="#000000"&gt;…&lt;/font&gt;&lt;/span&gt;
    }

&lt;strong&gt;&lt;em&gt;    &lt;span style="color:blue;"&gt;this&lt;/span&gt;.IsReactivatingFromDormant = &lt;span style="color:blue;"&gt;false&lt;/span&gt;;&lt;/em&gt;&lt;/strong&gt;
}&lt;/pre&gt;&lt;pre class="code"&gt; 
&lt;/pre&gt;
&lt;p&gt;You just set this flag from your Application_Activated event handler:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color:green;"&gt;// Code to execute when the application is activated (brought to foreground)
// This code will not execute when the application is first launched
&lt;/span&gt;&lt;span style="color:blue;"&gt;private void &lt;/span&gt;Application_Activated(&lt;span style="color:blue;"&gt;object &lt;/span&gt;sender, &lt;span style="color:#2b91af;"&gt;ActivatedEventArgs &lt;/span&gt;e)
{
    &lt;span style="color:blue;"&gt;if &lt;/span&gt;(e.IsApplicationInstancePreserved)
    {
        &lt;span style="color:green;"&gt;// Set flag on the data service to allow retry of requests that failed because we went dormant
        &lt;/span&gt;WebDataService.IsReactivatingFromDormant = &lt;span style="color:blue;"&gt;true&lt;/span&gt;;
    }
}
&lt;/pre&gt;
&lt;p&gt;With this enhancement, you can cause the app to be deactivated and then reactivated, and the request will be reissued without reporting an error.&lt;/p&gt;
&lt;h2&gt;Implementing Automatic Recovery when Reactivating from Tombstoned&lt;/h2&gt;
&lt;p&gt;If you now go into the Project Properties window and check the Tombstone upon Deactivation checkbox and repeat the exercise – deactivate and then reactivate – the app will be tombstoned instead of dormant when you deactivate it.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://mobileworld.appamundi.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/andywigley/TombstoneUponDeactivation_5F00_32B102B3.png"&gt;&lt;img style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:inline;border-top:0px;border-right:0px;padding-top:0px;" title="TombstoneUponDeactivation" border="0" alt="TombstoneUponDeactivation" src="http://mobileworld.appamundi.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/andywigley/TombstoneUponDeactivation_5F00_thumb_5F00_100CC438.png" width="724" height="476" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;In this case no data is shown and no error is reported, because when the app is reactivated from a tombstoned state, a new instance of our WebDataService class is created and there is no record of the previous abandoned request. We must implement logic in our data service class to save its state on deactivation and record whether a request was in progress, and then to restore that state on reactivation and if that state tells us that a request *was* in progress, then reissue the request.&lt;/p&gt;
&lt;p&gt;This logic can be implemented by a pair of methods: &lt;strong&gt;SaveState&lt;/strong&gt; and &lt;strong&gt;RestoreState&lt;/strong&gt;:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color:blue;"&gt;private const string &lt;/span&gt;WebDataServiceIsRequestActiveKey = &lt;span style="color:#a31515;"&gt;&amp;quot;WebDataServiceIsRequestActive&amp;quot;&lt;/span&gt;;

&lt;span style="color:gray;"&gt;/// &amp;lt;summary&amp;gt;
/// &lt;/span&gt;&lt;span style="color:green;"&gt;Method called from Application_Deactivating to save state
&lt;/span&gt;&lt;span style="color:gray;"&gt;/// &amp;lt;/summary&amp;gt;
/// &amp;lt;param name=&amp;quot;state&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green;"&gt;Application State Dictionary&lt;/span&gt;&lt;span style="color:gray;"&gt;&amp;lt;/param&amp;gt;
&lt;/span&gt;&lt;span style="color:blue;"&gt;public void &lt;/span&gt;SaveState(&lt;span style="color:#2b91af;"&gt;IDictionary&lt;/span&gt;&amp;lt;&lt;span style="color:blue;"&gt;string&lt;/span&gt;, &lt;span style="color:blue;"&gt;object&lt;/span&gt;&amp;gt; state)
{
    &lt;span style="color:green;"&gt;// save data on whether we have an active request in the state
    &lt;/span&gt;state[WebDataServiceIsRequestActiveKey] = isRequestActive;
}

&lt;span style="color:gray;"&gt;/// &amp;lt;summary&amp;gt;
/// &lt;/span&gt;&lt;span style="color:green;"&gt;Method called from Application_Activated if returning from Tombstoned
&lt;/span&gt;&lt;span style="color:gray;"&gt;/// &amp;lt;/summary&amp;gt;
/// &amp;lt;param name=&amp;quot;state&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:green;"&gt;Application State Dictionary&lt;/span&gt;&lt;span style="color:gray;"&gt;&amp;lt;/param&amp;gt;
&lt;/span&gt;&lt;span style="color:blue;"&gt;public void &lt;/span&gt;RestoreState(&lt;span style="color:#2b91af;"&gt;IDictionary&lt;/span&gt;&amp;lt;&lt;span style="color:blue;"&gt;string&lt;/span&gt;, &lt;span style="color:blue;"&gt;object&lt;/span&gt;&amp;gt; state)
{
    &lt;span style="color:green;"&gt;// See if we have an incomplete request in the state
    &lt;/span&gt;&lt;span style="color:blue;"&gt;if &lt;/span&gt;(state.ContainsKey(WebDataServiceIsRequestActiveKey))
    {
        &lt;span style="color:blue;"&gt;if &lt;/span&gt;((&lt;span style="color:blue;"&gt;bool&lt;/span&gt;)state[WebDataServiceIsRequestActiveKey])
        {
            &lt;span style="color:green;"&gt;// Restart the request
            &lt;/span&gt;FetchUsingWebClient();
        }
    }            
}&lt;/pre&gt;&lt;pre class="code"&gt;
&lt;/pre&gt;
&lt;p&gt;Simply call these methods from Application_Deactivating and Application_Reactivating to implement this new functionality:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color:green;"&gt;// Code to execute when the application is activated (brought to foreground)
// This code will not execute when the application is first launched
&lt;/span&gt;&lt;span style="color:blue;"&gt;private void &lt;/span&gt;Application_Activated(&lt;span style="color:blue;"&gt;object &lt;/span&gt;sender, &lt;span style="color:#2b91af;"&gt;ActivatedEventArgs &lt;/span&gt;e)
{
    &lt;span style="color:blue;"&gt;if &lt;/span&gt;(e.IsApplicationInstancePreserved)
    {
        &lt;span style="color:green;"&gt;// Set flag on the data service to allow retry of requests that failed because we went dormant
        &lt;/span&gt;WebDataService.IsReactivatingFromDormant = &lt;span style="color:blue;"&gt;true&lt;/span&gt;;
    }
    &lt;span style="color:blue;"&gt;else
    &lt;/span&gt;{
        &lt;span style="color:green;"&gt;// Restore state of the service
        &lt;/span&gt;WebDataService.RestoreState(&lt;span style="color:#2b91af;"&gt;PhoneApplicationService&lt;/span&gt;.Current.State);
    }
}

&lt;span style="color:green;"&gt;// Code to execute when the application is deactivated (sent to background)
// This code will not execute when the application is closing
&lt;/span&gt;&lt;span style="color:blue;"&gt;private void &lt;/span&gt;Application_Deactivated(&lt;span style="color:blue;"&gt;object &lt;/span&gt;sender, &lt;span style="color:#2b91af;"&gt;DeactivatedEventArgs &lt;/span&gt;e)
{
    &lt;span style="color:green;"&gt;// Get the data service to save its state
    &lt;/span&gt;WebDataService.SaveState(&lt;span style="color:#2b91af;"&gt;PhoneApplicationService&lt;/span&gt;.Current.State);
}
&lt;/pre&gt;
&lt;h1&gt;Summary&lt;/h1&gt;
&lt;p&gt;This post has shown one technique for handling networking calls that can recover if the app is deactivated while a request is in progress. Every app has its own requirements, so this solution will not necessarily suit all situations. However, in many cases, the general approach shown here of placing your networking code into a dedicated class and implementing recovery logic will allow your apps to continue functioning correctly throughout the different stages of the application lifecycle.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://mobileworld.appamundi.com/aggbug.aspx?PostID=458" width="1" height="1"&gt;</description><enclosure url="http://mobileworld.appamundi.com/cfs-file.ashx/__key/CommunityServer.Components.PostAttachments/00.00.00.04.58/NetworkingRecoveryOnReactivationSample.zip" length="3267891" type="application/x-zip-compressed" /><category domain="http://mobileworld.appamundi.com/blogs/andywigley/archive/tags/Networking/default.aspx">Networking</category><category domain="http://mobileworld.appamundi.com/blogs/andywigley/archive/tags/Silverlight/default.aspx">Silverlight</category><category domain="http://mobileworld.appamundi.com/blogs/andywigley/archive/tags/Windows+Phone+7/default.aspx">Windows Phone 7</category><category domain="http://mobileworld.appamundi.com/blogs/andywigley/archive/tags/wp7dev/default.aspx">wp7dev</category><category domain="http://mobileworld.appamundi.com/blogs/andywigley/archive/tags/_2300_wp7dev/default.aspx">#wp7dev</category></item><item><title>Globalizing and Localizing a Windows Phone App</title><link>http://mobileworld.appamundi.com/blogs/andywigley/archive/2012/04/06/globalizing-and-localizing-a-windows-phone-app.aspx</link><pubDate>Fri, 06 Apr 2012 10:29:33 GMT</pubDate><guid isPermaLink="false">989b12f5-6f26-47d9-9f0d-67fe982b88db:457</guid><dc:creator>Andy Wigley</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;There’s a great post on the Windows Phone Developers Blog on Globalizing and Localizing a Windows Phone App. It’s a great summary of all the good advice that’s out there, but the standout info for me is how to handle different regional variations such as en-US and en-GB, or es-ES and es-MX. I’ve not seen this explained clearly anywhere before – until now!&lt;/p&gt;  &lt;p&gt;Read the blog at &lt;a href="http://windowsteamblog.com/windows_phone/b/wpdev/archive/2012/04/02/globalizing-and-localizing-a-windows-phone-app.aspx"&gt;Globalizing and Localizing a Windows Phone App&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://mobileworld.appamundi.com/aggbug.aspx?PostID=457" width="1" height="1"&gt;</description></item><item><title>Nokia/Microsoft Windows Phone Camp - 31st March 2012</title><link>http://mobileworld.appamundi.com/blogs/petevickers/archive/2012/04/02/nokia-microsoft-windows-phone-camp-31st-march-2012.aspx</link><pubDate>Mon, 02 Apr 2012 09:42:00 GMT</pubDate><guid isPermaLink="false">989b12f5-6f26-47d9-9f0d-67fe982b88db:454</guid><dc:creator>Pete Vickers</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;Just a quick note of thanks to everyone who came to the Windows Phone camp at LBi last Saturday - we had a great time and hope you did too.&lt;/p&gt;
&lt;p&gt;Many thanks to John Cooper from Nokia for all his help, Riaz for his usual excellent help, and Lizzie and her team for all the great organisation.&lt;/p&gt;
&lt;p&gt;Thanks to Scott, Dave and Matt for coming along just to help spread their knowledge on Windows Phone - thanks guys.&lt;/p&gt;
&lt;p&gt;I have update the &lt;a href="http://mobileworld.appamundi.com/blogs/petevickers/archive/2011/11/13/links-and-resources-from-windows-phone-camps.aspx"&gt;&amp;#39;links&amp;#39;&lt;/a&gt;&amp;nbsp;blog to include a couple of new links we discussed, including a link to&amp;nbsp;the &lt;a href="http://channel9.msdn.com/Events/TechDays/Techdays-2012-the-Netherlands/2289"&gt;excellent presentation&lt;/a&gt; from Dave Crawford. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;Registration is open for the next camps at &lt;a href="http://uktechdays.cloudapp.net/upcoming-events/windows-phone-camp-london.aspx"&gt;LBi on the 12th May&lt;/a&gt;, and the &lt;a href="http://uktechdays.cloudapp.net/upcoming-events/windows-phone-camp-liverpool.aspx"&gt;Liverpool Arena on the 19th May&lt;/a&gt;. Stay tuned for news of any further camps.&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
&lt;p&gt;Pete &amp;amp; Andy&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://mobileworld.appamundi.com/aggbug.aspx?PostID=454" width="1" height="1"&gt;</description><category domain="http://mobileworld.appamundi.com/blogs/petevickers/archive/tags/Windows+Phone+7+Developer+Tools/default.aspx">Windows Phone 7 Developer Tools</category><category domain="http://mobileworld.appamundi.com/blogs/petevickers/archive/tags/windows+phone+camp/default.aspx">windows phone camp</category><category domain="http://mobileworld.appamundi.com/blogs/petevickers/archive/tags/_4000_wp7dev/default.aspx">@wp7dev</category><category domain="http://mobileworld.appamundi.com/blogs/petevickers/archive/tags/_4000_wpdev/default.aspx">@wpdev</category><category domain="http://mobileworld.appamundi.com/blogs/petevickers/archive/tags/_4000_wp7camp/default.aspx">@wp7camp</category></item><item><title>Free Windows Phone 7 training from Nokia/Microsoft/APPA Mundi</title><link>http://mobileworld.appamundi.com/blogs/petevickers/archive/2012/03/20/free-windows-phone-7-training-from-nokia-microsoft-appa-mundi.aspx</link><pubDate>Tue, 20 Mar 2012 13:33:00 GMT</pubDate><guid isPermaLink="false">989b12f5-6f26-47d9-9f0d-67fe982b88db:452</guid><dc:creator>Pete Vickers</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;After the success, and over-subscription to the London Windows Phone 7 camps organised by Microsoft, Nokia have come to the aid of developers, and added more camps in conjunction with Microsoft, again taking place&amp;nbsp;in London at &lt;a href="http://www.lbi.co.uk/"&gt;LBi&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The first of these will be held on the 31st of March 2012, with myself and Andy Wigley in attendance from APPA Mundi. You can &lt;a href="http://nokiamicrosoftwindowsphonecamp-rss.eventbrite.co.uk/?ebtv=C"&gt;register now&lt;/a&gt; - but be quick&amp;nbsp;- these events have filled up quickly in the past.&lt;/p&gt;
&lt;p&gt;LBi is a great venue for these events, having a great &amp;#39;workshop&amp;#39; area, as well as a great presentation area next to it. You can always play table tennis if you get fed up of listening to us.&lt;/p&gt;
&lt;p&gt;Hope to see you on the 31st &lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
&lt;p&gt;Pete&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://mobileworld.appamundi.com/aggbug.aspx?PostID=452" width="1" height="1"&gt;</description><category domain="http://mobileworld.appamundi.com/blogs/petevickers/archive/tags/Windows+Phone+7+development/default.aspx">Windows Phone 7 development</category><category domain="http://mobileworld.appamundi.com/blogs/petevickers/archive/tags/Windows+Phone+7+Developer+Tools/default.aspx">Windows Phone 7 Developer Tools</category><category domain="http://mobileworld.appamundi.com/blogs/petevickers/archive/tags/wpug/default.aspx">wpug</category><category domain="http://mobileworld.appamundi.com/blogs/petevickers/archive/tags/wp7/default.aspx">wp7</category></item><item><title>Windows Phone SDK 7.1.1</title><link>http://mobileworld.appamundi.com/blogs/peterfoot/archive/2012/02/27/windows-phone-sdk-7-1-1.aspx</link><pubDate>Mon, 27 Feb 2012 16:49:00 GMT</pubDate><guid isPermaLink="false">989b12f5-6f26-47d9-9f0d-67fe982b88db:451</guid><dc:creator>Peter Foot</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;At MWC today Nokia announced the Lumia 610 which is a lower spec device designed for emerging markets. This is running an updated Windows Phone OS which supports devices with just 256MB of RAM. To enable developers to create apps which support the new lower memory devices Microsoft are releasing an update to the Windows Phone SDK - 7.1.1.&lt;/p&gt;
&lt;p&gt;At the moment a CTP has been released so that you can test your applications on a 256MB emulator but you should not install this to your main development machine as it doesn&amp;#39;t have a Go-Live license. To try out the new SDK you can download the CTP here:-&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.microsoft.com/download/en/details.aspx?displaylang=en&amp;amp;id=28962"&gt;http://www.microsoft.com/download/en/details.aspx?displaylang=en&amp;amp;id=28962&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;There is just one API addition to support this change which is an additional property available from Microsoft.Phone.Info.DeviceExtendedProperties.GetValue - &amp;quot;&lt;span&gt;&lt;span class="input"&gt;ApplicationWorkingSetLimit&amp;quot; which will let you know whether you are running on a device with 256MB RAM. If your app/game is sufficiently resource heavy that you don&amp;#39;t feel it will run on such a device you can opt out so that your app/game will not be available on these lower powered devices. This is done by adding the Requirements element to your WMAppManifest.xml:-&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span class="input"&gt;&amp;lt;Requirements&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Requirement Name=&amp;quot;ID_REQ_MEMORY_90&amp;quot; /&amp;gt;&lt;br /&gt;&amp;lt;/Requirements&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span class="input"&gt;The other main difference for these devices is there is no support for Background tasks - either Periodic or ResourceIntensive and attempting to add a background task on one of these devices will throw an InvalidOperationException - so it&amp;#39;s important to to check the capabilities first. Because of this limitation you need to design your app such that it doesn&amp;#39;t rely on a background task and that whatever sync/processing the task normally performs can be done when the app is running in the foreground.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span class="input"&gt;Microsoft have prepared some information on optimising apps for 256MB and it is available here:-&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span class="input"&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/hh855081(v=vs.92).aspx"&gt;http://msdn.microsoft.com/en-us/library/hh855081(v=vs.92).aspx&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span class="input"&gt;Some of the suggestions including using the built in launchers and choosers rather than running functionality such as the WebBrowser control or Bing Maps control within your app. They also suggest avoiding using the page transitions provided by the Silverlight Toolkit but don&amp;#39;t suggest an alternative - not sure if this means these devices don&amp;#39;t have the smooth page transitions at all or if they are suggesting that doing them from managed code is too resource intensive. You may decide to implement multiple approaches and use different methods depending on the device capabilities. Obviously the trick here is the balance between providing the best possible experience on each platform and avoiding adding too much more code to maintain.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://mobileworld.appamundi.com/aggbug.aspx?PostID=451" width="1" height="1"&gt;</description><category domain="http://mobileworld.appamundi.com/blogs/peterfoot/archive/tags/Windows+Phone/default.aspx">Windows Phone</category></item><item><title>Tasks v1.19</title><link>http://mobileworld.appamundi.com/blogs/peterfoot/archive/2012/02/23/tasks-v1-19.aspx</link><pubDate>Wed, 22 Feb 2012 19:28:00 GMT</pubDate><guid isPermaLink="false">989b12f5-6f26-47d9-9f0d-67fe982b88db:450</guid><dc:creator>Peter Foot</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;The latest update to Tasks is now available in the Marketplace. This release continues the improvements to the sync experience by providing more resilience in situations where the network&amp;nbsp;drops out during a sync. It also improves the reminders feature in Windows 7.5 and improves the display of reminders for tasks with very long titles.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.windowsphone.com/en-GB/apps/55fcf880-6b03-e011-9264-00237de2db9e"&gt;http://www.windowsphone.com/en-GB/apps/55fcf880-6b03-e011-9264-00237de2db9e&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://mobileworld.appamundi.com/aggbug.aspx?PostID=450" width="1" height="1"&gt;</description><category domain="http://mobileworld.appamundi.com/blogs/peterfoot/archive/tags/Windows+Phone/default.aspx">Windows Phone</category></item><item><title>Follow Up from Windows Phone Camp Bristol</title><link>http://mobileworld.appamundi.com/blogs/peterfoot/archive/2012/02/12/follow-up-from-windows-phone-camp-bristol.aspx</link><pubDate>Sun, 12 Feb 2012 10:58:00 GMT</pubDate><guid isPermaLink="false">989b12f5-6f26-47d9-9f0d-67fe982b88db:447</guid><dc:creator>Peter Foot</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;A few of you who attended the Windows Phone Camp in Bristol asked about the slides and code from the Storing Data and Cloud/Networking session. I&amp;#39;ve uploaded the latest versions of these slides and the additional Sockets code project to the FTP site. All the links and resources mentioned during the day are on Pete&amp;#39;s blog post:-&lt;/p&gt;
&lt;p&gt;&lt;a href="http://mobileworld.appamundi.com/blogs/petevickers/archive/2011/11/13/links-and-resources-from-windows-phone-camps.aspx"&gt;http://mobileworld.appamundi.com/blogs/petevickers/archive/2011/11/13/links-and-resources-from-windows-phone-camps.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Happy Coding!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://mobileworld.appamundi.com/aggbug.aspx?PostID=447" width="1" height="1"&gt;</description><category domain="http://mobileworld.appamundi.com/blogs/peterfoot/archive/tags/Events/default.aspx">Events</category><category domain="http://mobileworld.appamundi.com/blogs/peterfoot/archive/tags/Windows+Phone/default.aspx">Windows Phone</category></item><item><title>How to Databind SelectedItems of the ListPicker and RecurringDaysPicker</title><link>http://mobileworld.appamundi.com/blogs/andywigley/archive/2012/02/02/how-to-databind-selecteditems-of-the-listpicker-and-recurringdayspicker.aspx</link><pubDate>Thu, 02 Feb 2012 14:41:41 GMT</pubDate><guid isPermaLink="false">989b12f5-6f26-47d9-9f0d-67fe982b88db:442</guid><dc:creator>Andy Wigley</dc:creator><slash:comments>3</slash:comments><description>&lt;p&gt;The &lt;strong&gt;ListPicker&lt;/strong&gt; control from the Silverlight Toolkit is one of those Swiss Army Knife controls – very versatile and really useful. It wasn’t quite versatile enough for me though, as one thing it does *not* do is support &lt;em&gt;setting&lt;/em&gt; the &lt;strong&gt;SelectedItems&lt;/strong&gt; property when you have the control configured for multiple selections, which is something I wanted to do, and something you will certainly need to do if you ever want to pre-select some items from the list or you want to databind the SelectedItems property to a property in a data object. In this post, I will show you how to extend the ListPicker so that you can set the SelectedItems property. I will also show you how to do the same thing with the &lt;strong&gt;RecurringDaysPicker&lt;/strong&gt; control from the Silverlight Toolkit, which it turns out, is just a ListPicker configured to allow selection from the days of the week.&lt;/p&gt;  &lt;h2&gt;ListPicker in Single Selection Mode&lt;/h2&gt;  &lt;p&gt;The ListPicker is a bit like a ComboBox, and to use it you set its &lt;strong&gt;ItemsSource&lt;/strong&gt; property to say, a &lt;font face="Courier New"&gt;List&amp;lt;string&amp;gt;&lt;/font&gt; or a list of complex objects and if your list has five or fewer items, when the user taps on it, the list expands in-situ, (as shown with the &lt;strong&gt;background&lt;/strong&gt; selector in the following picture), and if your list has more than five items (as with the &lt;strong&gt;accent color&lt;/strong&gt; selector in the picture), then the control expands to what is called ‘Full Mode’, in other words it shows a new screen (right hand screenshot below) with all the items on it and the user can select from the list. And all that user experience is built into the control and comes for free!&lt;/p&gt;  &lt;p&gt;&lt;a href="http://mobileworld.appamundi.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/andywigley/ListPickerBasic_5F00_569D865B.png"&gt;&lt;img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="ListPickerBasic" border="0" alt="ListPickerBasic" src="http://mobileworld.appamundi.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/andywigley/ListPickerBasic_5F00_thumb_5F00_4CF51825.png" width="644" height="359" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;In your code of course, you want to know which item the user selected, and the easy way to do this is to get the ListPicker’s &lt;strong&gt;SelectedItem&lt;/strong&gt; or &lt;strong&gt;SelectedIndex&lt;/strong&gt; property. More usually, you would use the SelectedIndex property particularly if you are using MVVM as it is easy to save the SelectedIndex when you serialize your viewmodel class and restore it when you deserialize the next time your user starts your app or the app returns from tombstoning. However, the SelectedIndex property is only useful when the ListPicker is in single selection mode, i.e. has its &lt;strong&gt;SelectionMode&lt;/strong&gt; property set to &lt;strong&gt;Single&lt;/strong&gt;, which is the default.&lt;/p&gt;  &lt;h2&gt;ListPicker in Multiple Selection Mode&lt;/h2&gt;  &lt;p&gt;The ListPicker also supports multiple selections from the user. To use it in this mode, you just set the &lt;strong&gt;SelectionMode&lt;/strong&gt; property to &lt;strong&gt;Multiple&lt;/strong&gt; and now when the user taps on the control, the full mode screen displays with checkboxes so the user can select more than one entry from the list. For example, the sample app for this post looks a bit like this, where the Football Teams control is a ListPicker in MultiSelect mode:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://mobileworld.appamundi.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/andywigley/ListPickerMulti1_5F00_180812E8.png"&gt;&lt;img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="ListPickerMulti1" border="0" alt="ListPickerMulti1" src="http://mobileworld.appamundi.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/andywigley/ListPickerMulti1_5F00_thumb_5F00_59DED269.png" width="268" height="484" /&gt;&lt;/a&gt;&lt;a href="http://mobileworld.appamundi.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/andywigley/ListPickerMulti2_5F00_483EC1D1.png"&gt;&lt;img style="background-image:none;border-right-width:0px;margin:0px 0px 0px 12px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="ListPickerMulti2" border="0" alt="ListPickerMulti2" src="http://mobileworld.appamundi.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/andywigley/ListPickerMulti2_5F00_thumb_5F00_7838ED85.png" width="264" height="484" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;It’s quite simple to program the ListPicker for this kind of usage. First of all, you need to define the templates to use for the list displays, one to be used if the ListPicker items is less than or equal to 5, and one to be used for the full page display whn the number of items is more than that. I’ve defined them in the PhoneApplicationPage.Resources on MainPage.xaml:&lt;/p&gt;  &lt;pre class="code"&gt;    &lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;phone&lt;/span&gt;&lt;span style="color:blue;"&gt;:&lt;/span&gt;&lt;span style="color:#a31515;"&gt;PhoneApplicationPage.Resources&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;DataTemplate &lt;/span&gt;&lt;span style="color:red;"&gt;x&lt;/span&gt;&lt;span style="color:blue;"&gt;:&lt;/span&gt;&lt;span style="color:red;"&gt;Name&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;PickerItemTemplate&amp;quot;&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;StackPanel &lt;/span&gt;&lt;span style="color:red;"&gt;Orientation&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;Horizontal&amp;quot;&amp;gt;
                &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;TextBlock &lt;/span&gt;&lt;span style="color:red;"&gt;Text&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Binding &lt;/span&gt;&lt;span style="color:red;"&gt;Name&lt;/span&gt;&lt;span style="color:blue;"&gt;}&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;Style&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color:#a31515;"&gt;StaticResource &lt;/span&gt;&lt;span style="color:red;"&gt;PhoneTextNormalStyle&lt;/span&gt;&lt;span style="color:blue;"&gt;}&amp;quot;/&amp;gt;
            &amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;StackPanel&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;
        &amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;DataTemplate&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;DataTemplate &lt;/span&gt;&lt;span style="color:red;"&gt;x&lt;/span&gt;&lt;span style="color:blue;"&gt;:&lt;/span&gt;&lt;span style="color:red;"&gt;Name&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;PickerFullModeItemTemplate&amp;quot;&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;StackPanel &lt;/span&gt;&lt;span style="color:red;"&gt;Orientation&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;Horizontal&amp;quot;&amp;gt;
                &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;TextBlock &lt;/span&gt;&lt;span style="color:red;"&gt;Text&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Binding &lt;/span&gt;&lt;span style="color:red;"&gt;Name&lt;/span&gt;&lt;span style="color:blue;"&gt;}&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;Style&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color:#a31515;"&gt;StaticResource &lt;/span&gt;&lt;span style="color:red;"&gt;PhoneTextNormalStyle&lt;/span&gt;&lt;span style="color:blue;"&gt;}&amp;quot;/&amp;gt;
                &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;TextBlock &lt;/span&gt;&lt;span style="color:red;"&gt;Text&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Binding &lt;/span&gt;&lt;span style="color:red;"&gt;League&lt;/span&gt;&lt;span style="color:blue;"&gt;}&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;Margin&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;12 0 0 0&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;Style&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color:#a31515;"&gt;StaticResource &lt;/span&gt;&lt;span style="color:red;"&gt;PhoneTextSubtleStyle&lt;/span&gt;&lt;span style="color:blue;"&gt;}&amp;quot;/&amp;gt;
            &amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;StackPanel&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;
        &amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;DataTemplate&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;phone&lt;/span&gt;&lt;span style="color:blue;"&gt;:&lt;/span&gt;&lt;span style="color:#a31515;"&gt;PhoneApplicationPage.Resources&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;
&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;And you then assign those templates where you declare the ListPicker control:&lt;/p&gt;

&lt;pre class="code"&gt;        &lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Grid &lt;/span&gt;&lt;span style="color:red;"&gt;x&lt;/span&gt;&lt;span style="color:blue;"&gt;:&lt;/span&gt;&lt;span style="color:red;"&gt;Name&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;ContentPanel&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;Grid.Row&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;1&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;Margin&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;12,0,12,0&amp;quot;&amp;gt;
&lt;span style="color:blue;"&gt;            &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;TextBlock &lt;/span&gt;&lt;span style="color:red;"&gt;Height&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;30&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;HorizontalAlignment&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;Left&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;Margin&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;12,73,0,0&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;Name&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;textBlock1&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;Text&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;Multiselect ListPicker:&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;Top&amp;quot; /&amp;gt; &lt;/span&gt;            &lt;br /&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;            &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;toolkit&lt;/span&gt;&lt;span style="color:blue;"&gt;:&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ListPicker &lt;/span&gt;&lt;span style="color:red;"&gt;Height&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;100&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;HorizontalAlignment&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;Left&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;Margin&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;9,109,0,0&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;x&lt;/span&gt;&lt;span style="color:blue;"&gt;:&lt;/span&gt;&lt;span style="color:red;"&gt;Name&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;listPicker1&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;Top&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;Width&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;441&amp;quot; 
                                &lt;/span&gt;&lt;span style="color:red;"&gt;SelectionMode&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;Multiple&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;ItemsSource&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Binding &lt;/span&gt;&lt;span style="color:red;"&gt;FootballTeams&lt;/span&gt;&lt;span style="color:blue;"&gt;}&amp;quot;
 &lt;/span&gt;&lt;span style="color:blue;"&gt;                               &lt;/span&gt;&lt;span style="color:red;"&gt;Header&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;Football Teams&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;FullModeHeader&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;Football Teams&amp;quot; 
                                &lt;/span&gt;&lt;strong&gt;&lt;span style="color:red;"&gt;ItemTemplate&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color:#a31515;"&gt;StaticResource &lt;/span&gt;&lt;span style="color:red;"&gt;PickerItemTemplate&lt;/span&gt;&lt;span style="color:blue;"&gt;}&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;FullModeItemTemplate&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color:#a31515;"&gt;StaticResource &lt;/span&gt;&lt;span style="color:red;"&gt;PickerFullModeItemTemplate&lt;/span&gt;&lt;/strong&gt;&lt;span style="color:blue;"&gt;&lt;strong&gt;}&lt;/strong&gt;&amp;quot;/&amp;gt;
&lt;/span&gt;&lt;span style="color:blue;"&gt;            &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;toolkit&lt;/span&gt;&lt;span style="color:blue;"&gt;:&lt;/span&gt;&lt;span style="color:#a31515;"&gt;RecurringDaysPicker &lt;/span&gt;&lt;span style="color:red;"&gt;x&lt;/span&gt;&lt;span style="color:blue;"&gt;:&lt;/span&gt;&lt;span style="color:red;"&gt;Name&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;recurringDaysPicker1&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;Margin&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;198,259,0,0&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;HorizontalAlignment&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;Left&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;Top&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;Width&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;212&amp;quot;&lt;/span&gt;&lt;span style="color:blue;"&gt;/&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;TextBlock &lt;/span&gt;&lt;span style="color:red;"&gt;Height&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;41&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;HorizontalAlignment&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;Left&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;Margin&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;12,275,0,0&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;Name&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;textBlock2&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;Text&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;Recurring Days:&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;Top&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;Width&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;166&amp;quot; /&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button &lt;/span&gt;&lt;span style="color:red;"&gt;Content&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;Set ViewModel Props&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;Height&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;93&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;HorizontalAlignment&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;Left&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;Margin&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;71,433,0,0&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;Name&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;button1&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;Top&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;Width&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;306&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;Click&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;button1_Click&amp;quot; /&amp;gt;
        &amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Grid&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;You’ll notice that the templates contain &lt;strong&gt;TextBlock&lt;/strong&gt; controls that are databound to fields &lt;strong&gt;Name&lt;/strong&gt; and &lt;strong&gt;League&lt;/strong&gt;, and the &lt;strong&gt;ItemsSource&lt;/strong&gt; for the ListPicker is bound to something called &lt;strong&gt;FootballTeams&lt;/strong&gt;. FootballTeams is a property of type &lt;strong&gt;List&amp;lt;FootballTeam&amp;gt;&lt;/strong&gt; on my &lt;strong&gt;MainViewModel&lt;/strong&gt; class:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color:blue;"&gt;using &lt;/span&gt;System.Collections.Generic;
&lt;span style="color:blue;"&gt;using &lt;/span&gt;System.ComponentModel;
&lt;span style="color:blue;"&gt;using &lt;/span&gt;System.Collections.ObjectModel;

&lt;span style="color:blue;"&gt;namespace &lt;/span&gt;SelectedItemsDataBindSample
{
    &lt;span style="color:blue;"&gt;public class &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;MainViewModel &lt;/span&gt;: &lt;span style="color:#2b91af;"&gt;INotifyPropertyChanged
    &lt;/span&gt;{
        &lt;span style="color:blue;"&gt;public const string &lt;/span&gt;FootballTeamsPropertyName = &lt;span style="color:#a31515;"&gt;&amp;quot;FootballTeams&amp;quot;&lt;/span&gt;;
        &lt;span style="color:blue;"&gt;private &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af;"&gt;FootballTeam&lt;/span&gt;&amp;gt; _footballTeams = &lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af;"&gt;FootballTeam&lt;/span&gt;&amp;gt;();

        &lt;span style="color:blue;"&gt;public &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af;"&gt;FootballTeam&lt;/span&gt;&amp;gt; FootballTeams
        {
            &lt;span style="color:blue;"&gt;get
            &lt;/span&gt;{
                &lt;span style="color:blue;"&gt;return &lt;/span&gt;_footballTeams;
            }
            &lt;span style="color:blue;"&gt;set
            &lt;/span&gt;{
                &lt;span style="color:blue;"&gt;if &lt;/span&gt;(_footballTeams == &lt;span style="color:blue;"&gt;value&lt;/span&gt;)
                {
                    &lt;span style="color:blue;"&gt;return&lt;/span&gt;;
                }

                _footballTeams = &lt;span style="color:blue;"&gt;value&lt;/span&gt;;
                RaisePropertyChanged(SelectedTeamsPropertyName);
            }
        }

        &lt;span style="color:blue;"&gt;public &lt;/span&gt;MainViewModel()
        {
        }

        &lt;span style="color:blue;"&gt;public event &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;PropertyChangedEventHandler &lt;/span&gt;PropertyChanged;

        &lt;span style="color:blue;"&gt;private void &lt;/span&gt;RaisePropertyChanged(&lt;span style="color:blue;"&gt;string &lt;/span&gt;propertyName)
        {
            &lt;span style="color:blue;"&gt;if &lt;/span&gt;(PropertyChanged != &lt;span style="color:blue;"&gt;null&lt;/span&gt;)
            {
                PropertyChanged(&lt;span style="color:blue;"&gt;this&lt;/span&gt;, &lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;PropertyChangedEventArgs&lt;/span&gt;(propertyName));
            }
        }
    }
}&lt;/pre&gt;

&lt;p&gt;The &lt;strong&gt;FootballTeam&lt;/strong&gt; class looks like this:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color:blue;"&gt;public class &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;FootballTeam
&lt;/span&gt;{
    &lt;span style="color:blue;"&gt;public string &lt;/span&gt;Name { &lt;span style="color:blue;"&gt;get&lt;/span&gt;; &lt;span style="color:blue;"&gt;set&lt;/span&gt;; }
    &lt;span style="color:blue;"&gt;public string &lt;/span&gt;League { &lt;span style="color:blue;"&gt;get&lt;/span&gt;; &lt;span style="color:blue;"&gt;set&lt;/span&gt;; }

    &lt;span style="color:blue;"&gt;public &lt;/span&gt;FootballTeam()
    {  }

    &lt;span style="color:blue;"&gt;public &lt;/span&gt;FootballTeam(&lt;span style="color:blue;"&gt;string &lt;/span&gt;name, &lt;span style="color:blue;"&gt;string &lt;/span&gt;league)
    {
        Name = name;
        League = league;
    }
}&lt;br /&gt;&lt;/pre&gt;

&lt;p&gt;The sample app creates an instance of &lt;strong&gt;MainViewModel&lt;/strong&gt; in my App.Xaml.cs, and exposes it via a property called ViewModel:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color:blue;"&gt;public partial class &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;App &lt;/span&gt;: &lt;span style="color:#2b91af;"&gt;Application
&lt;/span&gt;{
    &lt;span style="color:blue;"&gt;private static &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;MainViewModel &lt;/span&gt;viewModel = &lt;span style="color:blue;"&gt;null&lt;/span&gt;;

    &lt;span style="color:gray;"&gt;/// &amp;lt;summary&amp;gt;
    /// &lt;/span&gt;&lt;span style="color:green;"&gt;A static ViewModel used by the views to bind against.
    &lt;/span&gt;&lt;span style="color:gray;"&gt;/// &amp;lt;/summary&amp;gt;
    /// &amp;lt;returns&amp;gt;&lt;/span&gt;&lt;span style="color:green;"&gt;The MainViewModel object.&lt;/span&gt;&lt;span style="color:gray;"&gt;&amp;lt;/returns&amp;gt;
    &lt;/span&gt;&lt;span style="color:blue;"&gt;public static &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;MainViewModel &lt;/span&gt;ViewModel
    {
        &lt;span style="color:blue;"&gt;get
        &lt;/span&gt;{
            &lt;span style="color:green;"&gt;// Delay creation of the view model until necessary
            &lt;/span&gt;&lt;span style="color:blue;"&gt;if &lt;/span&gt;(viewModel == &lt;span style="color:blue;"&gt;null&lt;/span&gt;)
            {
                viewModel = &lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;MainViewModel&lt;/span&gt;();
                viewModel.FootballTeams = &lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af;"&gt;FootballTeam&lt;/span&gt;&amp;gt;()
                                            {
                                                &lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;FootballTeam&lt;/span&gt;(&lt;span style="color:#a31515;"&gt;&amp;quot;Leeds&amp;quot;&lt;/span&gt;, &lt;span style="color:#a31515;"&gt;&amp;quot;Championship&amp;quot;&lt;/span&gt;),
                                                &lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;FootballTeam&lt;/span&gt;(&lt;span style="color:#a31515;"&gt;&amp;quot;Man U&amp;quot;&lt;/span&gt;, &lt;span style="color:#a31515;"&gt;&amp;quot;Premiership&amp;quot;&lt;/span&gt;),
                                                &lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;FootballTeam&lt;/span&gt;(&lt;span style="color:#a31515;"&gt;&amp;quot;Man C&amp;quot;&lt;/span&gt;, &lt;span style="color:#a31515;"&gt;&amp;quot;Premiership&amp;quot;&lt;/span&gt;),
                                                &lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;FootballTeam&lt;/span&gt;(&lt;span style="color:#a31515;"&gt;&amp;quot;Chelsea&amp;quot;&lt;/span&gt;, &lt;span style="color:#a31515;"&gt;&amp;quot;Premiership&amp;quot;&lt;/span&gt;),
                                                &lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;FootballTeam&lt;/span&gt;(&lt;span style="color:#a31515;"&gt;&amp;quot;Liverpool&amp;quot;&lt;/span&gt;, &lt;span style="color:#a31515;"&gt;&amp;quot;Premiership&amp;quot;&lt;/span&gt;),
                                                &lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;FootballTeam&lt;/span&gt;(&lt;span style="color:#a31515;"&gt;&amp;quot;Spurs&amp;quot;&lt;/span&gt;, &lt;span style="color:#a31515;"&gt;&amp;quot;Premiership&amp;quot;&lt;/span&gt;),
                                            };
            }

            &lt;span style="color:blue;"&gt;return &lt;/span&gt;viewModel;
        }
    }
}    &lt;/pre&gt;

&lt;p&gt;and the final piece of the jigsaw is to set this instance of &lt;strong&gt;MainViewModel&lt;/strong&gt; to be the &lt;strong&gt;DataContext&lt;/strong&gt; for MainPage.xaml. Notice also that I have set the &lt;strong&gt;SummaryForSelectedItemsDelegate&lt;/strong&gt; property to a method I have written called &lt;strong&gt;SummarizeTeams.&lt;/strong&gt; This is how you provide the ‘summary text’ representation of the users’ selections which is displayed on the MainPage, on the ‘normal’ rendering of the ListPicker before the user interacts with it, by providing a method like this that takes an &lt;strong&gt;IList&lt;/strong&gt; parameter and returns a string:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color:blue;"&gt;public partial class &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;MainPage &lt;/span&gt;: &lt;span style="color:#2b91af;"&gt;PhoneApplicationPage
&lt;/span&gt;{
    &lt;span style="color:green;"&gt;// Constructor
    &lt;/span&gt;&lt;span style="color:blue;"&gt;public &lt;/span&gt;MainPage()
    {
        InitializeComponent();
        &lt;span style="color:blue;"&gt;this&lt;/span&gt;.DataContext = &lt;span style="color:#2b91af;"&gt;App&lt;/span&gt;.ViewModel;

        &lt;span style="color:blue;"&gt;this&lt;/span&gt;.listPicker1.SummaryForSelectedItemsDelegate = SummarizeTeams;
    }

    &lt;span style="color:blue;"&gt;protected string &lt;/span&gt;SummarizeTeams(&lt;span style="color:#2b91af;"&gt;IList &lt;/span&gt;selection)
    {
        &lt;span style="color:blue;"&gt;string &lt;/span&gt;str = &lt;span style="color:#a31515;"&gt;&amp;quot;*None Selected*&amp;quot;&lt;/span&gt;;

        &lt;span style="color:blue;"&gt;if &lt;/span&gt;(&lt;span style="color:blue;"&gt;null &lt;/span&gt;!= selection &amp;amp;&amp;amp; selection.Count &amp;gt; 0)
        {
            &lt;span style="color:#2b91af;"&gt;StringBuilder &lt;/span&gt;contents = &lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;StringBuilder&lt;/span&gt;();
            &lt;span style="color:blue;"&gt;int &lt;/span&gt;idx = 0;
            &lt;span style="color:blue;"&gt;foreach &lt;/span&gt;(&lt;span style="color:blue;"&gt;object &lt;/span&gt;o &lt;span style="color:blue;"&gt;in &lt;/span&gt;selection)
            {
                &lt;span style="color:blue;"&gt;if &lt;/span&gt;(idx &amp;gt; 0) contents.Append(&lt;span style="color:#a31515;"&gt;&amp;quot;, &amp;quot;&lt;/span&gt;);
                contents.Append(((&lt;span style="color:#2b91af;"&gt;FootballTeam&lt;/span&gt;)o).Name);
                idx++;
            }
            str = contents.ToString();
        }

        &lt;span style="color:blue;"&gt;return &lt;/span&gt;str;
    }
}
 &lt;/pre&gt;

&lt;h2&gt;Getting – and Setting – the SelectedItems&lt;/h2&gt;

&lt;p&gt;After a user has selected items from the ListPicker, you can easily find out what the selected items are by hooking the SelectionChanged event and in the event handler, enumerate the SelectedItems collection. For example:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color:blue;"&gt;private void &lt;/span&gt;listPicker1_SelectionChanged(&lt;span style="color:blue;"&gt;object &lt;/span&gt;sender, System.Windows.Controls.&lt;span style="color:#2b91af;"&gt;SelectionChangedEventArgs &lt;/span&gt;e)
{
    &lt;span style="color:#2b91af;"&gt;StringBuilder &lt;/span&gt;msg = &lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;StringBuilder&lt;/span&gt;();
    msg.Append(&lt;span style="color:#a31515;"&gt;&amp;quot;Selected Teams:&amp;quot;&lt;/span&gt;);

    &lt;span style="color:blue;"&gt;if &lt;/span&gt;(listPicker1.SelectedItems != &lt;span style="color:blue;"&gt;null&lt;/span&gt;)
    {
        &lt;span style="color:blue;"&gt;foreach &lt;/span&gt;(&lt;span style="color:blue;"&gt;var &lt;/span&gt;item &lt;span style="color:blue;"&gt;in &lt;/span&gt;listPicker1.SelectedItems)
        {
            &lt;span style="color:blue;"&gt;var &lt;/span&gt;team = item &lt;span style="color:blue;"&gt;as &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;FootballTeam&lt;/span&gt;;
            msg.Append(&lt;span style="color:#a31515;"&gt;&amp;quot; &amp;quot; &lt;/span&gt;+ team.Name);
        }
    }

    System.Diagnostics.&lt;span style="color:#2b91af;"&gt;Debug&lt;/span&gt;.WriteLine(msg.ToString());
}&lt;br /&gt;&lt;/pre&gt;

&lt;h2&gt;Extending the ListPicker to Support Setting of SelectedItems&lt;/h2&gt;

&lt;p&gt;Using the standard control, there’s no way to programmatically set the SelectedItems, either by setting the SelectedItems property directly, or by exposing a collection of selected objects through a property of a ViewModel class and using databinding. This is because the SelectedItems property is a read-only property, as revealed if you browse the control class in the Object Browser:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://mobileworld.appamundi.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/andywigley/ListPickerObjectBrowser_5F00_787570BA.png"&gt;&lt;img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="ListPickerObjectBrowser" border="0" alt="ListPickerObjectBrowser" src="http://mobileworld.appamundi.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/andywigley/ListPickerObjectBrowser_5F00_thumb_5F00_12D563D2.png" width="468" height="324" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So if you want to &lt;strong&gt;&lt;em&gt;set&lt;/em&gt;&lt;/strong&gt; the &lt;strong&gt;SelectedItems&lt;/strong&gt;, we must change the implementation of this property and add a setter to it as well.&lt;/p&gt;

&lt;p&gt;There are two ways to do this:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Download the source for the silverlight toolkit from &lt;a href="http://silverlight.codeplex.com"&gt;http://silverlight.codeplex.com&lt;/a&gt; and modify it yourself so you run with a customised version &lt;/li&gt;

  &lt;li&gt;Create your own custom control that inherits from ListPicker and implement the altered SelectedItems property in there. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I prefer option 2, as it turns out the code you need to write is pretty simple, and it’s a simpler solution – you can just add your reference to the Silverlight Toolkit assembly through NuGet or directly, and then inherit from the standard ListPicker in your custom control.&lt;/p&gt;

&lt;p&gt;The code you need to add a setter to the SelectedItems property looks like this:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color:blue;"&gt;using &lt;/span&gt;Microsoft.Phone.Controls;
&lt;span style="color:blue;"&gt;using &lt;/span&gt;System.Collections;

&lt;span style="color:blue;"&gt;namespace &lt;/span&gt;SelectedItemsDataBindSample
{
    &lt;span style="color:blue;"&gt;public class &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;ListPickerEx &lt;/span&gt;: &lt;span style="color:#2b91af;"&gt;ListPicker
    &lt;/span&gt;{
        &lt;span style="color:gray;"&gt;/// &amp;lt;summary&amp;gt;
        /// &lt;/span&gt;&lt;span style="color:green;"&gt;Gets or sets the selected items.
        &lt;/span&gt;&lt;span style="color:gray;"&gt;/// &amp;lt;/summary&amp;gt;
        &lt;/span&gt;&lt;span style="color:blue;"&gt;public new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;IList &lt;/span&gt;SelectedItems
        {
            &lt;span style="color:blue;"&gt;get
            &lt;/span&gt;{
                &lt;span style="color:blue;"&gt;return &lt;/span&gt;(&lt;span style="color:#2b91af;"&gt;IList&lt;/span&gt;)GetValue(SelectedItemsProperty);
            }
            &lt;span style="color:blue;"&gt;set
            &lt;/span&gt;{
                &lt;span style="color:blue;"&gt;base&lt;/span&gt;.SetValue(SelectedItemsProperty, &lt;span style="color:blue;"&gt;value&lt;/span&gt;);
            }
        }
    }
}&lt;/pre&gt;

&lt;p&gt;That’s it! You can do the same for the RecurringDaysPicker with identical code, and this is demonstrated as well in the sample code for this post.&lt;/p&gt;

&lt;p&gt;To use your custom control, first declare the namespace for your custom controls in the Xaml at the top of your page (in this example, these controls are just in the SelectedItemsDataBindSample namespace, in the project assembly):&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;phone&lt;/span&gt;&lt;span style="color:blue;"&gt;:&lt;/span&gt;&lt;span style="color:#a31515;"&gt;PhoneApplicationPage 
    &lt;/span&gt;&lt;span style="color:red;"&gt;x&lt;/span&gt;&lt;span style="color:blue;"&gt;:&lt;/span&gt;&lt;span style="color:red;"&gt;Class&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;SelectedItemsDataBindSample.MainPage&amp;quot;
    &lt;/span&gt;&lt;span style="color:red;"&gt;xmlns&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&amp;quot;
    &lt;/span&gt;&lt;span style="color:red;"&gt;xmlns&lt;/span&gt;&lt;span style="color:blue;"&gt;:&lt;/span&gt;&lt;span style="color:red;"&gt;x&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml&amp;quot;
    &lt;/span&gt;&lt;span style="color:red;"&gt;xmlns&lt;/span&gt;&lt;span style="color:blue;"&gt;:&lt;/span&gt;&lt;span style="color:red;"&gt;phone&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone&amp;quot;
    &lt;/span&gt;&lt;span style="color:red;"&gt;xmlns&lt;/span&gt;&lt;span style="color:blue;"&gt;:&lt;/span&gt;&lt;span style="color:red;"&gt;shell&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone&amp;quot;
    &lt;/span&gt;&lt;span style="color:red;"&gt;xmlns&lt;/span&gt;&lt;span style="color:blue;"&gt;:&lt;/span&gt;&lt;span style="color:red;"&gt;d&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;http://schemas.microsoft.com/expression/blend/2008&amp;quot;
    &lt;/span&gt;&lt;span style="color:red;"&gt;xmlns&lt;/span&gt;&lt;span style="color:blue;"&gt;:&lt;/span&gt;&lt;span style="color:red;"&gt;mc&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;http://schemas.openxmlformats.org/markup-compatibility/2006&amp;quot;
    &lt;/span&gt;&lt;span style="color:red;"&gt;xmlns&lt;/span&gt;&lt;span style="color:blue;"&gt;:&lt;/span&gt;&lt;span style="color:red;"&gt;toolkit&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit&amp;quot;
    &lt;/span&gt;&lt;strong&gt;&lt;span style="color:red;"&gt;xmlns&lt;/span&gt;&lt;span style="color:blue;"&gt;:&lt;/span&gt;&lt;span style="color:red;"&gt;local&lt;/span&gt;&lt;/strong&gt;&lt;span style="color:blue;"&gt;&lt;strong&gt;=&amp;quot;clr-namespace:SelectedItemsDataBindSample&amp;quot;&lt;/strong&gt;
    &lt;/span&gt;&lt;span style="color:red;"&gt;mc&lt;/span&gt;&lt;span style="color:blue;"&gt;:&lt;/span&gt;&lt;span style="color:red;"&gt;Ignorable&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;d&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;d&lt;/span&gt;&lt;span style="color:blue;"&gt;:&lt;/span&gt;&lt;span style="color:red;"&gt;DesignWidth&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;480&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;d&lt;/span&gt;&lt;span style="color:blue;"&gt;:&lt;/span&gt;&lt;span style="color:red;"&gt;DesignHeight&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;768&amp;quot;
    &lt;/span&gt;&lt;span style="color:red;"&gt;FontFamily&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color:#a31515;"&gt;StaticResource &lt;/span&gt;&lt;span style="color:red;"&gt;PhoneFontFamilyNormal&lt;/span&gt;&lt;span style="color:blue;"&gt;}&amp;quot;
    &lt;/span&gt;&lt;span style="color:red;"&gt;FontSize&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color:#a31515;"&gt;StaticResource &lt;/span&gt;&lt;span style="color:red;"&gt;PhoneFontSizeNormal&lt;/span&gt;&lt;span style="color:blue;"&gt;}&amp;quot;
    &lt;/span&gt;&lt;span style="color:red;"&gt;Foreground&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color:#a31515;"&gt;StaticResource &lt;/span&gt;&lt;span style="color:red;"&gt;PhoneForegroundBrush&lt;/span&gt;&lt;span style="color:blue;"&gt;}&amp;quot;
    &lt;/span&gt;&lt;span style="color:red;"&gt;SupportedOrientations&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;Portrait&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;Orientation&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;Portrait&amp;quot;
    &lt;/span&gt;&lt;span style="color:red;"&gt;shell&lt;/span&gt;&lt;span style="color:blue;"&gt;:&lt;/span&gt;&lt;span style="color:red;"&gt;SystemTray.IsVisible&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;True&amp;quot; 
    &amp;gt;
&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;and where you declare the ListPicker, simply substitute local:ListPickerEx for toolkit:ListPicker:&lt;/p&gt;

&lt;pre class="code"&gt;        &lt;span style="color:green;"&gt;&amp;lt;!--ContentPanel - place additional content here--&amp;gt;
        &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Grid &lt;/span&gt;&lt;span style="color:red;"&gt;x&lt;/span&gt;&lt;span style="color:blue;"&gt;:&lt;/span&gt;&lt;span style="color:red;"&gt;Name&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;ContentPanel&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;Grid.Row&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;1&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;Margin&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;12,0,12,0&amp;quot;&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;strong&gt;&lt;span style="color:#a31515;"&gt;local&lt;/span&gt;&lt;span style="color:blue;"&gt;:&lt;/span&gt;&lt;/strong&gt;&lt;span style="color:#a31515;"&gt;&lt;strong&gt;ListPickerEx&lt;/strong&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;Height&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;100&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;HorizontalAlignment&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;Left&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;Margin&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;9,109,0,0&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;x&lt;/span&gt;&lt;span style="color:blue;"&gt;:&lt;/span&gt;&lt;span style="color:red;"&gt;Name&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;listPicker1&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;Top&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;Width&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;441&amp;quot; 
                                &lt;/span&gt;&lt;span style="color:red;"&gt;SelectionMode&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;Multiple&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;ItemsSource&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Binding &lt;/span&gt;&lt;span style="color:red;"&gt;FootballTeams&lt;/span&gt;&lt;span style="color:blue;"&gt;}&amp;quot;
                                &lt;/span&gt;&lt;span style="color:red;"&gt;SelectedItems&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Binding &lt;/span&gt;&lt;span style="color:red;"&gt;SelectedTeams&lt;/span&gt;&lt;span style="color:blue;"&gt;, &lt;/span&gt;&lt;span style="color:red;"&gt;Mode&lt;/span&gt;&lt;span style="color:blue;"&gt;=TwoWay}&amp;quot;
                                &lt;/span&gt;&lt;span style="color:red;"&gt;SelectionChanged&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;listPicker1_SelectionChanged&amp;quot;
                                &lt;/span&gt;&lt;span style="color:red;"&gt;Header&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;Football Teams&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;FullModeHeader&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;Football Teams&amp;quot; 
                                &lt;/span&gt;&lt;span style="color:red;"&gt;ItemTemplate&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color:#a31515;"&gt;StaticResource &lt;/span&gt;&lt;span style="color:red;"&gt;PickerItemTemplate&lt;/span&gt;&lt;span style="color:blue;"&gt;}&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;FullModeItemTemplate&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color:#a31515;"&gt;StaticResource &lt;/span&gt;&lt;span style="color:red;"&gt;PickerFullModeItemTemplate&lt;/span&gt;&lt;span style="color:blue;"&gt;}&amp;quot;/&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;TextBlock &lt;/span&gt;&lt;span style="color:red;"&gt;Height&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;30&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;HorizontalAlignment&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;Left&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;Margin&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;12,73,0,0&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;Name&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;textBlock1&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;Text&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;Multiselect ListPicker:&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;Top&amp;quot; /&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;strong&gt;&lt;span style="color:#a31515;"&gt;local&lt;/span&gt;&lt;span style="color:blue;"&gt;:&lt;/span&gt;&lt;/strong&gt;&lt;span style="color:#a31515;"&gt;&lt;strong&gt;RecurringDaysPickerEx&lt;/strong&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;x&lt;/span&gt;&lt;span style="color:blue;"&gt;:&lt;/span&gt;&lt;span style="color:red;"&gt;Name&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;recurringDaysPicker1&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;Margin&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;198,259,0,0&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;HorizontalAlignment&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;Left&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;Top&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;Width&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;212&amp;quot; 
                                         &lt;/span&gt;&lt;span style="color:red;"&gt;SelectedItems&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Binding &lt;/span&gt;&lt;span style="color:red;"&gt;SelectedDays&lt;/span&gt;&lt;span style="color:blue;"&gt;, &lt;/span&gt;&lt;span style="color:red;"&gt;Mode&lt;/span&gt;&lt;span style="color:blue;"&gt;=TwoWay}&amp;quot; /&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;TextBlock &lt;/span&gt;&lt;span style="color:red;"&gt;Height&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;41&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;HorizontalAlignment&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;Left&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;Margin&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;12,275,0,0&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;Name&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;textBlock2&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;Text&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;Recurring Days:&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;Top&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;Width&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;166&amp;quot; /&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button &lt;/span&gt;&lt;span style="color:red;"&gt;Content&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;Set ViewModel Props&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;Height&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;93&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;HorizontalAlignment&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;Left&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;Margin&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;71,433,0,0&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;Name&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;button1&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;Top&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;Width&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;306&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;Click&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;button1_Click&amp;quot; /&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button &lt;/span&gt;&lt;span style="color:red;"&gt;Content&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;Set SelectedItems&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;Height&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;93&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;HorizontalAlignment&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;Left&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;Margin&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;71,514,0,0&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;Name&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;button2&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;Top&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;Width&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;306&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;Click&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;button2_Click&amp;quot; /&amp;gt;
        &amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Grid&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;
&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;Now you could have code similar to the following to programmatically set the SelectedItems:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color:green;"&gt;// Get the full collection of items:
&lt;/span&gt;&lt;span style="color:#2b91af;"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af;"&gt;FootballTeam&lt;/span&gt;&amp;gt; allItems = listPicker1.ItemsSource &lt;span style="color:blue;"&gt;as &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af;"&gt;FootballTeam&lt;/span&gt;&amp;gt;;

&lt;span style="color:green;"&gt;// Set the SelectedItems to the 5th and 6th teams
&lt;/span&gt;listPicker1.SelectedItems = &lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;ObservableCollection&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af;"&gt;object&lt;/span&gt;&amp;gt;() { allItems[4], allItems[5] };
 &lt;/pre&gt;

&lt;p&gt;The key thing to remember here is that the collection of items you set the SelectedItems property to must be a collection containing zero, 1 or more of the exact same objects that are in the main list of items that you supplied for the ItemsSource. The only qualification here is that if your data objects are just simple strings, as is the case with a RecurringDaysPicker for example, then you can just supply a collection of strings for SelectedItems as well – as long as the supplied strings exist in the ItemsSource as well of course.&lt;/p&gt;

&lt;h2&gt;Using Two-Way DataBinding with SelectedItems&lt;/h2&gt;

&lt;p&gt;You can also databind the SelectedItems property to a property in a View Model class. The trick here is to declare the property in your view model as type &lt;font size="2" face="Lucida Console"&gt;ObservableCollection&amp;lt;object&amp;gt;&lt;/font&gt;. In my&amp;#160; sample code for this post, I started out by doing the obvious thing of defining a property of type &lt;font size="2" face="Lucida Console"&gt;ObservableCollection&amp;lt;FootballTeam&amp;gt;&lt;/font&gt;, but it turns out that doesn’t work. Internally the control expresses its list of selected items as an &lt;font size="2" face="Lucida Console"&gt;ObservableCollection&amp;lt;object&amp;gt;&lt;/font&gt; so when you declare two-way data binding and the control tries to set the bound property in the View Model, it doesn’t know how to convert between an &lt;font size="2" face="Lucida Console"&gt;ObservableCollection&amp;lt;object&amp;gt;&lt;/font&gt; and an &lt;font size="2" face="Lucida Console"&gt;ObservableCollection&amp;lt;FootballTeam&amp;gt;&lt;/font&gt; – so just declare the bindable property in your ViewModel as &lt;font size="2" face="Lucida Console"&gt;ObservableCollection&amp;lt;object&amp;gt;&lt;/font&gt; and everything works fine.&lt;/p&gt;

&lt;p&gt;In the FootballTeam sample, the ViewModel class now has a new public property called &lt;strong&gt;SelectedTeams&lt;/strong&gt;:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color:blue;"&gt;public class &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;MainViewModel &lt;/span&gt;: &lt;span style="color:#2b91af;"&gt;INotifyPropertyChanged
&lt;/span&gt;{
    &lt;span style="color:blue;"&gt;...&lt;/span&gt;&lt;/pre&gt;

&lt;pre class="code"&gt;&lt;span style="color:blue;"&gt;&lt;/span&gt;
    &lt;span style="color:gray;"&gt;/// &amp;lt;summary&amp;gt;
    /// &lt;/span&gt;&lt;span style="color:green;"&gt;The &lt;/span&gt;&lt;span style="color:gray;"&gt;&amp;lt;see cref=&amp;quot;SelectedDays&amp;quot; /&amp;gt; &lt;/span&gt;&lt;span style="color:green;"&gt;property&amp;#39;s name.
    &lt;/span&gt;&lt;span style="color:gray;"&gt;/// &amp;lt;/summary&amp;gt;
    &lt;/span&gt;&lt;span style="color:blue;"&gt;public const string &lt;/span&gt;SelectedTeamsPropertyName = &lt;span style="color:#a31515;"&gt;&amp;quot;SelectedTeams&amp;quot;&lt;/span&gt;;

    &lt;span style="color:blue;"&gt;private &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;ObservableCollection&lt;/span&gt;&amp;lt;&lt;span style="color:blue;"&gt;object&lt;/span&gt;&amp;gt; _mySelectedTeams = &lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;ObservableCollection&lt;/span&gt;&amp;lt;&lt;span style="color:blue;"&gt;object&lt;/span&gt;&amp;gt;();

    &lt;span style="color:gray;"&gt;/// &amp;lt;summary&amp;gt;
    /// &lt;/span&gt;&lt;span style="color:green;"&gt;Sets and gets the SelectedTeams property.
    &lt;/span&gt;&lt;span style="color:gray;"&gt;/// &lt;/span&gt;&lt;span style="color:green;"&gt;Changes to that property&amp;#39;s value raise the PropertyChanged event. 
    &lt;/span&gt;&lt;span style="color:gray;"&gt;/// &amp;lt;/summary&amp;gt;
    &lt;/span&gt;&lt;span style="color:blue;"&gt;public &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;ObservableCollection&lt;/span&gt;&amp;lt;&lt;span style="color:blue;"&gt;object&lt;/span&gt;&amp;gt; SelectedTeams
    {
        &lt;span style="color:blue;"&gt;get
        &lt;/span&gt;{
            &lt;span style="color:blue;"&gt;return &lt;/span&gt;_mySelectedTeams;
        }
        &lt;span style="color:blue;"&gt;set
        &lt;/span&gt;{
            &lt;span style="color:blue;"&gt;if &lt;/span&gt;(_mySelectedTeams == &lt;span style="color:blue;"&gt;value&lt;/span&gt;)
            {
                &lt;span style="color:blue;"&gt;return&lt;/span&gt;;
            }

            _mySelectedTeams = &lt;span style="color:blue;"&gt;value&lt;/span&gt;;
            RaisePropertyChanged(SelectedTeamsPropertyName);
        }
    }
    
    ...&lt;/pre&gt;

&lt;pre class="code"&gt;}&lt;/pre&gt;

&lt;p&gt;And in the MainPage.xaml, the &lt;strong&gt;SelectedItems&lt;/strong&gt; property is databound to the new property:&lt;/p&gt;

&lt;pre class="code"&gt;        &lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Grid &lt;/span&gt;&lt;span style="color:red;"&gt;x&lt;/span&gt;&lt;span style="color:blue;"&gt;:&lt;/span&gt;&lt;span style="color:red;"&gt;Name&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;ContentPanel&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;Grid.Row&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;1&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;Margin&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;12,0,12,0&amp;quot;&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;local&lt;/span&gt;&lt;span style="color:blue;"&gt;:&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ListPickerEx &lt;/span&gt;&lt;span style="color:red;"&gt;Height&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;100&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;HorizontalAlignment&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;Left&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;Margin&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;9,109,0,0&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;x&lt;/span&gt;&lt;span style="color:blue;"&gt;:&lt;/span&gt;&lt;span style="color:red;"&gt;Name&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;listPicker1&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;Top&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;Width&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;441&amp;quot; 
                                &lt;/span&gt;&lt;span style="color:red;"&gt;SelectionMode&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;Multiple&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;ItemsSource&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Binding &lt;/span&gt;&lt;span style="color:red;"&gt;FootballTeams&lt;/span&gt;&lt;span style="color:blue;"&gt;}&amp;quot;
                                &lt;/span&gt;&lt;strong&gt;&lt;span style="color:red;"&gt;SelectedItems&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Binding &lt;/span&gt;&lt;span style="color:red;"&gt;SelectedTeams&lt;/span&gt;&lt;span style="color:blue;"&gt;, &lt;/span&gt;&lt;span style="color:red;"&gt;Mode&lt;/span&gt;&lt;/strong&gt;&lt;span style="color:blue;"&gt;&lt;strong&gt;=TwoWay}&amp;quot;&lt;/strong&gt;
                                &lt;/span&gt;&lt;span style="color:red;"&gt;SelectionChanged&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;listPicker1_SelectionChanged&amp;quot;
                                &lt;/span&gt;&lt;span style="color:red;"&gt;Header&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;Football Teams&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;FullModeHeader&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;Football Teams&amp;quot; 
                                &lt;/span&gt;&lt;span style="color:red;"&gt;ItemTemplate&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color:#a31515;"&gt;StaticResource &lt;/span&gt;&lt;span style="color:red;"&gt;PickerItemTemplate&lt;/span&gt;&lt;span style="color:blue;"&gt;}&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;FullModeItemTemplate&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color:#a31515;"&gt;StaticResource &lt;/span&gt;&lt;span style="color:red;"&gt;PickerFullModeItemTemplate&lt;/span&gt;&lt;span style="color:blue;"&gt;}&amp;quot;/&amp;gt;
&lt;/span&gt;&lt;span style="color:blue;"&gt;           ...
        &amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Grid&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;
&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;If you run this sample and tap on the ListPickerEx on the screen and then select some teams, the control sets the SelectedTeams property of the underlying MainViewModel instance. If you tap on the &lt;strong&gt;Set ViewModel Props&lt;/strong&gt; button, the code behind directly sets the SelectedTeams property of the MainViewModel object, and through the magic of databinding, the UI updates. The sample also does the same thing for a &lt;strong&gt;RecurringDaysPicker&lt;/strong&gt; for which the solution is virtually identical.&lt;/p&gt;

&lt;p&gt;This sample also implements proper support for tombstoning and saving and restoring state when closed and later re-opened. To do this, it (de)serializes the MainViewModel object to and from isolated storage. This raises more interesting questions on how best to serialize an object that has a property (SelectedTeams) that exposes a list of object references rather than actual object instances. This is demonstrated in the sample code, but the explanation will be the subject for my next post…&lt;/p&gt;

&lt;p&gt;&lt;a href="https://skydrive.live.com/redir.aspx?cid=b36de4dd5a9179a1&amp;amp;resid=B36DE4DD5A9179A1!1335&amp;amp;parid=B36DE4DD5A9179A1!1333"&gt;Download the sample code&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://mobileworld.appamundi.com/aggbug.aspx?PostID=442" width="1" height="1"&gt;</description><category domain="http://mobileworld.appamundi.com/blogs/andywigley/archive/tags/Silverlight/default.aspx">Silverlight</category><category domain="http://mobileworld.appamundi.com/blogs/andywigley/archive/tags/Windows+Phone+7/default.aspx">Windows Phone 7</category><category domain="http://mobileworld.appamundi.com/blogs/andywigley/archive/tags/wp7dev/default.aspx">wp7dev</category><category domain="http://mobileworld.appamundi.com/blogs/andywigley/archive/tags/_2300_wp7dev/default.aspx">#wp7dev</category></item><item><title>Review of Windows Phone 7.5 Data Cookbook</title><link>http://mobileworld.appamundi.com/blogs/petevickers/archive/2012/01/24/review-of-windows-phone-7-5-data-cookbook.aspx</link><pubDate>Tue, 24 Jan 2012 20:10:00 GMT</pubDate><guid isPermaLink="false">989b12f5-6f26-47d9-9f0d-67fe982b88db:435</guid><dc:creator>Pete Vickers</dc:creator><slash:comments>1</slash:comments><description>&lt;p&gt;I was recently sent an &amp;#39;ebook&amp;#39; of the &lt;a href="http://www.packtpub.com/windows-phone-7-5-for-storing-managing-manipulating-data-cookbook/book"&gt;Windows Phone 7.5 Data Cookbook&lt;/a&gt; by Ramsh Thalli.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.packtpub.com/windows-phone-7-5-for-storing-managing-manipulating-data-cookbook/book"&gt;&lt;img src="http://mobileworld.appamundi.com/cfs-file.ashx/__key/CommunityServer.Components.UserFiles/00.00.00.21.02/Windows-Phone-7.5-Data-Cookbook.jpg" alt="" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;It seems a good time to look at a book on data access for Windows Phone, as Mango introduced&amp;nbsp;local database support using SQL Ce. The book covers:-&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Data binding, including element binding, DataContext, data templates, converters. &lt;/li&gt;
&lt;li&gt;Isolated storage &lt;/li&gt;
&lt;li&gt;Using XML files &lt;/li&gt;
&lt;li&gt;Consuming OData, and performing CRUD against OData sources&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Using on-device databases, including Perst, SQLite and SQL Server Compact with LINQ to SQL&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Consuming REST feeds, and creating a REST service&amp;nbsp;&lt;/li&gt;
&lt;li&gt;WCF Data Services &lt;/li&gt;
&lt;li&gt;MVVM&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Starting with &amp;#39;Data binding&amp;#39;, the book leads you through the various methods of data access available to the Windows Phone developer. Having been involved in the Windows Phone camps over the last few months, I know what a hot topic data access is. The Windows Phone Databound Application is a great way to learn about data binding, but the Data binding chapter of the book explain in very simple terms the art of data binding. You start with simple data binding of text blocks to your text boxes, progress through converters, and end with how to bind data classes to your forms. Each step contains example code, and it all builds together to create a data bound project. &lt;/p&gt;
&lt;p&gt;The chapter on Isolated Storage takes you through file manipulation and application settings. This is available &lt;a href="http://www.packtpub.com/sites/default/files/1222EXP-Chapter-2-Isolated-Storage.pdf?utm_source=packtpub&amp;amp;utm_medium=free&amp;amp;utm_campaign=pdf"&gt;here&lt;/a&gt; as a downloadable sample chapter. If you follow the samples, you can use our &lt;a href="http://mobileworld.appamundi.com/blogs/petevickers/archive/2011/08/31/appa-mundi-release-free-gui-interface-for-the-isolated-storage-explorer-tool-gui-iset.aspx"&gt;GUI Isolated Storage Explorer&lt;/a&gt; to&amp;nbsp;check your output.&lt;/p&gt;
&lt;p&gt;XML access was until Mango probably the main data access method used. XML access is covered in depth, including remote XML file access, and builds on the lessons learnt in Data binding and Isolated Storage to bring them all into one project. &lt;/p&gt;
&lt;p&gt;Chapter 4 covers Odata, and shows you how to build a data driven project, using Odata from Netflix. Following the pattern already set, the project starts simply, and gradually builds up to use all the features of Odata. &lt;/p&gt;
&lt;p&gt;Chapter 5 takes you through database access on the device, starting with SQLite, moving through SQL Ce, and covering &lt;a href="http://mobileworld.appamundi.com/blogs/andywigley/archive/2010/06/07/perst-a-database-for-windows-phone-7-silverlight.aspx"&gt;Perst from McObject&lt;/a&gt;, first ported by our very own Andy Wigley. Personally, I would have preferred more about SQL Ce, but that is more my interest. For those of you using SQL Ce, &lt;a href="http://sqlcetoolbox.codeplex.com/"&gt;SQL Server Compact Toolbox&lt;/a&gt;&amp;nbsp;from fellow MVP ErikEJ is a &amp;#39;must have&amp;#39;.&lt;/p&gt;
&lt;p&gt;The final 3 chapters get heavy, covering in great detail, REST, WCF and MVVM. Following the pattern already established, all 3 chapters contain detailed explanations, and sample code, beginning with simple examples, gradually getting more complex. &lt;/p&gt;
&lt;p&gt;I think this is a book for &amp;#39;dipping&amp;#39; into, and is a great help when you are looking to solve a particular problem. There are over 30 &amp;#39;recipes&amp;#39; for working with data. This book covers a wide subject, data access, but covers it in depth. As shown by questions on the forums and events, data access on Windows Phone is a hot topic, and this books really helps in explaining the options available to you, and sample projects to guide you. For anyone wanting to know the detail behind the acronyms, this is a great choice.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://mobileworld.appamundi.com/aggbug.aspx?PostID=435" width="1" height="1"&gt;</description><category domain="http://mobileworld.appamundi.com/blogs/petevickers/archive/tags/Windows+Phone+7/default.aspx">Windows Phone 7</category><category domain="http://mobileworld.appamundi.com/blogs/petevickers/archive/tags/windows+phone/default.aspx">windows phone</category><category domain="http://mobileworld.appamundi.com/blogs/petevickers/archive/tags/SQLCe/default.aspx">SQLCe</category><category domain="http://mobileworld.appamundi.com/blogs/petevickers/archive/tags/perst/default.aspx">perst</category><category domain="http://mobileworld.appamundi.com/blogs/petevickers/archive/tags/mcobject/default.aspx">mcobject</category></item><item><title>Review: Making Embedded Systems (Elecia White)</title><link>http://mobileworld.appamundi.com/blogs/peterfoot/archive/2012/01/20/review-making-embedded-systems-elicia-white.aspx</link><pubDate>Thu, 19 Jan 2012 19:53:00 GMT</pubDate><guid isPermaLink="false">989b12f5-6f26-47d9-9f0d-67fe982b88db:433</guid><dc:creator>Peter Foot</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;&lt;a href="http://www.amazon.co.uk/gp/product/1449302149/ref=as_li_ss_il?ie=UTF8&amp;amp;tag=petfoo-21&amp;amp;linkCode=as2&amp;amp;camp=1634&amp;amp;creative=19450&amp;amp;creativeASIN=1449302149"&gt;&lt;img src="http://ws.assoc-amazon.co.uk/widgets/q?_encoding=UTF8&amp;amp;Format=_SL160_&amp;amp;ASIN=1449302149&amp;amp;MarketPlace=GB&amp;amp;ID=AsinImage&amp;amp;WS=1&amp;amp;tag=petfoo-21&amp;amp;ServiceVersion=20070822" align="left" hspace="8" border="0" alt="" /&gt;&lt;/a&gt;&lt;img height="1" width="1" src="http://www.assoc-amazon.co.uk/e/ir?t=petfoo-21&amp;amp;l=as2&amp;amp;o=2&amp;amp;a=1449302149" border="0" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;This title takes a traditional software programmer into the world of embedded system. It covers the process of designing and implementing an embedded system from a sketch through to optimising performance and power consumption.&lt;/p&gt;
&lt;p&gt;As an interesting addition, at the end of each chapter, there is a potential interview question for an embedded developer position. It&amp;rsquo;s an unusual idea but is a way of tying up the topics covered in the chapter. Because the book is written for developers it applies patterns and techniques which the reader will already be familiar with and how they apply to embedded systems.&lt;/p&gt;
&lt;p&gt;It emphasises the need to be aware of the limited resources available and how to pare down operations to a minimum to make best use of them. It also talks about various options for input and output for a variety of peripherals and sensors.&lt;/p&gt;
&lt;p&gt;The book offers a useful introduction to the world of embedded development to a developer with existing C (or similar) experience. More experienced embedded developers will probably want to delve into more detail on the specific areas, but this is a great starting point.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;4/5&lt;/strong&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://mobileworld.appamundi.com/aggbug.aspx?PostID=433" width="1" height="1"&gt;</description><category domain="http://mobileworld.appamundi.com/blogs/peterfoot/archive/tags/Books/default.aspx">Books</category><category domain="http://mobileworld.appamundi.com/blogs/peterfoot/archive/tags/Review/default.aspx">Review</category></item><item><title>Silverlight Toolkit ToggleSwitch Databinding Bug</title><link>http://mobileworld.appamundi.com/blogs/andywigley/archive/2012/01/18/silverlight-toolkit-toggleswitch-databinding-bug.aspx</link><pubDate>Wed, 18 Jan 2012 20:23:00 GMT</pubDate><guid isPermaLink="false">989b12f5-6f26-47d9-9f0d-67fe982b88db:430</guid><dc:creator>Andy Wigley</dc:creator><slash:comments>3</slash:comments><description>&lt;p&gt;Are you using MVVM? Are you using the &lt;strong&gt;ToggleSwitch&lt;/strong&gt; from the Silverlight Toolkit? Have you got a weird bug where a ToggleSwitch that has its &lt;strong&gt;IsChecked&lt;/strong&gt; property databound to a &lt;strong&gt;bool&lt;/strong&gt; or a &lt;strong&gt;bool?&lt;/strong&gt; property of a ViewModel doesn&amp;rsquo;t always seem to display the correct ON or OFF value? It may be you have encountered a rather subtle bug in the ToggleButton control.&lt;/p&gt;
&lt;p&gt;I have just been developing an app using MVVM and noticed a problem with the ToggleSwitch control from the Silverlight Toolkit for Windows Phone (November 2011 release).&amp;nbsp; I noticed that a ToggleSwitch that had its IsChecked property databound to a ViewModel class did not update the ToggleSwitch UI as expected &amp;ndash; but only when the bound property on the viewmodel is changed from true to false and only when the ToggleSwitch is not visible. Puzzled? Let me explain&amp;hellip;&lt;/p&gt;
&lt;p&gt;This can be easily demonstrated by a slight variant on the well-known Databound App that you can create using the standard project templates. I added an additional property to the ItemViewModel class so alongside the existing LineOne, LineTwo and LineThree properties, it now has an additional property of type &lt;strong&gt;bool?&lt;/strong&gt; called &lt;strong&gt;IsActive&lt;/strong&gt;:&lt;/p&gt;
&lt;pre class="code"&gt;&lt;span style="color:#0000ff;"&gt;public class &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;ItemViewModel &lt;/span&gt;: &lt;span style="color:#2b91af;"&gt;INotifyPropertyChanged
&lt;/span&gt;{
&lt;span style="color:#0000ff;"&gt;    public string &lt;/span&gt;LineOne  { ... }

&lt;span style="color:#0000ff;"&gt;    public string &lt;/span&gt;LineTwo  { ... } 
&lt;span style="color:#0000ff;"&gt;    &lt;/span&gt;&lt;/pre&gt;
&lt;pre class="code"&gt;&lt;span style="color:#0000ff;"&gt;    public string &lt;/span&gt;LineThree { ... }
    
    &lt;span style="color:#0000ff;"&gt;private bool&lt;/span&gt;? _isActive;

    &lt;span style="color:#0000ff;"&gt;public bool&lt;/span&gt;? IsActive
    {
        &lt;span style="color:#0000ff;"&gt;get
        &lt;/span&gt;{
            &lt;span style="color:#0000ff;"&gt;return &lt;/span&gt;_isActive;
        }
        &lt;span style="color:#0000ff;"&gt;set
        &lt;/span&gt;{
            &lt;span style="color:#0000ff;"&gt;if &lt;/span&gt;(&lt;span style="color:#0000ff;"&gt;value &lt;/span&gt;!= _isActive)
            {
                _isActive = &lt;span style="color:#0000ff;"&gt;value&lt;/span&gt;;
                NotifyPropertyChanged(&lt;span style="color:#a31515;"&gt;&amp;quot;IsActive&amp;quot;&lt;/span&gt;);
            }
        }
    }

    &lt;span style="color:#0000ff;"&gt;public event &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;PropertyChangedEventHandler &lt;/span&gt;PropertyChanged;
    ...&lt;/pre&gt;
&lt;pre class="code"&gt;}&lt;/pre&gt;
&lt;p&gt;Next, I changed the DataTemplate for the ListBox on the main page so that it displays a ToggleSwitch with its IsChecked property databound to the new IsActive property of my ViewModel. For interest, I also added a Checkbox databound in a similar way because ToggleSwitch inherits from CheckBox and I wanted to see if the problem existed with the CheckBox as well. So the DataTemplate looks like this:&lt;/p&gt;
&lt;pre class="code"&gt;            &lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ListBox &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;x&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;:&lt;/span&gt;&lt;span style="color:#ff0000;"&gt;Name&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;MainListBox&amp;quot; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;Margin&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;0,0,-12,0&amp;quot; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;ItemsSource&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Binding &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;Items&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;}&amp;quot; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;SelectionChanged&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;MainListBox_SelectionChanged&amp;quot;&amp;gt;
                &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ListBox.ItemTemplate&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;
                    &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;DataTemplate&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;
                      &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;StackPanel &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;Margin&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;0,0,0,17&amp;quot; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;Width&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;432&amp;quot;&amp;gt;
                          &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;TextBlock &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;Text&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Binding &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;LineOne&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;}&amp;quot; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;TextWrapping&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;Wrap&amp;quot; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;Style&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color:#a31515;"&gt;StaticResource &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;PhoneTextExtraLargeStyle&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;}&amp;quot;/&amp;gt;
                          &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;TextBlock &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;Text&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Binding &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;LineTwo&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;}&amp;quot; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;TextWrapping&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;Wrap&amp;quot; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;Margin&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;12,-6,12,0&amp;quot; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;Style&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color:#a31515;"&gt;StaticResource &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;PhoneTextSubtleStyle&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;}&amp;quot;/&amp;gt;
                          &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;CheckBox  &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;Content&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;Is Active&amp;quot; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;IsChecked&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Binding &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;IsActive&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;}&amp;quot; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;IsEnabled&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;False&amp;quot; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;Margin&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;0,-6,0,0&amp;quot;/&amp;gt;
                          &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;toolkit&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;:&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ToggleSwitch &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;Margin&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;0,-36,0,0&amp;quot; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;IsChecked&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Binding &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;IsActive&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;}&amp;quot; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;IsEnabled&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;False&amp;quot;/&amp;gt;
                        &amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;StackPanel&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;
                    &amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;DataTemplate&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;
                &amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ListBox.ItemTemplate&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;
            &amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ListBox&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;
&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Next i updated the code in the constructor of &lt;strong&gt;MainViewModel&lt;/strong&gt; so that it sets &amp;lsquo;runtime one&amp;rsquo; &lt;strong&gt;IsActive&lt;/strong&gt; to &lt;strong&gt;false&lt;/strong&gt;, &amp;lsquo;runtime two&amp;rsquo; &lt;strong&gt;IsActive&lt;/strong&gt; to &lt;strong&gt;true&lt;/strong&gt; and &amp;lsquo;runtime three&amp;rsquo; &lt;strong&gt;IsActive&lt;/strong&gt; to &lt;strong&gt;null&lt;/strong&gt;. When running the List looks like this, just as you would expect:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://mobileworld.appamundi.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/andywigley/ToggleMainList_5F00_3A62CE52.png"&gt;&lt;img height="512" width="284" src="http://mobileworld.appamundi.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/andywigley/ToggleMainList_5F00_thumb_5F00_4969875F.png" alt="ToggleMainList" border="0" title="ToggleMainList" style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:inline;border-top:0px;border-right:0px;padding-top:0px;" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The CheckBox and the ToggleSwitch controls in the template display the UI you would expect, Unchecked/Off for runtime one, Checked/On for runtime two and Indeterminate/Off for Runtime three.&lt;/p&gt;
&lt;p&gt;When you tap on an item in the ListBox, the standard Databound App navigates to &lt;strong&gt;DetailsPage.xaml&lt;/strong&gt;, and in my version, I have added a ToggleSwitch to that page with its IsChecked property databound to the IsActive property.&amp;nbsp; I also added an ApplicationBar to that page with an &amp;lsquo;Edit&amp;rsquo; button on it that when pressed navigates to another page called &lt;strong&gt;EditDetailsPage.xaml&lt;/strong&gt; which is similar to DetailsPage.xaml but uses two-way databinding to allow you to edit the fields of the underlying data item. It looks like this:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://mobileworld.appamundi.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/andywigley/ToggleEdit_5F00_4CBAF93A.png"&gt;&lt;img height="517" width="287" src="http://mobileworld.appamundi.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/andywigley/ToggleEdit_5F00_thumb_5F00_00BF72C1.png" alt="ToggleEdit" border="0" title="ToggleEdit" style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:inline;border-top:0px;border-right:0px;padding-top:0px;" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;[I won&amp;rsquo;t go into the simple code behind this &amp;ndash; download the sample code that accompanies this post to see how this is implemented &lt;img src="http://mobileworld.appamundi.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/andywigley/wlEmoticon_2D00_smile_5F00_3D27C19E.png" alt="Smile" class="wlEmoticon wlEmoticon-smile" style="border-bottom-style:none;border-left-style:none;border-top-style:none;border-right-style:none;" /&gt;].&lt;/p&gt;
&lt;p&gt;Remember that when the app starts up, the &amp;lsquo;runtime one&amp;rsquo; object has &lt;strong&gt;IsActive&lt;/strong&gt; set to &lt;strong&gt;false&lt;/strong&gt;, so the checkbox and ToggleSwitch in the full list on MainPage.xaml are &amp;lsquo;Off&amp;rsquo;. If you then tap on the Runtime One record in the ListBox, the app navigates to DetailsPage.xaml to show the details of that record. If I then tap on the application bar Edit button, the app navigates to EditDetailsPage.xaml. On that edit page, I have checked the CheckBox so thanks to two-way databinding, the &lt;strong&gt;IsActive&lt;/strong&gt; property of &amp;lsquo;runtime one&amp;rsquo; is now set to &lt;strong&gt;true&lt;/strong&gt;. So of course, as we navigate back through the pages, the ToggleSwitch and Checkbox controls that are bound to that property will be checked, correct?&lt;/p&gt;
&lt;p&gt;Correct. Everything is as it should be:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://mobileworld.appamundi.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/andywigley/ToggleEditCorrect1_5F00_436E982C.png"&gt;&lt;img height="484" width="268" src="http://mobileworld.appamundi.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/andywigley/ToggleEditCorrect1_5F00_thumb_5F00_7EFE811F.png" alt="ToggleEditCorrect1" border="0" title="ToggleEditCorrect1" style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:inline;border-top:0px;border-right:0px;padding-top:0px;" /&gt;&lt;/a&gt;&lt;a href="http://mobileworld.appamundi.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/andywigley/ToggleEditCorrect2_5F00_26E1807F.png"&gt;&lt;img height="484" width="268" src="http://mobileworld.appamundi.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/andywigley/ToggleEditCorrect2_5F00_thumb_5F00_3B37203D.png" alt="ToggleEditCorrect2" border="0" title="ToggleEditCorrect2" style="background-image:none;border-bottom:0px;border-left:0px;margin:0px 0px 0px 20px;padding-left:0px;padding-right:0px;display:inline;border-top:0px;border-right:0px;padding-top:0px;" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;So, no problem there. The &lt;strong&gt;ToggleSwitch&lt;/strong&gt; on &lt;strong&gt;DetailsPage.xaml&lt;/strong&gt; is correctly shown as &amp;lsquo;&lt;strong&gt;On&lt;/strong&gt;&amp;rsquo; (the left hand screenshot), and on &lt;strong&gt;MainPage.xaml&lt;/strong&gt;, the CheckBox and the ToggleSwitch in the list for runtime one have correctly detected that &lt;strong&gt;IsActive&lt;/strong&gt; property is now true, so are showing as &lt;strong&gt;Checked&lt;/strong&gt; and &lt;strong&gt;On&lt;/strong&gt; respectively.&lt;/p&gt;
&lt;p&gt;Now we&amp;lsquo;ll reverse that and set &lt;strong&gt;IsActive&lt;/strong&gt; to false again. So tap on runtime one in the list and we navigate to the &lt;strong&gt;DetailsPage.xaml&lt;/strong&gt;, then tap on the edit button in the appbar and we navigate to &lt;strong&gt;EditDetailspage.xaml&lt;/strong&gt;. Tap the checkbox to clear it and then tap &lt;strong&gt;Save&lt;/strong&gt;. This is where things go wrong &lt;img src="http://mobileworld.appamundi.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/andywigley/wlEmoticon_2D00_surprisedsmile_5F00_53E64780.png" alt="Surprised smile" class="wlEmoticon wlEmoticon-surprisedsmile" style="border-bottom-style:none;border-left-style:none;border-top-style:none;border-right-style:none;" /&gt;. The &lt;strong&gt;ToggleSwitch&lt;/strong&gt; controls both on &lt;strong&gt;DetailsPage.xaml&lt;/strong&gt; and in the DataTemplate for the ListBox on &lt;strong&gt;MainPage.xaml&lt;/strong&gt; do &lt;strong&gt;&lt;span style="text-decoration:underline;"&gt;not&lt;/span&gt;&lt;/strong&gt; pick up the fact that &lt;strong&gt;IsActive&lt;/strong&gt; is now &lt;strong&gt;false&lt;/strong&gt; &amp;ndash; though the &lt;strong&gt;CheckBox&lt;/strong&gt; controls *&lt;span style="text-decoration:underline;"&gt;&lt;strong&gt;do&lt;/strong&gt;&lt;/span&gt;* pick it up and display &lt;strong&gt;unchecked&lt;/strong&gt;:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://mobileworld.appamundi.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/andywigley/ToggleEditWrong1_5F00_1E6D855B.png"&gt;&lt;img height="484" width="268" src="http://mobileworld.appamundi.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/andywigley/ToggleEditWrong1_5F00_thumb_5F00_604444DC.png" alt="ToggleEditWrong1" border="0" title="ToggleEditWrong1" style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:inline;border-top:0px;border-right:0px;padding-top:0px;" /&gt;&lt;/a&gt;&lt;a href="http://mobileworld.appamundi.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/andywigley/ToggleEditWrong2_5F00_158D5742.png"&gt;&lt;img height="484" width="268" src="http://mobileworld.appamundi.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/andywigley/ToggleEditWrong2_5F00_thumb_5F00_5EEF8630.png" alt="ToggleEditWrong2" border="0" title="ToggleEditWrong2" style="background-image:none;border-bottom:0px;border-left:0px;margin:0px 0px 0px 20px;padding-left:0px;padding-right:0px;display:inline;border-top:0px;border-right:0px;padding-top:0px;" /&gt;&lt;/a&gt;&lt;a href="http://mobileworld.appamundi.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/andywigley/ToggleEditWrong3_5F00_34BFD848.png"&gt;&lt;img height="484" width="268" src="http://mobileworld.appamundi.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/andywigley/ToggleEditWrong3_5F00_thumb_5F00_693084C3.png" alt="ToggleEditWrong3" border="0" title="ToggleEditWrong3" style="background-image:none;border-bottom:0px;border-left:0px;margin:0px 0px 0px 20px;padding-left:0px;padding-right:0px;display:inline;border-top:0px;border-right:0px;padding-top:0px;" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;As you can see, the Checkbox has been cleared on the first edit screen &amp;ndash; this causes the &lt;strong&gt;IsActive&lt;/strong&gt; property of the viewmodel to be set to &lt;strong&gt;false&lt;/strong&gt;. Pressing the save button on that screen causes a navigation back to the View Details screen (middle screen shot) and as you can see, the ToggleSwitch on that screen hasn&amp;rsquo;t picked up the fact that the viewmodel has changed since it is still set to On. Another press of the Back key puts you back on the main page, where the ListBox displays both a CheckBox and a ToggleSwitch databound to the IsActive property and here the CheckBox is unset but the ToggleSwitch is still On.&lt;/p&gt;
&lt;p&gt;Note that this problem only occurs when the databound ToggleSwitches are not visible. When the IsActive property of the viewmodel class is set, it fires PropertyChanged events in the normal way. In Windows Phone, as you navigate through pages, the control objects that are on the parent screens (such as MainPage.xaml and DetailsPage.xaml in this example) stay in memory but are not rendered to the screen. Although the TextBox and CheckBox controls respond correctly to changes in a databound property of an underlying viewmodel class, the ToggleSwitch does not &amp;ndash; well at least not when a bool? type is changed from true to false!&lt;/p&gt;
&lt;p&gt;In the download for this post, I&amp;rsquo;ve included another simple project that shows that there is no problem with a databound ToggleButton as long as it is visible.&lt;/p&gt;
&lt;p&gt;The workaround for this? You have to force the ToggleButton to refresh its binding and this is best done in OnNavigatedTo. For example, in OnNavigatedTo on DetailsPage.xaml, add code such as:&lt;/p&gt;
&lt;pre class="code"&gt;&lt;span style="color:#0000ff;"&gt;protected override void &lt;/span&gt;OnNavigatedTo(&lt;span style="color:#2b91af;"&gt;NavigationEventArgs &lt;/span&gt;e)
{

    &lt;span style="color:#0000ff;"&gt;...&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="code"&gt;&lt;span style="color:#0000ff;"&gt;&lt;/span&gt;
    &lt;span style="color:#008000;"&gt;// Force the ToggleButton to refresh its binding
    &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;ItemViewModel &lt;/span&gt;vm = &lt;span style="color:#0000ff;"&gt;this&lt;/span&gt;.DataContext &lt;span style="color:#0000ff;"&gt;as &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;ItemViewModel&lt;/span&gt;;
    &lt;span style="color:#0000ff;"&gt;this&lt;/span&gt;.ToggleSwitch1.IsChecked = vm.IsActive;
}&lt;/pre&gt;
&lt;p&gt;For the ListBox on&amp;nbsp; MainPage.xaml, you could use a blunt stick approach and simply toggle the setting of the ItemsSource to force it to renew all its bindings:&lt;/p&gt;
&lt;pre class="code"&gt;&lt;span style="color:#0000ff;"&gt;protected override void &lt;/span&gt;OnNavigatedTo(System.Windows.Navigation.&lt;span style="color:#2b91af;"&gt;NavigationEventArgs &lt;/span&gt;e)
{
    &lt;span style="color:#0000ff;"&gt;base&lt;/span&gt;.OnNavigatedTo(e);

&lt;span style="color:#008000;"&gt;    // Toggle the ItemsSource setting to force the ToggleSwitches to rebind
    &lt;/span&gt;&lt;span style="color:#0000ff;"&gt;this&lt;/span&gt;.MainListBox.ItemsSource = &lt;span style="color:#0000ff;"&gt;null&lt;/span&gt;;
    &lt;span style="color:#0000ff;"&gt;this&lt;/span&gt;.MainListBox.ItemsSource = &lt;span style="color:#2b91af;"&gt;App&lt;/span&gt;.ViewModel.Items;
}&lt;/pre&gt;
&lt;p&gt;It&amp;rsquo;s ugly but effective. More elegant solutions would be possible using the VisualTreeHelper to identify the ToggleButton instances and to refresh them individually, but I leave that as an exercise for the reader &lt;img src="http://mobileworld.appamundi.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/andywigley/wlEmoticon_2D00_smile_5F00_3D27C19E.png" alt="Smile" class="wlEmoticon wlEmoticon-smile" style="border-bottom-style:none;border-left-style:none;border-top-style:none;border-right-style:none;" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://mobileworld.appamundi.com/aggbug.aspx?PostID=430" width="1" height="1"&gt;</description><enclosure url="http://mobileworld.appamundi.com/cfs-file.ashx/__key/CommunityServer.Components.PostAttachments/00.00.00.04.30/DataBoundToggleSwitch.zip" length="1167252" type="application/x-zip-compressed" /><category domain="http://mobileworld.appamundi.com/blogs/andywigley/archive/tags/Silverlight/default.aspx">Silverlight</category><category domain="http://mobileworld.appamundi.com/blogs/andywigley/archive/tags/Windows+Phone+7/default.aspx">Windows Phone 7</category><category domain="http://mobileworld.appamundi.com/blogs/andywigley/archive/tags/wp7dev/default.aspx">wp7dev</category><category domain="http://mobileworld.appamundi.com/blogs/andywigley/archive/tags/_2300_wp7dev/default.aspx">#wp7dev</category></item><item><title>Windows Phone Update Due Shortly</title><link>http://mobileworld.appamundi.com/blogs/peterfoot/archive/2012/01/06/windows-phone-update-due-shortly.aspx</link><pubDate>Fri, 06 Jan 2012 01:32:00 GMT</pubDate><guid isPermaLink="false">989b12f5-6f26-47d9-9f0d-67fe982b88db:429</guid><dc:creator>Peter Foot</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;Microsoft have published details of a new update (7.10.8107.79) which adds a number of fixes to the Mango release. It fixes the issue where the on screen keyboard will randomly hide itself which I&amp;#39;ve been finding frustrating recently and also a fix for the SMS bug which could disable messaging. It also hopefully finally resolves the issue when forwarding Exchange messages where the original message body would disappear. It hasn&amp;#39;t shown up yet but expect it&amp;nbsp;over the next couple of weeks. Full details on all the updates and fixes are published here:-&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.microsoft.com/windowsphone/en-us/howto/wp7/basics/update-history.aspx"&gt;http://www.microsoft.com/windowsphone/en-us/howto/wp7/basics/update-history.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;

&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://mobileworld.appamundi.com/aggbug.aspx?PostID=429" width="1" height="1"&gt;</description><category domain="http://mobileworld.appamundi.com/blogs/peterfoot/archive/tags/Windows+Phone/default.aspx">Windows Phone</category></item><item><title>Developer Unlock Expiry</title><link>http://mobileworld.appamundi.com/blogs/peterfoot/archive/2011/12/22/developer-unlock-expiry.aspx</link><pubDate>Wed, 21 Dec 2011 23:35:00 GMT</pubDate><guid isPermaLink="false">989b12f5-6f26-47d9-9f0d-67fe982b88db:427</guid><dc:creator>Peter Foot</dc:creator><slash:comments>1</slash:comments><description>&lt;p&gt;When you&amp;#39;ve developer unlocked your Windows Phone you can merrily deploy and debug on it and everything is great. If you&amp;#39;ve upgraded to Mango you had to run the Unlock tool again but this is fairly painless. What is not obvious is that the developer unlock has a 12 month expiry from when you first register the device and even when you subsequently use the unlock tool on the same device this never gets extended. &lt;/p&gt;
&lt;p&gt;So one day you&amp;#39;ll be developing as normal and get the error &amp;quot;Failed to connect to device as it is developer locked. For details on developer unlock, visit &lt;a href="http://go.microsoft.com/fwlink/?LinkId=195284"&gt;http://go.microsoft.com/fwlink/?LinkId=195284&lt;/a&gt;.&amp;quot;. Instictively you launch the developer unlock tool, enter your App Hub credentials and unlock the phone. This completes with no errors but you&amp;#39;ll soon find that it hasn&amp;#39;t helped despite the fact you entered valid credentials and your App Hub account is valid.&lt;/p&gt;
&lt;p&gt;The solution to this problem is to log into App Hub on the web and go to your account profile, select devices and remove the offending device from the list (here you&amp;#39;ll see that the expiry date is shown). After doing this you can run the unlock tool again and successfully unlock the device.&lt;/p&gt;
&lt;p&gt;Microsoft could certainly&amp;nbsp;improve this process in the future by using a more descriptive error message and also by improving the unlock tool so that when you try to unlock a device that has expired it refreshed the registration and provide 12 more months of use (just like the manual process described above does).&lt;/p&gt;
&lt;p&gt;Merry Christmas, and here&amp;#39;s to a wonderful 2012 filled with Windows Phone goodness!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://mobileworld.appamundi.com/aggbug.aspx?PostID=427" width="1" height="1"&gt;</description><category domain="http://mobileworld.appamundi.com/blogs/peterfoot/archive/tags/Windows+Phone/default.aspx">Windows Phone</category></item><item><title>Windows Phone LINQ to SQL and Data Virtualization</title><link>http://mobileworld.appamundi.com/blogs/andywigley/archive/2011/12/14/windows-phone-linq-to-sql-and-data-virtualization.aspx</link><pubDate>Wed, 14 Dec 2011 17:05:01 GMT</pubDate><guid isPermaLink="false">989b12f5-6f26-47d9-9f0d-67fe982b88db:423</guid><dc:creator>Andy Wigley</dc:creator><slash:comments>5</slash:comments><description>&lt;h1&gt;How to work with large tables in LINQ to SQL on Windows Phone&lt;/h1&gt; &lt;h2&gt;Introduction to Data Virtualization&lt;/h2&gt; &lt;p&gt;Data Virtualization is a technique you use to expose a subset of the data from a large data collection so that only the actual data you need is fetched into memory. To implement data virtualization, you take your data collection which could contain any number of rows – even a million rows or more! – and you create a custom class for your virtualized data collection that implements IList&amp;lt;T&amp;gt; and acts as a facade to the underlying data collection.&lt;/p&gt; &lt;p&gt;IList&amp;lt;T&amp;gt; has a great many methods, but fortunately the only methods you have to implement are:&lt;/p&gt; &lt;ul&gt; &lt;li&gt; &lt;p&gt;&lt;span style="color:blue;"&gt;public int &lt;/span&gt;Count &lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;pre class="code"&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="color:#2b91af;"&gt;T IList&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af;"&gt;T&lt;/span&gt;&amp;gt;.&lt;span style="color:blue;"&gt;this&lt;/span&gt;[&lt;span style="color:blue;"&gt;int &lt;/span&gt;index]&lt;/li&gt;&lt;/ul&gt;&lt;/pre&gt;
&lt;p&gt;&lt;br /&gt;The count property just returns the number of items in the underlying data collection, while the second is just the indexer and allows you to retrieve the ‘nth’ item from the underlying collection. The rest of the methods of IList&amp;lt;T&amp;gt; must of course be implemented in your virtualized data collection class, but you can just throw the NotImplemented exception – in most usages, they will not be called. The only other method of IList&amp;lt;T&amp;gt; that you might choose to implement is &lt;strong&gt;&lt;span style="color:blue;"&gt;public int &lt;/span&gt;IndexOf(&lt;span style="color:#2b91af;"&gt;T&lt;/span&gt;item)&lt;/strong&gt; which returns the position of an item in the underlying collection. This becomes useful when you want to do lookups in the collection.&lt;/p&gt;
&lt;p&gt;In Windows Phone apps, this is beneficial when you want to display a long list of items in a &lt;strong&gt;ListBox&lt;/strong&gt;. Just set your ListBox &lt;strong&gt;ItemsSource&lt;/strong&gt; property to an instance of your virtualized data collection class, and the ListBox will only fetch the visible items and a few either side (to assist with scrolling up and down the list). You can read more about this technique in Shawn Oster’s blog: &lt;a href="http://shawnoster.com/blog/post/Improving-ListBox-Performance-in-Silverlight-for-Windows-Phone-7-Data-Virtualization.aspx"&gt;Improving ListBox Performance in Silverlight for Windows Phone 7: Data Virtualization&lt;/a&gt; or in Peter Torr’s blog: &lt;a href="http://blogs.msdn.com/b/ptorr/archive/2010/08/16/virtualizing-data-in-windows-phone-7-silverlight-applications.aspx"&gt;Virtualizing Data in Windows Phone 7 Silverlight Applications&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;Data Virtualization with LINQ to SQL&lt;/h2&gt;
&lt;p&gt;So, on to the purpose of this post. I wondered how to implement data virtualization using LINQ to SQL in Windows Phone Mango. For my test database, I created a database with a single table in it which could be used in a dictionary application. It has 200000 entries in it, and the the Word table looks like this:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://mobileworld.appamundi.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/andywigley/Table_2D00_design_5F00_79704A82.png"&gt;&lt;img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="Table design" border="0" alt="Table design" src="http://mobileworld.appamundi.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/andywigley/Table_2D00_design_5F00_thumb_5F00_52FE416A.png" width="472" height="407" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Ignore the Sequence column for now – we’ll come back to that at the end. The &lt;strong&gt;WordTxt&lt;/strong&gt; column is up to 128 characters in length and is the Primary Key, while the &lt;strong&gt;WordDescription&lt;/strong&gt; column is up to 1024 characters and holds the description of the word. I’ve filled the table with randomly generated data (using a contorted process – see footnote &lt;img style="border-bottom-style:none;border-left-style:none;border-top-style:none;border-right-style:none;" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://mobileworld.appamundi.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/andywigley/wlEmoticon_2D00_smile_5F00_6E30EC29.png" /&gt; ) and now we can try to bind the data in this table to a ListBox.&lt;/p&gt;
&lt;p&gt;You can &lt;a href="https://skydrive.live.com/redir.aspx?cid=b36de4dd5a9179a1&amp;amp;resid=B36DE4DD5A9179A1!1334&amp;amp;parid=B36DE4DD5A9179A1!1333"&gt;download the sample project here&lt;/a&gt; (it’s nearly 50MB since it contains a database that is 107MB when decompressed). Compile the project and deploy it onto your target emulator or device.&lt;/p&gt;
&lt;p&gt;IMPORTANT: The database is included in the project, but its Build Action is set to ‘None’ and Copy to Output Directory set to ‘Do not copy’ – so you’ll have to manually copy the database onto the target. I’ve done it this way because if you include the database as Content it takes around 5 minutes to build and deploy the app which is tedious when you’re playing with the code. So to deploy the database, either change its Build Action to Embedded Resource and then go away and have a cup of tea while it’s deploying, or use the Isolated Storage Explorer Tool to copy it to the target, or better still the nice tools at &lt;a href="http://wptools.codeplex.com"&gt;http://wptools.codeplex.com&lt;/a&gt; .&lt;/p&gt;
&lt;p&gt;In the project, in the App.xaml.cs I initialize the data context appropriately for a read only database:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color:blue;"&gt;public &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;DictionaryDatabaseContext &lt;/span&gt;DbDC;

&lt;span style="color:green;"&gt;// Code to execute when the application is launching (eg, from Start)
// This code will not execute when the application is reactivated
&lt;/span&gt;&lt;span style="color:blue;"&gt;private void &lt;/span&gt;Application_Launching(&lt;span style="color:blue;"&gt;object &lt;/span&gt;sender, &lt;span style="color:#2b91af;"&gt;LaunchingEventArgs &lt;/span&gt;e)
{
    DbDC = &lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;DictionaryDatabaseContext&lt;/span&gt;(
        &lt;span style="color:#a31515;"&gt;&amp;quot;Data Source=isostore:/DictionaryDatabase.sdf;Max Database Size=180;File Mode=Read Only;&amp;quot;&lt;/span&gt;);
    DbDC.ObjectTrackingEnabled = &lt;span style="color:blue;"&gt;false&lt;/span&gt;;
}

&lt;span style="color:green;"&gt;// Code to execute when the application is activated (brought to foreground)
// This code will not execute when the application is first launched
&lt;/span&gt;&lt;span style="color:blue;"&gt;private void &lt;/span&gt;Application_Activated(&lt;span style="color:blue;"&gt;object &lt;/span&gt;sender, &lt;span style="color:#2b91af;"&gt;ActivatedEventArgs &lt;/span&gt;e)
{
    &lt;span style="color:blue;"&gt;if &lt;/span&gt;(!e.IsApplicationInstancePreserved)
    {
        DbDC = &lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;DictionaryDatabaseContext&lt;/span&gt;(
            &lt;span style="color:#a31515;"&gt;&amp;quot;Data Source=isostore:/DictionaryDatabase.sdf;Max Database Size=180;File Mode=Read Only;&amp;quot;&lt;/span&gt;);
        DbDC.ObjectTrackingEnabled = &lt;span style="color:blue;"&gt;false&lt;/span&gt;;
    }
}
&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The main page just has four buttons on it which navigate to four different pages which use differing ways of binding to the data:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://mobileworld.appamundi.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/andywigley/L2S_2D00_Main_2D00_page_5F00_3198ED8C.png"&gt;&lt;img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="L2S Main page" border="0" alt="L2S Main page" src="http://mobileworld.appamundi.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/andywigley/L2S_2D00_Main_2D00_page_5F00_thumb_5F00_5354A050.png" width="184" height="331" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Every page has a ListBox on it which uses the following DataTemplate to format the display of items in the list:&lt;/p&gt;&lt;pre class="code"&gt;        &lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;DataTemplate &lt;/span&gt;&lt;span style="color:red;"&gt;x&lt;/span&gt;&lt;span style="color:blue;"&gt;:&lt;/span&gt;&lt;span style="color:red;"&gt;Key&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;WordTemplate&amp;quot;&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;StackPanel&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;
                &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;TextBlock &lt;/span&gt;&lt;span style="color:red;"&gt;Text&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Binding &lt;/span&gt;&lt;span style="color:red;"&gt;WordTxt&lt;/span&gt;&lt;span style="color:blue;"&gt;}&amp;quot; 
                           &lt;/span&gt;&lt;span style="color:red;"&gt;Style&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color:#a31515;"&gt;StaticResource &lt;/span&gt;&lt;span style="color:red;"&gt;PhoneTextAccentStyle&lt;/span&gt;&lt;span style="color:blue;"&gt;}&amp;quot;/&amp;gt;
                &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;TextBlock &lt;/span&gt;&lt;span style="color:red;"&gt;Text&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Binding &lt;/span&gt;&lt;span style="color:red;"&gt;WordDescription&lt;/span&gt;&lt;span style="color:blue;"&gt;}&amp;quot; 
                           &lt;/span&gt;&lt;span style="color:red;"&gt;Style&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color:#a31515;"&gt;StaticResource &lt;/span&gt;&lt;span style="color:red;"&gt;PhoneTextSmallStyle&lt;/span&gt;&lt;span style="color:blue;"&gt;}&amp;quot; 
                           &lt;/span&gt;&lt;span style="color:red;"&gt;Width&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;436&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;TextWrapping&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;Wrap&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;Margin&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;12,0,12,12&amp;quot; &lt;/span&gt;&lt;span style="color:red;"&gt;Height&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;75&amp;quot;/&amp;gt;
            &amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;StackPanel&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;
        &amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;DataTemplate&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="code"&gt;&lt;span style="color:blue;"&gt;
&lt;/span&gt;&lt;/pre&gt;
&lt;h3&gt;Option 1: Bind directly to the database table&lt;/h3&gt;
&lt;p&gt;This is just to prove the point. The ‘Load All’ button navigates to a page that just binds the ListBox directly to the database table:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color:blue;"&gt;using &lt;/span&gt;Microsoft.Phone.Controls;

&lt;span style="color:blue;"&gt;namespace &lt;/span&gt;LargeDBAppSample.Views
{
    &lt;span style="color:blue;"&gt;public partial class &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;LoadAllPage &lt;/span&gt;: &lt;span style="color:#2b91af;"&gt;PhoneApplicationPage
    &lt;/span&gt;{
        &lt;span style="color:blue;"&gt;public &lt;/span&gt;LoadAllPage()
        {
            InitializeComponent();
            &lt;span style="color:blue;"&gt;this&lt;/span&gt;.Loaded += ((s, e) =&amp;gt;
            {
                &lt;span style="color:#2b91af;"&gt;DictionaryDatabaseContext &lt;/span&gt;dc = ((&lt;span style="color:#2b91af;"&gt;App&lt;/span&gt;)&lt;span style="color:#2b91af;"&gt;App&lt;/span&gt;.Current).DbDC;
                listBox1.ItemsSource = dc.Words;
            }
           );
        }
    }
}
&lt;/pre&gt;
&lt;p&gt;When you try this option, the result is predictable. I’m using Peter Torr’s very helpful &lt;a href="http://blogs.msdn.com/b/ptorr/archive/2010/10/30/that-memory-thing-i-promised-you.aspx"&gt;MemoryDiagnosticsHelper&lt;/a&gt; which writes the memory usage alongside the Framerate counters. This throws a debug assert when memory exceeds 90MB, and in this case we hit 104MB:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://mobileworld.appamundi.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/andywigley/L2S_2D00_LoadAll_5F00_4A18650F.png"&gt;&lt;img style="background-image:none;border-right-width:0px;margin:0px 0px 0px 20px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="L2S LoadAll" border="0" alt="L2S LoadAll" src="http://mobileworld.appamundi.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/andywigley/L2S_2D00_LoadAll_5F00_thumb_5F00_6A8F7EF4.png" width="208" height="375" /&gt;&lt;/a&gt;&lt;a href="http://mobileworld.appamundi.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/andywigley/MemoryExceeded_5F00_4712DA8F.png"&gt;&lt;img style="background-image:none;border-right-width:0px;margin:0px 0px 20px 20px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="MemoryExceeded" border="0" alt="MemoryExceeded" src="http://mobileworld.appamundi.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/andywigley/MemoryExceeded_5F00_thumb_5F00_1AF5DD9E.png" width="113" height="284" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3&gt;Option 2: Data Virtualization – Bad Implementation&lt;/h3&gt;
&lt;p&gt;The second button on the main page takes you to a page that uses data virtualization. In this case, we also have a textbox where the user can enter a search string – because let’s face it, a ListBox that contains 200000 items is not going to give a good user experience. Scroll down to the bottom to find the ‘Y’s?? – I don’t think so &lt;img style="border-bottom-style:none;border-left-style:none;border-top-style:none;border-right-style:none;" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://mobileworld.appamundi.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/andywigley/wlEmoticon_2D00_smile_5F00_6E30EC29.png" /&gt;.&lt;/p&gt;
&lt;p&gt;So the code for the page here looks like this:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color:blue;"&gt;public partial class &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;BadDataVirtualizationPage &lt;/span&gt;: &lt;span style="color:#2b91af;"&gt;PhoneApplicationPage
&lt;/span&gt;{
    &lt;span style="color:blue;"&gt;public &lt;/span&gt;BadDataVirtualizationPage()
    {
        InitializeComponent();

        &lt;span style="color:blue;"&gt;this&lt;/span&gt;.Loaded += ((s, e) =&amp;gt;
            {
                listBox1.ItemsSource = &lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;BadVirtualizedDataModel&lt;/span&gt;();
            }
        );
    }

    &lt;span style="color:blue;"&gt;private void &lt;/span&gt;txtSearch_TextChanged(&lt;span style="color:blue;"&gt;object &lt;/span&gt;sender, &lt;span style="color:#2b91af;"&gt;TextChangedEventArgs &lt;/span&gt;e)
    {
        &lt;span style="color:#2b91af;"&gt;DictionaryDatabaseContext &lt;/span&gt;dc = ((&lt;span style="color:#2b91af;"&gt;App&lt;/span&gt;)&lt;span style="color:#2b91af;"&gt;App&lt;/span&gt;.Current).DbDC;

        &lt;span style="color:blue;"&gt;var &lt;/span&gt;words = &lt;span style="color:blue;"&gt;from &lt;/span&gt;w &lt;span style="color:blue;"&gt;in &lt;/span&gt;dc.Words
                    &lt;span style="color:blue;"&gt;where &lt;/span&gt;w.WordTxt.StartsWith(txtSearch.Text)
                    &lt;span style="color:blue;"&gt;select &lt;/span&gt;w;

        &lt;span style="color:blue;"&gt;if &lt;/span&gt;(words.Count() == 0)
            &lt;span style="color:#2b91af;"&gt;MessageBox&lt;/span&gt;.Show(&lt;span style="color:#a31515;"&gt;&amp;quot;No matches&amp;quot;&lt;/span&gt;);
        &lt;span style="color:blue;"&gt;else
            &lt;/span&gt;listBox1.ScrollIntoView(words.First&amp;lt;&lt;span style="color:#2b91af;"&gt;Word&lt;/span&gt;&amp;gt;());
    }
}&lt;/pre&gt;&lt;pre class="code"&gt;&lt;/pre&gt;
&lt;p&gt;&lt;br /&gt;As you can see, the ListBox is bound to an instance of BadVirtualizedDataModel. Why is it bad? I’ll explain shortly….&lt;/p&gt;
&lt;p&gt;The class implements IList&amp;lt;Word&amp;gt; and as you can see below, it returns the count (which is cached since for some reason the ListBox asks for it multiple times). The indexer property uses some LINQ to SQL to fetch the item in the table at a particular index, and I write the time taken to the Debug Output window. The whole class looks like this:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color:blue;"&gt;using &lt;/span&gt;System;
&lt;span style="color:blue;"&gt;using &lt;/span&gt;System.Linq;
&lt;span style="color:blue;"&gt;using &lt;/span&gt;System.Collections;
&lt;span style="color:blue;"&gt;using &lt;/span&gt;System.Collections.Generic;
&lt;span style="color:blue;"&gt;using &lt;/span&gt;System.Diagnostics;

&lt;span style="color:blue;"&gt;namespace &lt;/span&gt;LargeDBAppSample.Model
{
    &lt;span style="color:blue;"&gt;public class &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;BadVirtualizedDataModel &lt;/span&gt;: &lt;span style="color:#2b91af;"&gt;IList&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af;"&gt;Word&lt;/span&gt;&amp;gt;
    {
        &lt;span style="color:blue;"&gt;private &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;DictionaryDatabaseContext &lt;/span&gt;dc = ((&lt;span style="color:#2b91af;"&gt;App&lt;/span&gt;)&lt;span style="color:#2b91af;"&gt;App&lt;/span&gt;.Current).DbDC;
        &lt;span style="color:blue;"&gt;int&lt;/span&gt;? cachedCount = &lt;span style="color:blue;"&gt;null&lt;/span&gt;;

        &lt;span style="color:blue;"&gt;public int &lt;/span&gt;Count
        {
            &lt;span style="color:blue;"&gt;get &lt;/span&gt;{
                &lt;span style="color:blue;"&gt;if &lt;/span&gt;(!cachedCount.HasValue)
                {
                    &lt;span style="color:blue;"&gt;var &lt;/span&gt;wordcount = dc.Words.Count();
                    cachedCount = wordcount;
                }
                &lt;span style="color:blue;"&gt;return &lt;/span&gt;cachedCount.Value; 
            }
        }

        &lt;span style="color:#2b91af;"&gt;Word IList&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af;"&gt;Word&lt;/span&gt;&amp;gt;.&lt;span style="color:blue;"&gt;this&lt;/span&gt;[&lt;span style="color:blue;"&gt;int &lt;/span&gt;index]
        {
            &lt;span style="color:blue;"&gt;get
            &lt;/span&gt;{
                &lt;span style="color:#2b91af;"&gt;Stopwatch &lt;/span&gt;sw = &lt;span style="color:#2b91af;"&gt;Stopwatch&lt;/span&gt;.StartNew();

                &lt;span style="color:blue;"&gt;var &lt;/span&gt;word = (&lt;span style="color:blue;"&gt;from &lt;/span&gt;w &lt;span style="color:blue;"&gt;in &lt;/span&gt;dc.Words
                            &lt;span style="color:blue;"&gt;orderby &lt;/span&gt;w.WordTxt
                            &lt;span style="color:blue;"&gt;select &lt;/span&gt;w).Skip(index).Take(1).First();
                
                &lt;span style="color:#2b91af;"&gt;Debug&lt;/span&gt;.WriteLine(&lt;span style="color:#a31515;"&gt;&amp;quot;Fetched {0} in {1}ms&amp;quot;&lt;/span&gt;, &lt;span style="color:blue;"&gt;new object&lt;/span&gt;[] { index, sw.ElapsedMilliseconds });
                &lt;span style="color:blue;"&gt;return &lt;/span&gt;word;
            }
            &lt;span style="color:blue;"&gt;set
            &lt;/span&gt;{
                &lt;span style="color:blue;"&gt;throw new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;NotImplementedException&lt;/span&gt;();
            }
        }

        &lt;span style="color:blue;"&gt;public int &lt;/span&gt;IndexOf(&lt;span style="color:#2b91af;"&gt;Word &lt;/span&gt;item)
        {
            &lt;span style="color:#2b91af;"&gt;Stopwatch &lt;/span&gt;sw = &lt;span style="color:#2b91af;"&gt;Stopwatch&lt;/span&gt;.StartNew();

            &lt;span style="color:blue;"&gt;var &lt;/span&gt;matches = (&lt;span style="color:blue;"&gt;from &lt;/span&gt;w &lt;span style="color:blue;"&gt;in &lt;/span&gt;dc.Words &lt;span style="color:blue;"&gt;select &lt;/span&gt;w).AsEnumerable()
                .Select((matchItem, index) =&amp;gt; &lt;span style="color:blue;"&gt;new &lt;/span&gt;{ Item = matchItem, Position = index })
                            .Where(x =&amp;gt; x.Item.WordTxt == item.WordTxt);

            &lt;span style="color:blue;"&gt;int &lt;/span&gt;position = matches.First().Position;

            &lt;span style="color:#2b91af;"&gt;Debug&lt;/span&gt;.WriteLine(&lt;span style="color:#a31515;"&gt;&amp;quot;Found position of {0} in {1}ms&amp;quot;&lt;/span&gt;, &lt;span style="color:blue;"&gt;new object&lt;/span&gt;[] { item.WordTxt, sw.ElapsedMilliseconds });

            &lt;span style="color:blue;"&gt;return &lt;/span&gt;position;
        }

        &lt;span style="color:blue;"&gt;#region &lt;/span&gt;NotRequired

        &lt;span style="color:blue;"&gt;public int &lt;/span&gt;Add(&lt;span style="color:blue;"&gt;object &lt;/span&gt;value)
        {
            &lt;span style="color:blue;"&gt;throw new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;NotImplementedException&lt;/span&gt;();
        }

        &lt;span style="color:blue;"&gt;public void &lt;/span&gt;Clear()
        {
            &lt;span style="color:blue;"&gt;throw new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;NotImplementedException&lt;/span&gt;();
        }

        &lt;span style="color:blue;"&gt;public bool &lt;/span&gt;Contains(&lt;span style="color:blue;"&gt;object &lt;/span&gt;value)
        {
            &lt;span style="color:blue;"&gt;throw new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;NotImplementedException&lt;/span&gt;();
        }

        &lt;span style="color:blue;"&gt;public void &lt;/span&gt;Insert(&lt;span style="color:blue;"&gt;int &lt;/span&gt;index, &lt;span style="color:blue;"&gt;object &lt;/span&gt;value)
        {
            &lt;span style="color:blue;"&gt;throw new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;NotImplementedException&lt;/span&gt;();
        }

        &lt;span style="color:blue;"&gt;public bool &lt;/span&gt;IsFixedSize
        {
            &lt;span style="color:blue;"&gt;get &lt;/span&gt;{ &lt;span style="color:blue;"&gt;throw new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;NotImplementedException&lt;/span&gt;(); }
        }

        &lt;span style="color:blue;"&gt;public bool &lt;/span&gt;IsReadOnly
        {
            &lt;span style="color:blue;"&gt;get &lt;/span&gt;{ &lt;span style="color:blue;"&gt;throw new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;NotImplementedException&lt;/span&gt;(); }
        }

        &lt;span style="color:blue;"&gt;public void &lt;/span&gt;RemoveAt(&lt;span style="color:blue;"&gt;int &lt;/span&gt;index)
        {
            &lt;span style="color:blue;"&gt;throw new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;NotImplementedException&lt;/span&gt;();
        }

        &lt;span style="color:blue;"&gt;public bool &lt;/span&gt;IsSynchronized
        {
            &lt;span style="color:blue;"&gt;get &lt;/span&gt;{ &lt;span style="color:blue;"&gt;throw new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;NotImplementedException&lt;/span&gt;(); }
        }

        &lt;span style="color:blue;"&gt;public object &lt;/span&gt;SyncRoot
        {
            &lt;span style="color:blue;"&gt;get &lt;/span&gt;{ &lt;span style="color:blue;"&gt;throw new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;NotImplementedException&lt;/span&gt;(); }
        }

        &lt;span style="color:blue;"&gt;public void &lt;/span&gt;Insert(&lt;span style="color:blue;"&gt;int &lt;/span&gt;index, &lt;span style="color:#2b91af;"&gt;Word &lt;/span&gt;item)
        {
            &lt;span style="color:blue;"&gt;throw new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;NotImplementedException&lt;/span&gt;();
        }

        &lt;span style="color:blue;"&gt;public void &lt;/span&gt;Add(&lt;span style="color:#2b91af;"&gt;Word &lt;/span&gt;item)
        {
            &lt;span style="color:blue;"&gt;throw new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;NotImplementedException&lt;/span&gt;();
        }

        &lt;span style="color:blue;"&gt;public bool &lt;/span&gt;Contains(&lt;span style="color:#2b91af;"&gt;Word &lt;/span&gt;item)
        {
            &lt;span style="color:blue;"&gt;throw new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;NotImplementedException&lt;/span&gt;();
        }

        &lt;span style="color:blue;"&gt;public void &lt;/span&gt;CopyTo(&lt;span style="color:#2b91af;"&gt;Word&lt;/span&gt;[] array, &lt;span style="color:blue;"&gt;int &lt;/span&gt;arrayIndex)
        {
            &lt;span style="color:blue;"&gt;throw new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;NotImplementedException&lt;/span&gt;();
        }

        &lt;span style="color:blue;"&gt;public bool &lt;/span&gt;Remove(&lt;span style="color:#2b91af;"&gt;Word &lt;/span&gt;item)
        {
            &lt;span style="color:blue;"&gt;throw new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;NotImplementedException&lt;/span&gt;();
        }

        &lt;span style="color:blue;"&gt;public &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;IEnumerator &lt;/span&gt;GetEnumerator()
        {
            &lt;span style="color:blue;"&gt;throw new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;NotImplementedException&lt;/span&gt;();
        }

        &lt;span style="color:#2b91af;"&gt;IEnumerator&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af;"&gt;Word&lt;/span&gt;&amp;gt; &lt;span style="color:#2b91af;"&gt;IEnumerable&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af;"&gt;Word&lt;/span&gt;&amp;gt;.GetEnumerator()
        {
            &lt;span style="color:blue;"&gt;throw new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;NotImplementedException&lt;/span&gt;();
        }

        &lt;span style="color:blue;"&gt;#endregion
    &lt;/span&gt;}
}

&lt;/pre&gt;
&lt;p&gt;So when you run this, first impressions are very favorable. The list appears in no time at all, scrolling up and down the list is really fast, and memory usage is only about 24MB. Looks great!&lt;/p&gt;
&lt;p&gt;&lt;a href="http://mobileworld.appamundi.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/andywigley/L2S_2D00_Bad_5F00_38F3EB92.png"&gt;&lt;img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="L2S Bad" border="0" alt="L2S Bad" src="http://mobileworld.appamundi.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/andywigley/L2S_2D00_Bad_5F00_thumb_5F00_496B9AE6.png" width="587" height="489" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;However, everything is not as good as it seems. This is illustrated if you type a letter from later in the alphabet, such as ‘t’ into the Search box. Look at what is reported in the output window now:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://mobileworld.appamundi.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/andywigley/L2S_2D00_Bad_2D00_Search_5F00_4816DC3A.png"&gt;&lt;img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="L2S Bad Search" border="0" alt="L2S Bad Search" src="http://mobileworld.appamundi.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/andywigley/L2S_2D00_Bad_2D00_Search_5F00_thumb_5F00_3C1199AE.png" width="677" height="492" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;There are two lines starting ‘Found Position…’ each taking over 4.3 seconds, and further down the ‘Fetched…’ lines report how long it takes to get an item from the collection at a particular index are now taking over 370ms each. From this point on, scroll performance of the ListBox is terrible. What is going on?&lt;/p&gt;
&lt;p&gt;The code that is executing here is firstly the TextChanged event handler finds the first word in the table that begins with the letters entered into the Search textbox:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color:blue;"&gt;private void &lt;/span&gt;txtSearch_TextChanged(&lt;span style="color:blue;"&gt;object &lt;/span&gt;sender, &lt;span style="color:#2b91af;"&gt;TextChangedEventArgs &lt;/span&gt;e)
{
    &lt;span style="color:#2b91af;"&gt;DictionaryDatabaseContext &lt;/span&gt;dc = ((&lt;span style="color:#2b91af;"&gt;App&lt;/span&gt;)&lt;span style="color:#2b91af;"&gt;App&lt;/span&gt;.Current).DbDC;

    &lt;span style="color:blue;"&gt;var &lt;/span&gt;words = &lt;span style="color:blue;"&gt;from &lt;/span&gt;w &lt;span style="color:blue;"&gt;in &lt;/span&gt;dc.Words
                &lt;span style="color:blue;"&gt;where &lt;/span&gt;w.WordTxt.StartsWith(txtSearch.Text)
                &lt;span style="color:blue;"&gt;select &lt;/span&gt;w;

    &lt;span style="color:blue;"&gt;if &lt;/span&gt;(words.Count() == 0)
        &lt;span style="color:#2b91af;"&gt;MessageBox&lt;/span&gt;.Show(&lt;span style="color:#a31515;"&gt;&amp;quot;No matches&amp;quot;&lt;/span&gt;);
    &lt;span style="color:blue;"&gt;else
        &lt;/span&gt;listBox1.ScrollIntoView(words.First&amp;lt;&lt;span style="color:#2b91af;"&gt;Word&lt;/span&gt;&amp;gt;());
}
&lt;/pre&gt;
&lt;p&gt;The lookup is really fast because it is doing a lookup on the WordTxt field which is the primary key. &lt;/p&gt;
&lt;p&gt;However, once we have found our word, we call the ListBox.ScrollIntoView(object) method to cause the ListBox to scroll to display the first matching word. The way the ListBox does this is to first call the IndexOf(Word item) method of the data collection to find the index in the collection of the desired item (which it does twice for some reason), and then to call the indexer as normal to pull the required items out of the collection. It is the IndexOf() method that is reporting the 4.3 second search times and the indexer that is reporting times of over 370ms.&lt;/p&gt;
&lt;p&gt;The problem here is that an index in a SQL Server Compact Edition database (the underlying database for LINQ to SQL on Windows Phone) is not optimised for random access. There is no efficient way of getting the 109,456th item out of an index. The code used in the indexer is actually an adaptation of what is in the MSDN Windows Phone documentation, topic &lt;a href="http://msdn.microsoft.com/en-us/library/hh286406(v=VS.92).aspx"&gt;Local Database Best Practices for Windows Phone&lt;/a&gt;, which states:&lt;/p&gt;
&lt;h4&gt;&lt;em&gt;&lt;font style="font-weight:bold;"&gt;Use of Data Virtualization and Skip/Take&lt;/font&gt;&lt;/em&gt;&lt;/h4&gt;
&lt;p&gt;&lt;em&gt;With ListBox controls, you can use the Skip and Take methods to enable fetching of the appropriate batches of items as the user scrolls through the list. For more information about enabling data virtualization on data-bound ListBox controls, see &lt;/em&gt;&lt;a href="http://shawnoster.com/blog/post/Improving-ListBox-Performance-in-Silverlight-for-Windows-Phone-7-Data-Virtualization.aspx"&gt;&lt;em&gt;Improving ListBox Performance in Silverlight for Windows Phone 7: Data Virtualization&lt;/em&gt;&lt;/a&gt;&lt;em&gt;.&lt;/em&gt; 
&lt;p&gt;&lt;em&gt;Using the Skip and Take methods ensures that data will not be loaded from the database into memory until it is needed for display in the ListBox control. For example, the following code shows how to retrieve records 501 to 550 from the database.&lt;/em&gt; 
&lt;p&gt;&lt;a&gt;&lt;em&gt;C#&lt;/em&gt;&lt;/a&gt;&lt;pre&gt;&lt;em&gt;return
(from f in App.FeedsDB.Feeds                    
select f).Skip(500).Take(50);
&lt;/em&gt;&lt;/pre&gt;
&lt;p&gt;&lt;em&gt;&lt;/em&gt;&amp;nbsp; &lt;p&gt;&lt;em&gt;Be&lt;/em&gt;&lt;em&gt;cause there is cost to performing this load operation as the user scrolls through the list, this technique should be limited to scenarios where the data set is large (greater than 150 items). For smaller data sets, loading the entire collection into memory and binding to it there is likely to yield better performance.&lt;/em&gt; 
&lt;p&gt;In actual fact, this best practice advice should be qualified by saying that it should not be used for collections of greater than perhaps 1000. What is actually happening here is that internally, the database engine is having to walk the record collection to implement the Skip(n) part of it. So while it is true to say that the skipped records are not loaded from the database into memory, the database engine is still having to do a great deal of work to identify the record(s) it does need to materialize into memory. 
&lt;p&gt;Our indexer looks like this: 
&lt;p&gt;&lt;span style="color:blue;"&gt;var &lt;/span&gt;word = (&lt;span style="color:blue;"&gt;from &lt;/span&gt;w &lt;span style="color:blue;"&gt;in &lt;/span&gt;dc.Words &lt;span style="color:blue;"&gt;orderby &lt;/span&gt;w.WordTxt &lt;span style="color:blue;"&gt;select &lt;/span&gt;w).Skip(index).Take(1).First(); 
&lt;p&gt;However the real damage is being done by the IndexOf() method implementation:&lt;pre class="code"&gt;&lt;span style="color:blue;"&gt;public int &lt;/span&gt;IndexOf(&lt;span style="color:#2b91af;"&gt;Word &lt;/span&gt;item)
{
    &lt;span style="color:#2b91af;"&gt;Stopwatch &lt;/span&gt;sw = &lt;span style="color:#2b91af;"&gt;Stopwatch&lt;/span&gt;.StartNew();

    &lt;span style="color:blue;"&gt;var &lt;/span&gt;matches = (&lt;span style="color:blue;"&gt;from &lt;/span&gt;w &lt;span style="color:blue;"&gt;in &lt;/span&gt;dc.Words &lt;span style="color:blue;"&gt;select &lt;/span&gt;w).AsEnumerable()
        .Select((matchItem, index) =&amp;gt; &lt;span style="color:blue;"&gt;new &lt;/span&gt;{ Item = matchItem, Position = index })
                    .Where(x =&amp;gt; x.Item.WordTxt == item.WordTxt);

    &lt;span style="color:blue;"&gt;int &lt;/span&gt;position = matches.First().Position;

    &lt;span style="color:#2b91af;"&gt;Debug&lt;/span&gt;.WriteLine(&lt;span style="color:#a31515;"&gt;&amp;quot;Found position of {0} in {1}ms&amp;quot;&lt;/span&gt;, &lt;span style="color:blue;"&gt;new object&lt;/span&gt;[] { item.WordTxt, sw.ElapsedMilliseconds });

    &lt;span style="color:blue;"&gt;return &lt;/span&gt;position;
}
&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;This code was taken from a number of posts found in searches on the internet and while it works well enough, it also causes the database engine to work very hard to give us our result. The only good news with all of this is that memory utilisation remains low at 24MB but that’s no substitute for the terrible performance which makes this solution unusable.&lt;/p&gt;
&lt;h3&gt;Option 3: Data Virtualization – Better Implementation&lt;/h3&gt;
&lt;p&gt;The second and third buttons on the main page takes you to two different pages that use a workable implementation of data virtualization. Each shows a different solution to this problem of needing a random access index to a database table. The Good virtualization button takes you to a page that is the same as the one we have just used in the previous example, with the exception that when the page loads, the page calls the BeginInitialize() method on our GoodVirtualizedDataModel class which builds an in-memory lookup table to allow us to easily find the index of a word in the collection. In the form, the page initialization logic looks like this:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color:blue;"&gt;public partial class &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;GoodDataVirtualizationPage &lt;/span&gt;: &lt;span style="color:#2b91af;"&gt;PhoneApplicationPage
&lt;/span&gt;{
    &lt;span style="color:blue;"&gt;public &lt;/span&gt;GoodDataVirtualizationPage()
    {
        InitializeComponent();

        &lt;span style="color:blue;"&gt;this&lt;/span&gt;.Loaded += ((s, e) =&amp;gt;
        {
            listBox1.ItemsSource = &lt;span style="color:blue;"&gt;null&lt;/span&gt;;

            &lt;span style="color:blue;"&gt;var &lt;/span&gt;vDM = &lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;GoodVirtualizedDataModel&lt;/span&gt;();
            vDM.InitializeCompleted += (ss, ee) =&amp;gt;
                {
                    listBox1.ItemsSource = vDM;
                    &lt;span style="color:#2b91af;"&gt;SystemTray&lt;/span&gt;.ProgressIndicator.IsVisible = &lt;span style="color:blue;"&gt;false&lt;/span&gt;;
                };

            vDM.BeginInitialize();
            &lt;span style="color:blue;"&gt;var &lt;/span&gt;pi = &lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;ProgressIndicator&lt;/span&gt;();
            pi.IsIndeterminate = &lt;span style="color:blue;"&gt;true&lt;/span&gt;;
            pi.Text = &lt;span style="color:#a31515;"&gt;&amp;quot;Initializing..&amp;quot;&lt;/span&gt;;
            pi.IsVisible = &lt;span style="color:blue;"&gt;true&lt;/span&gt;;
            &lt;span style="color:#2b91af;"&gt;SystemTray&lt;/span&gt;.ProgressIndicator = pi;
        }
        );
    }
&lt;/pre&gt;
&lt;p&gt;…&lt;/p&gt;
&lt;p&gt;The GoodVirtualizedDataModel class has a private List&amp;lt;string&amp;gt; field called inMemoryLookup and this is what is initialized by the BeginInitialize() method. That uses a BackgroundWorker to do the work on a background thread, but all it is doing is extracting just the WordTxt field (which is the primary key field) from every Word object in the database and inserting it into the List&amp;lt;string&amp;gt;:&lt;/p&gt;&lt;pre class="code"&gt;inMemoryLookup = (&lt;span style="color:blue;"&gt;from &lt;/span&gt;w &lt;span style="color:blue;"&gt;in &lt;/span&gt;dc.Words
                   &lt;span style="color:blue;"&gt;orderby &lt;/span&gt;w.WordTxt
                   &lt;span style="color:blue;"&gt;select &lt;/span&gt;w.WordTxt).ToList&amp;lt;&lt;span style="color:blue;"&gt;string&lt;/span&gt;&amp;gt;();
&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Then in the indexer, instead of the costly .Skip(n).Take(1) operation, the code simply takes the index of the item that is passed in, uses it to fetch the object at that index from the inMemoryLookup collection and that gives it the primary key (the WordTxt) at that index which it uses to do an efficient primary key lookup for the required word:&lt;/p&gt;&lt;span style="color:blue;"&gt;&lt;pre class="code"&gt;&lt;span style="color:#2b91af;"&gt;Word IList&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af;"&gt;Word&lt;/span&gt;&amp;gt;.&lt;span style="color:blue;"&gt;this&lt;/span&gt;[&lt;span style="color:blue;"&gt;int &lt;/span&gt;index]
{
    &lt;span style="color:blue;"&gt;get
    &lt;/span&gt;{
        &lt;span style="color:blue;"&gt;var &lt;/span&gt;word = &lt;span style="color:blue;"&gt;from &lt;/span&gt;w &lt;span style="color:blue;"&gt;in &lt;/span&gt;dc.Words
                   &lt;span style="color:blue;"&gt;where &lt;/span&gt;w.WordTxt == inMemoryLookup[index]
                   &lt;span style="color:blue;"&gt;select &lt;/span&gt;w;
        &lt;span style="color:blue;"&gt;return &lt;/span&gt;word.First&amp;lt;&lt;span style="color:#2b91af;"&gt;Word&lt;/span&gt;&amp;gt;();
    }
    &lt;span style="color:blue;"&gt;set
    &lt;/span&gt;{
        &lt;span style="color:blue;"&gt;throw new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;NotImplementedException&lt;/span&gt;();
    }
}
&lt;/pre&gt;&lt;/span&gt;
&lt;p&gt;&lt;font face="Courier New"&gt;&lt;/font&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;In actual fact, as a further optimisation, instead of executing the same query every time the indexer Getter is called, the implementation in the sample uses a Compiled Query to avoid the overhead of the query processor doing the same query analysis on every call. This is the full class:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color:blue;"&gt;using &lt;/span&gt;System;
&lt;span style="color:blue;"&gt;using &lt;/span&gt;System.Linq;
&lt;span style="color:blue;"&gt;using &lt;/span&gt;System.Collections;
&lt;span style="color:blue;"&gt;using &lt;/span&gt;System.Collections.Generic;
&lt;span style="color:blue;"&gt;using &lt;/span&gt;System.Diagnostics;
&lt;span style="color:blue;"&gt;using &lt;/span&gt;System.ComponentModel;

&lt;span style="color:blue;"&gt;namespace &lt;/span&gt;LargeDBAppSample.Model
{
    &lt;span style="color:blue;"&gt;public class &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;GoodVirtualizedDataModel &lt;/span&gt;: &lt;span style="color:#2b91af;"&gt;IList&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af;"&gt;Word&lt;/span&gt;&amp;gt;
    {
        &lt;span style="color:blue;"&gt;private &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;DictionaryDatabaseContext &lt;/span&gt;dc = ((&lt;span style="color:#2b91af;"&gt;App&lt;/span&gt;)&lt;span style="color:#2b91af;"&gt;App&lt;/span&gt;.Current).DbDC;
        &lt;span style="color:blue;"&gt;int&lt;/span&gt;? cachedCount = &lt;span style="color:blue;"&gt;null&lt;/span&gt;;
        &lt;span style="color:blue;"&gt;private &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color:blue;"&gt;string&lt;/span&gt;&amp;gt; inMemoryLookup;
        &lt;span style="color:blue;"&gt;private &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;Dictionary&lt;/span&gt;&amp;lt;&lt;span style="color:blue;"&gt;string&lt;/span&gt;, &lt;span style="color:blue;"&gt;int&lt;/span&gt;&amp;gt; cachedPositions = &lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;Dictionary&lt;/span&gt;&amp;lt;&lt;span style="color:blue;"&gt;string&lt;/span&gt;,&lt;span style="color:blue;"&gt;int&lt;/span&gt;&amp;gt;();

        &lt;span style="color:blue;"&gt;public event &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;EventHandler &lt;/span&gt;InitializeCompleted;

        &lt;span style="color:blue;"&gt;public void &lt;/span&gt;BeginInitialize()
        {
            &lt;span style="color:#2b91af;"&gt;BackgroundWorker &lt;/span&gt;worker = &lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;BackgroundWorker&lt;/span&gt;();
            worker.DoWork += (s, e) =&amp;gt;
            {
                inMemoryLookup = (&lt;span style="color:blue;"&gt;from &lt;/span&gt;w &lt;span style="color:blue;"&gt;in &lt;/span&gt;dc.Words
                                  &lt;span style="color:blue;"&gt;orderby &lt;/span&gt;w.WordTxt
                                  &lt;span style="color:blue;"&gt;select &lt;/span&gt;w.WordTxt).ToList&amp;lt;&lt;span style="color:blue;"&gt;string&lt;/span&gt;&amp;gt;();

            };
            worker.RunWorkerCompleted += (s, e) =&amp;gt;
            {
                &lt;span style="color:blue;"&gt;if &lt;/span&gt;(InitializeCompleted != &lt;span style="color:blue;"&gt;null&lt;/span&gt;)
                {
                    InitializeCompleted(&lt;span style="color:blue;"&gt;this&lt;/span&gt;, &lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;EventArgs&lt;/span&gt;());
                }
            };
            worker.RunWorkerAsync();
        }

        &lt;span style="color:blue;"&gt;public int &lt;/span&gt;Count
        {
            &lt;span style="color:blue;"&gt;get &lt;/span&gt;{
                &lt;span style="color:blue;"&gt;if &lt;/span&gt;(!cachedCount.HasValue)
                {
                    &lt;span style="color:blue;"&gt;var &lt;/span&gt;wordcount = dc.Words.Count();
                    cachedCount = wordcount;
                }
                &lt;span style="color:blue;"&gt;return &lt;/span&gt;cachedCount.Value; 
            }
        }

        &lt;span style="color:green;"&gt;// Prepare a compiled query for optimum performance
        &lt;/span&gt;&lt;span style="color:blue;"&gt;public static &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;Func&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af;"&gt;DictionaryDatabaseContext&lt;/span&gt;, &lt;span style="color:blue;"&gt;string&lt;/span&gt;, &lt;span style="color:#2b91af;"&gt;IQueryable&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af;"&gt;Word&lt;/span&gt;&amp;gt;&amp;gt; SelectedByIndexWordResult =
            System.Data.Linq.&lt;span style="color:#2b91af;"&gt;CompiledQuery&lt;/span&gt;.Compile(
            (&lt;span style="color:#2b91af;"&gt;DictionaryDatabaseContext &lt;/span&gt;dc, &lt;span style="color:blue;"&gt;string &lt;/span&gt;theWord) =&amp;gt;
                 &lt;span style="color:blue;"&gt;from &lt;/span&gt;w &lt;span style="color:blue;"&gt;in &lt;/span&gt;dc.Words
                 &lt;span style="color:blue;"&gt;where &lt;/span&gt;w.WordTxt == theWord
                 &lt;span style="color:blue;"&gt;select &lt;/span&gt;w
                 );

        &lt;span style="color:#2b91af;"&gt;Word IList&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af;"&gt;Word&lt;/span&gt;&amp;gt;.&lt;span style="color:blue;"&gt;this&lt;/span&gt;[&lt;span style="color:blue;"&gt;int &lt;/span&gt;index]
        {
            &lt;span style="color:blue;"&gt;get
            &lt;/span&gt;{
                &lt;span style="color:green;"&gt;//var word = from w in dc.Words
                //           where w.WordTxt == inMemoryLookup[index]
                //           select w;
                //return word.First&amp;lt;Word&amp;gt;();

                &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;Stopwatch &lt;/span&gt;sw = &lt;span style="color:#2b91af;"&gt;Stopwatch&lt;/span&gt;.StartNew();
                &lt;span style="color:blue;"&gt;var &lt;/span&gt;word = SelectedByIndexWordResult(dc, inMemoryLookup[index]).First&amp;lt;&lt;span style="color:#2b91af;"&gt;Word&lt;/span&gt;&amp;gt;();
                &lt;span style="color:#2b91af;"&gt;Debug&lt;/span&gt;.WriteLine(&lt;span style="color:#a31515;"&gt;&amp;quot;Fetched {0} in {1}ms&amp;quot;&lt;/span&gt;, &lt;span style="color:blue;"&gt;new object&lt;/span&gt;[] { index, sw.ElapsedMilliseconds });

                &lt;span style="color:blue;"&gt;return &lt;/span&gt;word;
            }
            &lt;span style="color:blue;"&gt;set
            &lt;/span&gt;{
                &lt;span style="color:blue;"&gt;throw new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;NotImplementedException&lt;/span&gt;();
            }
        }

        &lt;span style="color:blue;"&gt;public int &lt;/span&gt;IndexOf(&lt;span style="color:#2b91af;"&gt;Word &lt;/span&gt;item)
        {
            &lt;span style="color:#2b91af;"&gt;Stopwatch &lt;/span&gt;sw = &lt;span style="color:#2b91af;"&gt;Stopwatch&lt;/span&gt;.StartNew();
            &lt;span style="color:blue;"&gt;int &lt;/span&gt;position;

            &lt;span style="color:blue;"&gt;if &lt;/span&gt;(cachedPositions.ContainsKey(item.WordTxt))
            {
                position = cachedPositions[item.WordTxt];
            }
            &lt;span style="color:blue;"&gt;else
            &lt;/span&gt;{
                &lt;span style="color:blue;"&gt;var &lt;/span&gt;matches = inMemoryLookup
                    .Select((matchItem, index) =&amp;gt; &lt;span style="color:blue;"&gt;new &lt;/span&gt;{ theWord = matchItem, Position = index })
                                .Where(x =&amp;gt; x.theWord == item.WordTxt);

                position = matches.First().Position;

                cachedPositions[item.WordTxt] = position;
            }

            &lt;span style="color:#2b91af;"&gt;Debug&lt;/span&gt;.WriteLine(&lt;span style="color:#a31515;"&gt;&amp;quot;Found position of {0} in {1}ms&amp;quot;&lt;/span&gt;, &lt;span style="color:blue;"&gt;new object&lt;/span&gt;[] { item.WordTxt, sw.ElapsedMilliseconds });

            &lt;span style="color:blue;"&gt;return &lt;/span&gt;position;
        }

        &lt;span style="color:blue;"&gt;#region &lt;/span&gt;NotRequired

        ...&lt;/pre&gt;&lt;pre class="code"&gt;        &lt;span style="color:blue;"&gt;#endregion
    &lt;/span&gt;}
}&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Using this in-memory lookup table, the results are impressive:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://mobileworld.appamundi.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/andywigley/L2S_2D00_Good_2D00_InMemory_5F00_6E84D153.png"&gt;&lt;img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="L2S Good InMemory" border="0" alt="L2S Good InMemory" src="http://mobileworld.appamundi.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/andywigley/L2S_2D00_Good_2D00_InMemory_5F00_thumb_5F00_7E904DB2.png" width="697" height="526" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Of course, everything comes with a price. Using this in memory lookup, the building of the in-memory lookup takes 10-15 seconds on a device so you’ll have to show some ‘Please wait’ UI (I use a progress bar) or do it on a background thread while your user is still in the opening screens of your app. The lookup table also takes quite a lot of memory – up to 54MB with this sample set, which is not so bad, but in some earlier tests I did with 500000 items, my in-memory lookup was causing me to exceed the 90MB memory threshold. On the plus side, because the in-memory lookup is well – in memory – it’s easily updated if your app allows items to be added, edited or deleted from the main table.&lt;/p&gt;
&lt;h3&gt;Option 3: Data Virtualization – Best Implementation&lt;/h3&gt;
&lt;p&gt;So what do you do if you don’t want to have your users wait while you build the in-memory lookup index? Or you can’t afford the memory that the lookup table requires?&lt;/p&gt;
&lt;p&gt;Well, one solution is to let the database do the work for you, and this is what the final option demonstrates. Remember that third column, Sequence, that I said I would come back to? That is performing the same role as an in-memory lookup but instead it’s stored in the data base as well. I wrote a desktop utility program that prepared this database by fetching all the records using the primary key – in other words giving me the Words in alphabetical order – and then sets the Sequence field of each to its position in the collection. I then created a secondary key on the Sequence field (again before including the database in this project), so now I have a fast lookup of words both by WordTxt (the primary key) and by index (the secondary key).&lt;/p&gt;
&lt;p&gt;Using this, the final version of my virtualized data model looks like this:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color:blue;"&gt;using &lt;/span&gt;System;
&lt;span style="color:blue;"&gt;using &lt;/span&gt;System.Linq;
&lt;span style="color:blue;"&gt;using &lt;/span&gt;System.Collections;
&lt;span style="color:blue;"&gt;using &lt;/span&gt;System.Collections.Generic;
&lt;span style="color:blue;"&gt;using &lt;/span&gt;System.Diagnostics;

&lt;span style="color:blue;"&gt;namespace &lt;/span&gt;LargeDBAppSample.Model
{
    &lt;span style="color:blue;"&gt;public class &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;BestVirtualizedDataModel &lt;/span&gt;: &lt;span style="color:#2b91af;"&gt;IList&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af;"&gt;Word&lt;/span&gt;&amp;gt;
    {
        &lt;span style="color:blue;"&gt;private &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;DictionaryDatabaseContext &lt;/span&gt;dc = ((&lt;span style="color:#2b91af;"&gt;App&lt;/span&gt;)&lt;span style="color:#2b91af;"&gt;App&lt;/span&gt;.Current).DbDC;
        &lt;span style="color:blue;"&gt;int&lt;/span&gt;? cachedCount = &lt;span style="color:blue;"&gt;null&lt;/span&gt;;
        &lt;span style="color:blue;"&gt;private &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;Dictionary&lt;/span&gt;&amp;lt;&lt;span style="color:blue;"&gt;string&lt;/span&gt;, &lt;span style="color:blue;"&gt;int&lt;/span&gt;&amp;gt; cachedPositions = &lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;Dictionary&lt;/span&gt;&amp;lt;&lt;span style="color:blue;"&gt;string&lt;/span&gt;,&lt;span style="color:blue;"&gt;int&lt;/span&gt;&amp;gt;();

        &lt;span style="color:blue;"&gt;public int &lt;/span&gt;Count
        {
            &lt;span style="color:blue;"&gt;get &lt;/span&gt;{
                &lt;span style="color:blue;"&gt;if &lt;/span&gt;(!cachedCount.HasValue)
                {
                    &lt;span style="color:blue;"&gt;var &lt;/span&gt;wordcount = dc.Words.Count();
                    cachedCount = wordcount;
                }
                &lt;span style="color:blue;"&gt;return &lt;/span&gt;cachedCount.Value; 
            }
        }

        &lt;span style="color:green;"&gt;// Prepare a compiled query for optimum performance
        &lt;/span&gt;&lt;span style="color:blue;"&gt;public static &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;Func&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af;"&gt;DictionaryDatabaseContext&lt;/span&gt;, &lt;span style="color:blue;"&gt;int&lt;/span&gt;, &lt;span style="color:#2b91af;"&gt;IQueryable&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af;"&gt;Word&lt;/span&gt;&amp;gt;&amp;gt; SelectedBySecondaryIndexWordResult =
            System.Data.Linq.&lt;span style="color:#2b91af;"&gt;CompiledQuery&lt;/span&gt;.Compile(
            (&lt;span style="color:#2b91af;"&gt;DictionaryDatabaseContext &lt;/span&gt;dc, &lt;span style="color:blue;"&gt;int &lt;/span&gt;theIndex) =&amp;gt;
                 &lt;span style="color:blue;"&gt;from &lt;/span&gt;w &lt;span style="color:blue;"&gt;in &lt;/span&gt;dc.Words
                           &lt;span style="color:blue;"&gt;where &lt;/span&gt;w.Sequence == theIndex
                           &lt;span style="color:blue;"&gt;select &lt;/span&gt;w
                 );

        &lt;span style="color:#2b91af;"&gt;Word IList&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af;"&gt;Word&lt;/span&gt;&amp;gt;.&lt;span style="color:blue;"&gt;this&lt;/span&gt;[&lt;span style="color:blue;"&gt;int &lt;/span&gt;index]
        {
            &lt;span style="color:blue;"&gt;get
            &lt;/span&gt;{
                &lt;span style="color:#2b91af;"&gt;Stopwatch &lt;/span&gt;sw = &lt;span style="color:#2b91af;"&gt;Stopwatch&lt;/span&gt;.StartNew();

                &lt;span style="color:green;"&gt;//var word = from w in dc.Words
                //           where w.Sequence == index
                //           select w;
                //return word.First&amp;lt;Word&amp;gt;();

                &lt;/span&gt;&lt;span style="color:blue;"&gt;var &lt;/span&gt;word = SelectedBySecondaryIndexWordResult(dc, index).First&amp;lt;&lt;span style="color:#2b91af;"&gt;Word&lt;/span&gt;&amp;gt;();
                &lt;span style="color:#2b91af;"&gt;Debug&lt;/span&gt;.WriteLine(&lt;span style="color:#a31515;"&gt;&amp;quot;Fetched {0} in {1}ms&amp;quot;&lt;/span&gt;, &lt;span style="color:blue;"&gt;new object&lt;/span&gt;[] { index, sw.ElapsedMilliseconds });

                &lt;span style="color:blue;"&gt;return &lt;/span&gt;word;
            }
            &lt;span style="color:blue;"&gt;set
            &lt;/span&gt;{
                &lt;span style="color:blue;"&gt;throw new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;NotImplementedException&lt;/span&gt;();
            }
        }

        &lt;span style="color:blue;"&gt;public int &lt;/span&gt;IndexOf(&lt;span style="color:#2b91af;"&gt;Word &lt;/span&gt;item)
        {
            &lt;span style="color:#2b91af;"&gt;Stopwatch &lt;/span&gt;sw = &lt;span style="color:#2b91af;"&gt;Stopwatch&lt;/span&gt;.StartNew();
            &lt;span style="color:blue;"&gt;int &lt;/span&gt;position;

            &lt;span style="color:blue;"&gt;if &lt;/span&gt;(cachedPositions.ContainsKey(item.WordTxt))
            {
                position = cachedPositions[item.WordTxt];
            }
            &lt;span style="color:blue;"&gt;else
            &lt;/span&gt;{
                position = (&lt;span style="color:blue;"&gt;from &lt;/span&gt;w &lt;span style="color:blue;"&gt;in &lt;/span&gt;dc.Words
                           &lt;span style="color:blue;"&gt;where &lt;/span&gt;w.WordTxt == item.WordTxt
                           &lt;span style="color:blue;"&gt;select &lt;/span&gt;w.Sequence).First();

                cachedPositions[item.WordTxt] = position;
            }

            &lt;span style="color:#2b91af;"&gt;Debug&lt;/span&gt;.WriteLine(&lt;span style="color:#a31515;"&gt;&amp;quot;Found position of {0} in {1}ms&amp;quot;&lt;/span&gt;, &lt;span style="color:blue;"&gt;new object&lt;/span&gt;[] { item.WordTxt, sw.ElapsedMilliseconds });

            &lt;span style="color:blue;"&gt;return &lt;/span&gt;position;
        }

        &lt;span style="color:blue;"&gt;#region &lt;/span&gt;NotRequired

        ...&lt;/pre&gt;&lt;pre class="code"&gt;        &lt;span style="color:blue;"&gt;#endregion
    &lt;/span&gt;}
}
&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The results speak for themselves:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://mobileworld.appamundi.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/andywigley/L2S_2D00_Best_5F00_26CF5A3A.png"&gt;&lt;img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="L2S Best" border="0" alt="L2S Best" src="http://mobileworld.appamundi.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/andywigley/L2S_2D00_Best_5F00_thumb_5F00_4AF3F322.png" width="594" height="442" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Memory usage here is around 23MB.&lt;/p&gt;
&lt;p&gt;So when not to use this option? Well, this only really works with read-only collections where you can get the Sequence numbers correct in the table before transferring to the device. It won’t work if you start inserting or removing records or changing the ordering – not without having to do massive data updates that would negate the benefit of the approach.&lt;/p&gt;
&lt;h2&gt;Summary&lt;/h2&gt;
&lt;p&gt;These examples have shown how to bind a very large collection of records from a local database table to a ListBox. This is rarely a great idea from a user experience point of view, unless you implement some kind of search as I have done in these examples. [An aside: my original intention had been to show a sample using the LongListSelector from the Silverlight Toolkit, configured as a JumpList, but that control does not support data virtualization, despite claims in a few blogs from the team to the contrary &lt;img style="border-bottom-style:none;border-left-style:none;border-top-style:none;border-right-style:none;" class="wlEmoticon wlEmoticon-thinkingsmile" alt="Thinking smile" src="http://mobileworld.appamundi.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/andywigley/wlEmoticon_2D00_thinkingsmile_5F00_27479EFD.png" /&gt;.] Nonetheless, a virtualized data source can be used in other situations where you want to avoid materializing all the records from a large table into memory.&lt;/p&gt;
&lt;p&gt;So if you are going to implement a virtualized data source, beware of the .Skip(n).Take(n1) syntax recommended by the MSDN docs – that does not work with large collections as it makes the database engine struggle as you get down towards the bottom of the list.&lt;/p&gt;
&lt;p&gt;Instead, implement your own way of efficiently determining the position of an item in the list, either by an in-memory lookup collection, or if your data is read-only by embedding positional information into a column in the database table and configuring it as a secondary index.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://skydrive.live.com/redir.aspx?cid=b36de4dd5a9179a1&amp;amp;resid=B36DE4DD5A9179A1!1334&amp;amp;parid=B36DE4DD5A9179A1!1333"&gt;Download the sample project&lt;/a&gt; (around 50MB)&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h5&gt;Footnote:&lt;/h5&gt;
&lt;p&gt;I built this sample database using some excellent tools that deserve calling out. Firstly, I created a ‘big SQL’ database in SQL Express and designed my Word table. I then generated the random data using Red Gate’s excellent &lt;a href="http://www.red-gate.com/products/sql-development/sql-data-generator/"&gt;SQL Data Generator&lt;/a&gt;, part of their SQL Toolbelt product set. They have a 14 day free trial, which was just long enough while I was working on this post!&lt;/p&gt;
&lt;p&gt;I then scripted all the data and schema suitable for loading into a SQL Server Compact Edition 3.5 database using the free SQL export and script utility called Export2SQLCE, available &lt;a href="http://exportsqlce.codeplex.com/"&gt;here on Codeplex&lt;/a&gt;. Thanks Erik for these amazing (and free!) tools. Then it was back to SQL Server Management Studio to create an empty SQL Server Compact Edition 3.5 database and to execute all the scripts that Export2SQLCE had created for me. After this I had a database I could use on Windows Phone. I ran a small console app to set the sequence number in the table.&lt;/p&gt;
&lt;p&gt;Last part of the jigsaw was to generate the DataContext. I could have used SQLMetal utility for that, but I prefer to use another of Erik’s free tools, this time the &lt;a href="http://sqlcetoolbox.codeplex.com/"&gt;SQL Server Compact Toolbox&lt;/a&gt; which allows you to create a data context (amongst many other things).&lt;/p&gt;
&lt;p&gt;Thanks guys for these tools!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://mobileworld.appamundi.com/aggbug.aspx?PostID=423" width="1" height="1"&gt;</description><category domain="http://mobileworld.appamundi.com/blogs/andywigley/archive/tags/Silverlight/default.aspx">Silverlight</category><category domain="http://mobileworld.appamundi.com/blogs/andywigley/archive/tags/Windows+Phone+7/default.aspx">Windows Phone 7</category><category domain="http://mobileworld.appamundi.com/blogs/andywigley/archive/tags/wp7dev/default.aspx">wp7dev</category><category domain="http://mobileworld.appamundi.com/blogs/andywigley/archive/tags/SQL+Server+Compact+Edition/default.aspx">SQL Server Compact Edition</category><category domain="http://mobileworld.appamundi.com/blogs/andywigley/archive/tags/Linq+to+Sql/default.aspx">Linq to Sql</category></item><item><title>Submitting Apps to Marketplace with Background Tasks</title><link>http://mobileworld.appamundi.com/blogs/peterfoot/archive/2011/12/08/submitting-apps-to-marketplace-with-background-tasks.aspx</link><pubDate>Thu, 08 Dec 2011 11:38:00 GMT</pubDate><guid isPermaLink="false">989b12f5-6f26-47d9-9f0d-67fe982b88db:413</guid><dc:creator>Peter Foot</dc:creator><slash:comments>1</slash:comments><description>&lt;p&gt;I&amp;#39;ve been working on an update to the &lt;a href="http://appamundi.com/products/tasks/" title="Tasks"&gt;Tasks&lt;/a&gt; application which adds in background synchronisation using the new background task support in Windows Phone 7.5. As with&amp;nbsp;any app when you submit your XAP static analysis is performed on it to check, for example, that you have declared the correct capabilities based on the functionality in your app. Within a background agent you are only allow to call a subset of APIs - as you would expect you can&amp;#39;t play sound effects or&amp;nbsp;draw to the UI (with the exception of toast notifications and tile updates). Because the main app has to include a reference to the dll which provides the background task, and the functionality within the dll is used in both the background task and the main app it made sense to move all of the logic into the background dll. This meant including a number of third-party references. I was very careful to ensure that nowhere in the background task was any restricted API called and it worked perfectly in testing. &lt;/p&gt;
&lt;p&gt;The first problem is that upon submitting the static anaylsis looks at all of the referenced dlls and sees that they contain APIs not permitted in a background task and blocks the XAP. One of the culprits was InTheHand.Phone.dll (Part of &lt;a href="http://inthehand.com/content/Mobile.aspx"&gt;Mobile In The Hand&lt;/a&gt;) because it provides a mixture of helper classes for logic and for UI. As I&amp;#39;ve been working on the 7.1 version in tandem I&amp;#39;ve now split this into two assemblies for Windows Phone 7.1 SDK projects. This means we can continue to use InTheHand.Phone in background tasks and add a reference to the second assembly&amp;nbsp;in the main application only.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://mobileworld.appamundi.com/cfs-file.ashx/__key/CommunityServer.Components.UserFiles/00.00.00.21.00/static-validation.png" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;The second problem is that code within the sync logic calls ScheduledActionService.Add which is disallowed within a background task. This API is used within &lt;a href="http://appamundi.com/products/tasks/" title="Tasks"&gt;Tasks&lt;/a&gt;&amp;nbsp;to add system-wide reminders (Another new feature for this version) for new task items. The code also has the ability to update and delete reminders based on modified or deleted tasks but these do not seem to have been flagged up as errors. This is a pain because it means that if the device syncs a new task with a reminder set to show&amp;nbsp;before you next open the foreground app we won&amp;#39;t have had a chance to register it.&lt;/p&gt;
&lt;p&gt;The other issue with the NeutralResourceLanguage is an issue with projects originally created with an older version of the development tools. You can add this setting from the projects properties, Application tab and click &amp;quot;Assembly Information...&amp;quot;.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://mobileworld.appamundi.com/cfs-file.ashx/__key/CommunityServer.Components.UserFiles/00.00.00.21.00/neutral-language.png" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;This has been an interesting learning experience and shows that the validation picks up not just APIs used in the background agent code-path but also in referenced assemblies.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://mobileworld.appamundi.com/aggbug.aspx?PostID=413" width="1" height="1"&gt;</description><category domain="http://mobileworld.appamundi.com/blogs/peterfoot/archive/tags/Windows+Phone/default.aspx">Windows Phone</category></item><item><title>Syncing Windows Phone database with backend SQL Server</title><link>http://mobileworld.appamundi.com/blogs/andywigley/archive/2011/12/07/syncing-windows-phone-database-with-backend-sql-server.aspx</link><pubDate>Wed, 07 Dec 2011 17:47:45 GMT</pubDate><guid isPermaLink="false">989b12f5-6f26-47d9-9f0d-67fe982b88db:411</guid><dc:creator>Andy Wigley</dc:creator><slash:comments>9</slash:comments><description>&lt;p&gt;Windows Phone 7 was first released without any local database support which caused raised eyebrows from me and other MVPs who had a background in building Line of Business apps. Over a year ago, I &lt;a href="http://mobileworld.appamundi.com/blogs/andywigley/archive/2010/06/07/perst-a-database-for-windows-phone-7-silverlight.aspx"&gt;posted about a port of the Perst C# database&lt;/a&gt; which had been developed by McObject for a number of&amp;#160; clients including desktop Silverlight. I’m pleased to say that McObject were inspired enough by my efforts to add proper support for Windows Phone 7 into their official download which you can get &lt;a href="http://www.mcobject.com/perst_eval"&gt;here&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;At APPA Mundi, we built and deployed what I’m pretty sure was the first ‘proper’ line of business app for a commercial client in the U.S. in which we populated Perst databases on the server and then copied the database file down to the client. The database has many tens of thousands of records in it, and the app worked – and still works – well. I won’t tell you the name, as you will not be able to find it in marketplace as it is a private distribution.&lt;/p&gt;  &lt;p&gt;Since then, Microsoft has released Windows Phone 7.1 SDK, better known as ‘Mango’, which includes support for LINQ to SQL which you can use to access SQL Server Compact databases on the client. Nonetheless, Perst remains a valuable alternative to L2S and can outperform it in many situations.&lt;/p&gt;  &lt;p&gt;So, now that we have a choice of databases we can use on the client side, the new ‘ask’ that has gone straight to the top of the ‘Requested New Features’ lists is the ability to sync a local database with a backend database. There’s no solution been announced for LINQ to SQL, but &lt;a href="http://www.mcobject.com/november29/2011"&gt;last week McObject announced&lt;/a&gt; that the MediFox company have developed a Perst Sync provider which implements the client-side plumbing for a sync solution built around the Microsoft Sync Framework Toolkit. The PerstSyncProvider synchronization code may be downloaded for free at &lt;a href="http://perstsyncprovider.codeplex.com"&gt;&lt;u&gt;perstsyncprovider.codeplex.com&lt;/u&gt;&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;The download includes the code for the sync provider and also a simple demo app that shows how you can sync with the sample ListService that you can build from the Microsoft Sync Framework Toolkit. It doesn’t show much in the way of UI, but the code underneath illustrates how easy it is to work with:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://mobileworld.appamundi.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/andywigley/image_5F00_712FEF87.png"&gt;&lt;img style="background-image:none;border-right-width:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://mobileworld.appamundi.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/andywigley/image_5F00_thumb_5F00_75964A81.png" width="136" height="244" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Read more about the Perst Sync provider &lt;a href="http://www.windowsfordevices.com/c/a/News/McObject-PerstSyncProvider/"&gt;here at Windows for Devices&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;The &lt;a href="http://code.msdn.microsoft.com/silverlight/Sync-Framework-Toolkit-4dc10f0e"&gt;Microsoft Sync Framework Toolkit&lt;/a&gt; allows you to create your own sync solutions by provisioning a database with the required sync tracking tables and columns and then exposing a WCF sync service to clients. The server side works with SQL Server out of the box, but it should be simple enough to extend to other databases. On the wire, sync is handled by extensions to the OData protocols. Don’t be fooled into thinking it’s a simple click and deploy solution though: this is a *framework* so be prepared to invest some time into this reading the documentation and studying the samples if you want to build your own sync solution. The toolkit comes with sample clients for HTML5, desktop Silverlight, Windows Phone 7 (synchronizing to flat files in Isolated Storage) and Windows Mobile 6.5. &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://mobileworld.appamundi.com/aggbug.aspx?PostID=411" width="1" height="1"&gt;</description><category domain="http://mobileworld.appamundi.com/blogs/andywigley/archive/tags/Sync+Services/default.aspx">Sync Services</category><category domain="http://mobileworld.appamundi.com/blogs/andywigley/archive/tags/Perst/default.aspx">Perst</category><category domain="http://mobileworld.appamundi.com/blogs/andywigley/archive/tags/wp7dev/default.aspx">wp7dev</category></item><item><title>Links and Resources from Windows Phone Camps</title><link>http://mobileworld.appamundi.com/blogs/petevickers/archive/2011/11/13/links-and-resources-from-windows-phone-camps.aspx</link><pubDate>Sun, 13 Nov 2011 17:00:00 GMT</pubDate><guid isPermaLink="false">989b12f5-6f26-47d9-9f0d-67fe982b88db:407</guid><dc:creator>Pete Vickers</dc:creator><slash:comments>5</slash:comments><description>&lt;p&gt;We have been running, and are continue to run Windows Phone Camps in the UK. &lt;/p&gt;
&lt;p&gt;During the presentations, we include many links to articles, resources etc. - so we decided to put them all in one place &lt;/p&gt;
&lt;p&gt;The slides and Hand On Lab files are availble on our server - appmundi.com with a user of wp7camps and the same password&lt;/p&gt;
&lt;p&gt;If we mentioned any and didn&amp;#39;t put them in the list, please let us know&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
&lt;p&gt;Pete&lt;/p&gt;
&lt;p&gt;Windows Phone 7.1 SDK&lt;br /&gt;&lt;a href="http://www.microsoft.com/download/en/details.aspx?displaylang=en&amp;amp;id=27570"&gt;http://www.microsoft.com/download/en/details.aspx?displaylang=en&amp;amp;id=27570&lt;/a&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size:small;"&gt;&lt;span style="font-family:Calibri;"&gt;App Hub&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;a href="http://create.msdn.com/"&gt;&lt;span style="font-family:Calibri;color:#0000ff;font-size:small;"&gt;http://create.msdn.com&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Calibri;font-size:small;"&gt;Windows Silverlight Toolkit&lt;br /&gt;&lt;a href="http://silverlight.codeplex.com/"&gt;http://silverlight.codeplex.com/&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Calibri;font-size:small;"&gt;Silverlight for Windows Phone Toolkit in depth&lt;br /&gt;&lt;a href="http://windowsphonegeek.com/upload/ebooks/Windows%20Phone%20Toolkit%20Aug%202011%20in%20depth-v1.pdf"&gt;http://windowsphonegeek.com/upload/ebooks/Windows%20Phone%20Toolkit%20Aug%202011%20in%20depth-v1.pdf&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Calibri;font-size:small;"&gt;Coding4Fun&lt;br /&gt;&lt;a href="http://coding4fun.codeplex.com/"&gt;http://coding4fun.codeplex.com/&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size:small;"&gt;&lt;span style="font-family:Calibri;"&gt;Jump Start Training&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;a href="http://channel9.msdn.com/posts/Mango-Jump-Start-01-Building-Windows-Phone-Apps-with-Visual-Studio-2010"&gt;&lt;span style="font-family:Calibri;color:#0000ff;font-size:small;"&gt;http://&lt;/span&gt;&lt;/a&gt;&lt;a href="http://channel9.msdn.com/posts/Mango-Jump-Start-01-Building-Windows-Phone-Apps-with-Visual-Studio-2010"&gt;&lt;span style="font-family:Calibri;color:#0000ff;font-size:small;"&gt;channel9.msdn.com/posts/Mango-Jump-Start-01-Building-Windows-Phone-Apps-with-Visual-Studio-2010&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;Windows Phone 7 Resource Locator&lt;br /&gt;&lt;a href="http://forums.create.msdn.com/forums/t/93178.aspx"&gt;http://forums.create.msdn.com/forums/t/93178.aspx&lt;/a&gt;&lt;span style="font-family:Calibri;font-size:small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size:small;"&gt;&lt;span style="font-family:Calibri;"&gt;Application certification guidelines &lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/hh184843(v=VS.92).aspx"&gt;&lt;span style="font-family:Calibri;color:#0000ff;font-size:small;"&gt;http://msdn.microsoft.com/en-us/library/hh184843(v=VS.92).&lt;/span&gt;&lt;/a&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/hh184843(v=VS.92).aspx"&gt;&lt;span style="font-family:Calibri;color:#0000ff;font-size:small;"&gt;aspx&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:Calibri;font-size:small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size:small;"&gt;&lt;span style="font-family:Calibri;"&gt;Marketing resources&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;a href="http://create.msdn.com/en-us/education/basics/marketing"&gt;&lt;span style="font-family:Calibri;color:#0000ff;font-size:small;"&gt;http&lt;/span&gt;&lt;/a&gt;&lt;a href="http://create.msdn.com/en-us/education/basics/marketing"&gt;&lt;span style="font-family:Calibri;color:#0000ff;font-size:small;"&gt;://&lt;/span&gt;&lt;/a&gt;&lt;a href="http://create.msdn.com/en-us/education/basics/marketing"&gt;&lt;span style="font-family:Calibri;color:#0000ff;font-size:small;"&gt;create.msdn.com/en-us/education/basics/marketing&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Calibri;font-size:small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="font-size:small;"&gt;&lt;span style="font-family:Calibri;"&gt;Application Submission Walkthrough&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;a href="http://create.msdn.com/en-US/home/about/app_submission_walkthrough"&gt;&lt;span style="font-family:Calibri;color:#0000ff;font-size:small;"&gt;http://&lt;/span&gt;&lt;/a&gt;&lt;a href="http://create.msdn.com/en-US/home/about/app_submission_walkthrough"&gt;&lt;span style="font-family:Calibri;color:#0000ff;font-size:small;"&gt;create.msdn.com/en-US/home/about/app_submission_walkthrough&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size:small;"&gt;&lt;span style="font-family:Calibri;"&gt;Screenshot Tool&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;a href="http://www.innovativetechguy.com/?p=13&amp;amp;nbsp"&gt;&lt;span style="font-family:Calibri;color:#0000ff;font-size:small;"&gt;http://www.innovativetechguy.com/?p=13&amp;amp;nbsp#awp::?&lt;/span&gt;&lt;/a&gt;&lt;a href="http://www.innovativetechguy.com/?p=13&amp;amp;nbsp"&gt;&lt;span style="font-family:Calibri;color:#0000ff;font-size:small;"&gt;p=13&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size:small;"&gt;&lt;span style="font-family:Calibri;"&gt;XNA-UK XAP test service&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="text-decoration:underline;"&gt;&lt;a href="http://xna-uk.net/groups/xnaukxap/default.aspx"&gt;&lt;span style="font-family:Calibri;color:#0000ff;font-size:small;"&gt;http://xna-uk.net/groups/xnaukxap/default.aspx&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size:small;"&gt;&lt;span style="font-family:Calibri;"&gt;Windows Phone 7 Screen Shot Tool&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;a href="http://www.innovativetechguy.com/?p=164#awp::?p=164"&gt;&lt;span style="font-family:Calibri;color:#0000ff;font-size:small;"&gt;http://www.innovativetechguy.com/?p=164#awp::?p=164&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size:small;"&gt;&lt;span style="font-family:Calibri;"&gt;Mike Ormond&amp;rsquo;s Templates for Paint.net&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;a href="http://blogs.msdn.com/b/mikeormond/archive/2011/03/21/windows-phone-7-iconography.aspx?utm_source=feedburner&amp;amp;utm_medium=feed&amp;amp;utm_campaign=Feed%3A+mikeormond+%28Mike+Ormond%27s+Blog%29"&gt;&lt;span style="font-family:Calibri;color:#0000ff;font-size:small;"&gt;http://blogs.msdn.com/b/mikeormond/archive/2011/03/21/windows-phone-7-iconography.aspx?utm_source=feedburner&amp;amp;utm_medium=feed&amp;amp;utm_campaign=Feed%3A+mikeormond+%28Mike+Ormond%27s+Blog%29&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size:small;"&gt;&lt;span style="font-family:Calibri;"&gt;GUI Interface for Capability Detection&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;a href="http://appamundi.com/software/CapDetect.1.0.zip"&gt;&lt;span style="font-family:Calibri;color:#0000ff;font-size:small;"&gt;http://appamundi.com/software/CapDetect.1.0.zip&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size:small;"&gt;&lt;span style="font-family:Calibri;"&gt;GUI Interface for Isolated Storage Explorer Tool&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;a href="http://appamundi.com/software/GUI_Iset.1.1.zip"&gt;&lt;span style="font-family:Calibri;color:#0000ff;font-size:small;"&gt;http://appamundi.com/software/GUI_Iset.1.1.zip&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size:small;"&gt;&lt;span style="font-family:Calibri;"&gt;&lt;span style="color:#343434;"&gt;Creating a Windows Phone 7 Trial Application: Implementation and Best Practices&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;a href="http://www.windowsphonegeek.com/articles/Creating-a-Windows-Phone-7-Trial-Application-Implementation-and-Best-Practices"&gt;&lt;span style="font-family:Calibri;color:#0000ff;font-size:small;"&gt;http://www.windowsphonegeek.com/articles/Creating-a-Windows-Phone-7-Trial-Application-Implementation-and-Best-Practices&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size:small;"&gt;&lt;span style="font-family:Calibri;"&gt;Beginning C# - Robe Miles C Sharp Yellow Book&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;a href="http://www.robmiles.com/c-yellow-book/"&gt;&lt;span style="font-family:Calibri;color:#0000ff;font-size:small;"&gt;http://www.robmiles.com/c-yellow-book/&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:Calibri;font-size:small;"&gt; or &lt;/span&gt;&lt;a href="http://www.robmiles.com/c-yellow-book/Rob%20Miles%20CSharp%20Yellow%20Book%202010.pdf"&gt;&lt;span style="font-family:Calibri;color:#0000ff;font-size:small;"&gt;http://www.robmiles.com/c-yellow-book/Rob%20Miles%20CSharp%20Yellow%20Book%202010.pdf&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size:small;"&gt;&lt;span style="font-family:Calibri;"&gt;Rob Miles - Writing Silverlight and XNA apps for Windows Phone&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;a href="http://www.robmiles.com/c-yellow-book/Rob%20Miles%20Windows%20Phone%20Blue%20Book.pdf"&gt;&lt;span style="font-family:Calibri;color:#0000ff;font-size:small;"&gt;http://www.robmiles.com/c-yellow-book/Rob%20Miles%20Windows%20Phone%20Blue%20Book.pdf&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size:small;"&gt;&lt;span style="font-family:Calibri;"&gt;APPA Mundi Blogs&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;a href="http://mobileworld.appamundi.com/blogs/"&gt;&lt;span style="font-family:Calibri;color:#0000ff;font-size:small;"&gt;http://mobileworld.appamundi.com/blogs/&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size:small;"&gt;&lt;span style="font-family:Calibri;"&gt;Windows Phone SDK 7.1 RC&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;a href="http://go.microsoft.com/?linkid=9772716"&gt;&lt;span style="font-family:Calibri;color:#0000ff;font-size:small;"&gt;http://go.microsoft.com/?linkid=9772716&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size:small;"&gt;&lt;span style="font-family:Calibri;"&gt;Obfuscation and Analytics&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;a href="http://www.preemptive.com/windowsphone7.html"&gt;&lt;span style="font-family:Calibri;color:#0000ff;font-size:small;"&gt;http://www.preemptive.com/windowsphone7.html&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size:small;"&gt;&lt;span style="font-family:Calibri;"&gt;Windows Phone Developer Support&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;a href="http://create.msdn.com/en-us/home/feedback"&gt;&lt;span style="font-family:Calibri;color:#0000ff;font-size:small;"&gt;http://create.msdn.com/en-us/home/feedback&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Calibri;font-size:small;"&gt;Windows Phone User Group &lt;br /&gt;&lt;/span&gt;&lt;a href="http://www.wpug.net/"&gt;&lt;span style="font-family:Calibri;color:#0000ff;font-size:small;"&gt;www.wpug.net&lt;/span&gt;&lt;/a&gt;&lt;span style="font-size:small;"&gt;&lt;span style="font-family:Calibri;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size:small;"&gt;&lt;span style="font-family:Calibri;"&gt;Community Windows 7 Development book&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;a href="http://www.lulu.com/product/file-download/building-windows-phone-apps-a-developer%e2%80%99s-guide/17266976"&gt;&lt;span style="font-family:Calibri;color:#0000ff;font-size:small;"&gt;http://www.lulu.com/product/file-download/building-windows-phone-apps-a-developer%e2%80%99s-guide/17266976&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Jeff Blankenberg - 31 days of Mango&lt;br /&gt;&lt;a href="http://www.jeffblankenburg.com/2011/10/31/31-days-of-mango/"&gt;http://www.jeffblankenburg.com/2011/10/31/31-days-of-mango/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Jeff Wilcox - Unit Testing&lt;br /&gt;&lt;a href="http://www.jeff.wilcox.name/2010/05/sl3-utf-bits/"&gt;http://www.jeff.wilcox.name/2010/05/sl3-utf-bits/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Jeff Wilcox - Metro Grid Helper&lt;br /&gt;&lt;a href="http://www.wpcentral.com/metrogridhelper-visual-aid-designers-and-developers"&gt;http://www.wpcentral.com/metrogridhelper-visual-aid-designers-and-developers&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;SQL Compact Toolbox including GUI Interface for SQLMetal&lt;br /&gt;&lt;a href="http://visualstudiogallery.msdn.microsoft.com/0e313dfd-be80-4afb-b5e9-6e74d369f7a1/"&gt;http://visualstudiogallery.msdn.microsoft.com/0e313dfd-be80-4afb-b5e9-6e74d369f7a1/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Mike Ormonds Blog&lt;br /&gt;&lt;a href="http://blogs.msdn.com/b/mikeormond/"&gt;http://blogs.msdn.com/b/mikeormond/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Windows Phone Developer Blog&lt;br /&gt;&lt;a href="http://windowsteamblog.com/windows_phone/b/wpdev/"&gt;http://windowsteamblog.com/windows_phone/b/wpdev/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Ad Monetization - Best Practices&lt;br /&gt;&lt;a href="http://advertising.microsoft.com/wwdocs/user/en-us/forpublishers/Ad-in-Apps-Monetization%20Best%20Practices_3-1-2011.pdf"&gt;http://advertising.microsoft.com/wwdocs/user/en-us/forpublishers/Ad-in-Apps-Monetization%20Best%20Practices_3-1-2011.pdf&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;XNA - UK XAP Test service&lt;br /&gt;&lt;a href="http://xna-uk.net/groups/xnaukxap/default.aspx"&gt;http://xna-uk.net/groups/xnaukxap/default.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Windows Azure Toolkit For Windows Phone&lt;br /&gt;&lt;a href="http://watwp.codeplex.com/"&gt;http://watwp.codeplex.com/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Windows Phone Metro Design - Channel 9 from Techdays of Dave Crawfords excellent presentation&lt;br /&gt;&lt;a href="http://channel9.msdn.com/Events/TechDays/Techdays-2012-the-Netherlands/2289"&gt;http://channel9.msdn.com/Events/TechDays/Techdays-2012-the-Netherlands/2289&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Slides and HOLS&lt;br /&gt;&lt;a&gt;ftp://apamundi.com&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;user and password &lt;strong&gt;wp7camps&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;To receive a developer phone you will need to be provide:&lt;br /&gt;&lt;/strong&gt;&lt;strong&gt;&lt;br /&gt;&lt;/strong&gt;App Hub Publisher Name&lt;br /&gt;Live ID&lt;br /&gt;Screenshots of a new app that you will publish in the next 30 days.&lt;br /&gt;Full Name&lt;br /&gt;Address&lt;br /&gt;Telephone Number&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;strong&gt;Requests can be sent to &lt;/strong&gt;&lt;a href="mailto:UKWPrequests@microsoft.com"&gt;&lt;strong&gt;UKWPrequests@microsoft.com&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Only one handset per developer&lt;/strong&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://mobileworld.appamundi.com/aggbug.aspx?PostID=407" width="1" height="1"&gt;</description><category domain="http://mobileworld.appamundi.com/blogs/petevickers/archive/tags/Windows+Phone+7/default.aspx">Windows Phone 7</category><category domain="http://mobileworld.appamundi.com/blogs/petevickers/archive/tags/Developer+Tools/default.aspx">Developer Tools</category><category domain="http://mobileworld.appamundi.com/blogs/petevickers/archive/tags/resources/default.aspx">resources</category></item><item><title>Windows Phone Workshop–Manchester</title><link>http://mobileworld.appamundi.com/blogs/andywigley/archive/2011/09/26/windows-phone-workshop-manchester.aspx</link><pubDate>Mon, 26 Sep 2011 06:35:07 GMT</pubDate><guid isPermaLink="false">989b12f5-6f26-47d9-9f0d-67fe982b88db:405</guid><dc:creator>Andy Wigley</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;Just a very brief note as I’m about to start giving a Windows Phone workshop to Nokia developers in Milan &lt;img style="border-bottom-style:none;border-left-style:none;border-top-style:none;border-right-style:none;" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://mobileworld.appamundi.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/andywigley/wlEmoticon_2D00_smile_5F00_6D7BB9EB.png" /&gt;&lt;/p&gt;  &lt;p&gt;Big thank you to everyone who came to the workshop in Manchester on Saturday 24th September. You were a great and enthusiastic crowd!&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;I have started posting up the slides and code &lt;a href="https://skydrive.live.com/redir.aspx?cid=b36de4dd5a9179a1&amp;amp;resid=B36DE4DD5A9179A1!1212"&gt;at this Skydrive share&lt;/a&gt;. Three of the sessions are up there now, and the rest will follow before the end of today.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Thanks for coming to the Workshop!!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://mobileworld.appamundi.com/aggbug.aspx?PostID=405" width="1" height="1"&gt;</description><category domain="http://mobileworld.appamundi.com/blogs/andywigley/archive/tags/Windows+Phone+7/default.aspx">Windows Phone 7</category><category domain="http://mobileworld.appamundi.com/blogs/andywigley/archive/tags/wp7dev/default.aspx">wp7dev</category></item><item><title>Showing Mango Features on Marketplace</title><link>http://mobileworld.appamundi.com/blogs/peterfoot/archive/2011/09/21/showing-mango-features-on-marketplace.aspx</link><pubDate>Tue, 20 Sep 2011 20:30:00 GMT</pubDate><guid isPermaLink="false">989b12f5-6f26-47d9-9f0d-67fe982b88db:404</guid><dc:creator>Peter Foot</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;The Windows Phone team have posted to their blog about application updates with a couple of useful points:-&lt;/p&gt;
&lt;p&gt;From October you will again be able to publish updates to your 7.0 apps independently from 7.5 (previously once you had published a Mango update your 7.0 app would be locked). It does mean potentially being in limbo for a month but at least you are not stuck completely with no way of updating a 7.0 app. This is important as it will take some time before many users will have the opportunity of upgrading to Mango.&lt;/p&gt;
&lt;p&gt;When submitting apps there is only one description for both versions of your app so you must describe which features are for Mango only. For the purposes of Screenshots there is now an officially accepted overlay which can be used to indicate Mango-only functionality. You can download a ZIP containing the overlay and examples here:-&lt;/p&gt;
&lt;p&gt;&lt;a href="http://create.msdn.com/downloads/?id=882&amp;amp;filename=Marketplace_7.5_Badges.zip"&gt;http://create.msdn.com/downloads/?id=882&amp;amp;filename=Marketplace_7.5_Badges.zip&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The full blog post is here:-&lt;/p&gt;
&lt;p&gt;&lt;a href="http://windowsteamblog.com/windows_phone/b/wpdev/archive/2011/09/20/submit-windows-phone-7-5-apps-today-update-7-0-apps-in-october.aspx?utm_source=twitterfeed&amp;amp;utm_medium=twitter"&gt;http://windowsteamblog.com/windows_phone/b/wpdev/archive/2011/09/20/submit-windows-phone-7-5-apps-today-update-7-0-apps-in-october.aspx?utm_source=twitterfeed&amp;amp;utm_medium=twitter&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://mobileworld.appamundi.com/aggbug.aspx?PostID=404" width="1" height="1"&gt;</description><category domain="http://mobileworld.appamundi.com/blogs/peterfoot/archive/tags/Windows+Phone/default.aspx">Windows Phone</category></item><item><title>Inaugural meeting of Windows Phone User Group (North West)</title><link>http://mobileworld.appamundi.com/blogs/petevickers/archive/2011/09/17/inaugural-meeting-of-windows-phone-user-group-north-west.aspx</link><pubDate>Sat, 17 Sep 2011 06:40:00 GMT</pubDate><guid isPermaLink="false">989b12f5-6f26-47d9-9f0d-67fe982b88db:403</guid><dc:creator>Pete Vickers</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;On Tuesday the 13th of September, we finally held the first meeting (hopefully of many) of the WPUG in Manchester. Matt Lacey has been running the &lt;a href="http://wpug.net/"&gt;WPUG&lt;/a&gt;&amp;nbsp;in London for&amp;nbsp;over a year, and a northern meeting has been mooted for a while. &lt;/p&gt;
&lt;p&gt;This finally came about due to the efforts of Rick Garner, Chris Hardy and a bit of input from myself.&lt;/p&gt;
&lt;p&gt;The meeting was held at the &lt;a href="http://madlab.org.uk/"&gt;Manchester Digital Laboratory&lt;/a&gt; (MadLab), a centrally located, but well hidden venue in Manchester&amp;#39;s &amp;#39;northern quarter&amp;#39;. Once you worked out that MadLab was the abbreviation for Manchester Digital Laboratory, the task was a little easier, although with the closed shutters, and just a faded sign over the intercom, it was still a challenge. MadLab is ideally placed though, and the room was just right for our needs. We were well looked after - so thanks again to MadLab.&lt;/p&gt;
&lt;p&gt;We started around 6:30 with&amp;nbsp;a smaller audience than the registrations indicated, so thanks to everyone who made the effort. We had attendees who had traveled on the day from Birmingham, Sheffield and Liverpool to name but 3, and Ben who is based in Durham but was working in Manchester. &lt;/p&gt;
&lt;p&gt;After the introductions, and we found out why everyone was there, I did a presentation on Marketplace submission - tips and tricks. This simulated a wide ranging discussion from development to submission, with everyone contributing. Special thanks to Simon Jackson for highlighting the testing service provided by the &lt;span style="font-family:&amp;#39;Tahoma&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:10pt;mso-fareast-font-family:&amp;#39;Times New Roman&amp;#39;;mso-ansi-language:EN-GB;mso-fareast-language:EN-GB;mso-bidi-language:AR-SA;"&gt;the &lt;a href="http://xna-uk.net/groups/xnaukxap/default.aspx"&gt;XNA-UK XAP test service&lt;/a&gt;. They &lt;span style="font-family:&amp;#39;Tahoma&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:10pt;mso-fareast-font-family:&amp;#39;Times New Roman&amp;#39;;mso-ansi-language:EN-GB;mso-fareast-language:EN-GB;mso-bidi-language:AR-SA;"&gt;support testing of all apps / games in either Silverlight or XNA on the service and provide a wealth of testing capabilities from marketplace testing to UI/UX guidance and support. &amp;nbsp;&lt;strong&gt;All for free.&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:&amp;#39;Tahoma&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:10pt;mso-fareast-font-family:&amp;#39;Times New Roman&amp;#39;;mso-ansi-language:EN-GB;mso-fareast-language:EN-GB;mso-bidi-language:AR-SA;"&gt;We had a short discussion about what we wanted to see in the future (Expression Blend, Mono, data binding), and who we could &amp;#39;press gang&amp;#39; into speaking at the meetings. &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:&amp;#39;Tahoma&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:10pt;mso-fareast-font-family:&amp;#39;Times New Roman&amp;#39;;mso-ansi-language:EN-GB;mso-fareast-language:EN-GB;mso-bidi-language:AR-SA;"&gt;Thanks to Paul Lo from Microsoft, we raffled off some swag, including a very nice Windows Phone laptop bag, and then retired across the road to a very nice bar for some socialising and geek talk.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:&amp;#39;Tahoma&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:10pt;mso-fareast-font-family:&amp;#39;Times New Roman&amp;#39;;mso-ansi-language:EN-GB;mso-fareast-language:EN-GB;mso-bidi-language:AR-SA;"&gt;We are HOPING to run the next meeting on Tuesday 8th November at the same place - so stay tuned for more details.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:&amp;#39;Tahoma&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:10pt;mso-fareast-font-family:&amp;#39;Times New Roman&amp;#39;;mso-ansi-language:EN-GB;mso-fareast-language:EN-GB;mso-bidi-language:AR-SA;"&gt;Again, thanks to Rick, Chris and Matt - and here are some photograhs from the event.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="http://mobileworld.appamundi.com/cfs-file.ashx/__key/CommunityServer.Components.UserFiles/00.00.00.21.02/WPUG1.jpg" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:&amp;#39;Tahoma&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:10pt;mso-fareast-font-family:&amp;#39;Times New Roman&amp;#39;;mso-ansi-language:EN-GB;mso-fareast-language:EN-GB;mso-bidi-language:AR-SA;"&gt;
&lt;p&gt;&lt;img src="http://mobileworld.appamundi.com/cfs-file.ashx/__key/CommunityServer.Components.UserFiles/00.00.00.21.02/WPUG2.jpg" alt="" /&gt;&lt;br /&gt;&lt;br style="mso-special-character:line-break;" /&gt;&lt;br style="mso-special-character:line-break;" /&gt;&lt;img src="http://mobileworld.appamundi.com/cfs-file.ashx/__key/CommunityServer.Components.UserFiles/00.00.00.21.02/WPUG3.jpg" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="http://mobileworld.appamundi.com/cfs-file.ashx/__key/CommunityServer.Components.UserFiles/00.00.00.21.02/WPUG4.jpg" alt="" /&gt;&lt;/p&gt;
&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://mobileworld.appamundi.com/aggbug.aspx?PostID=403" width="1" height="1"&gt;</description><category domain="http://mobileworld.appamundi.com/blogs/petevickers/archive/tags/Windows+Phone+7/default.aspx">Windows Phone 7</category><category domain="http://mobileworld.appamundi.com/blogs/petevickers/archive/tags/Windows+Phone+7+development/default.aspx">Windows Phone 7 development</category><category domain="http://mobileworld.appamundi.com/blogs/petevickers/archive/tags/Windows+Phone+7+Developer+Tools/default.aspx">Windows Phone 7 Developer Tools</category><category domain="http://mobileworld.appamundi.com/blogs/petevickers/archive/tags/user+group/default.aspx">user group</category><category domain="http://mobileworld.appamundi.com/blogs/petevickers/archive/tags/wpug/default.aspx">wpug</category></item><item><title>Working with Marketplace Exported Reports</title><link>http://mobileworld.appamundi.com/blogs/peterfoot/archive/2011/09/12/working-with-marketplace-exported-reports.aspx</link><pubDate>Mon, 12 Sep 2011 13:14:00 GMT</pubDate><guid isPermaLink="false">989b12f5-6f26-47d9-9f0d-67fe982b88db:402</guid><dc:creator>Peter Foot</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;When Microsoft refreshed the Windows Phone developer portal in advance of the Mango refresh they added various improvements to reporting, an important one being export to file (XLSX). When you open the exported payout detail reports in Excel and enable editing you&amp;#39;ll see a number of warnings against a couple of columns. This is because the data is formatted as text but Excel recognises that the contents are numbers. In order to use these values in formulas or graphs you&amp;#39;ll need to convert them to numerical values.&lt;/p&gt;
&lt;p&gt;The easiest way I found to do this was to select an empty cell and Copy it, then select the entire columns of &amp;quot;Units Sold&amp;quot; and &amp;quot;Royalty&amp;quot;,&amp;nbsp;right click and select &amp;quot;Paste Special&amp;quot;. From the popup select &amp;quot;Add&amp;quot; as the operation and click &amp;quot;Ok&amp;quot;. Now all your number columns are really numbers (you&amp;#39;ll see the formatting change to right alignment).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://mobileworld.appamundi.com/aggbug.aspx?PostID=402" width="1" height="1"&gt;</description><category domain="http://mobileworld.appamundi.com/blogs/peterfoot/archive/tags/Windows+Phone/default.aspx">Windows Phone</category></item><item><title>Mango Jump Start Videos–Just Released!</title><link>http://mobileworld.appamundi.com/blogs/andywigley/archive/2011/09/08/mango-jump-start-videos-just-released.aspx</link><pubDate>Thu, 08 Sep 2011 13:48:05 GMT</pubDate><guid isPermaLink="false">989b12f5-6f26-47d9-9f0d-67fe982b88db:401</guid><dc:creator>Andy Wigley</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;&lt;strong&gt;Microsoft have&lt;/strong&gt; &lt;b&gt;announced availability of the HD-quality video recordings – FREE – on &lt;a href="http://wpdev.ms/wpmgojs"&gt;Channel 9&lt;/a&gt;! &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;· The 14-hour course covers all aspects of Windows Phone development Visual Studio 2010, Silverlight, Expression, data storage, networks, user interface, XNA and the Marketplace.&lt;/p&gt;  &lt;p&gt;· “Team-teaching” approach led by MVPs Rob Miles and Andy Wigley&lt;/p&gt;  &lt;p&gt;· Every module is an engaging discussion, packed with best practices and real-world demonstrations&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Home page for the entire course on Channel 9: “&lt;a href="http://wpdev.ms/wpmgojs"&gt;Building Applications for Windows Phone Mango Jump Start&lt;/a&gt;”&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;· Links directly to specific modules:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;o Mango Jump Start (01): &lt;a href="http://channel9.msdn.com/posts/Mango-Jump-Start-01-Building-Windows-Phone-Apps-with-Visual-Studio-2010"&gt;Building Windows Phone Apps with Visual Studio 2010&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;blockquote&gt;   &lt;p&gt;o Mango Jump Start (02): &lt;a href="http://channel9.msdn.com/posts/Mango-Jump-Start-02-Silverlight-on-Windows-PhoneIntroduction"&gt;Silverlight on Windows Phone—Introduction&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;blockquote&gt;   &lt;p&gt;o Mango Jump Start (03): &lt;a href="http://channel9.msdn.com/posts/Mango-Jump-Start-03-Silverlight-on-Windows-PhoneAdvanced"&gt;Silverlight on Windows Phone—Advanced&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;blockquote&gt;   &lt;p&gt;o Mango Jump Start (04): &lt;a href="http://channel9.msdn.com/posts/Mango-Jump-Start-04-Using-Expression-Blend-to-Build-Windows-Phone-Interfaces"&gt;Using Expression to Build Windows Phone Interfaces&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;blockquote&gt;   &lt;p&gt;o Mango Jump Start (05): &lt;a href="http://channel9.msdn.com/posts/Mango-Jump-Start-05-Windows-Phone-Fast-Application-Switching"&gt;Windows Phone Fast Application Switching&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;blockquote&gt;   &lt;p&gt;o Mango Jump Start (06): &lt;a href="http://channel9.msdn.com/posts/Mango-Jump-Start-06-Windows-Phone-Multi-tasking--Background-Tasks"&gt;Windows Phone Multi-tasking &amp;amp; Background Tasks&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;blockquote&gt;   &lt;p&gt;o Mango Jump Start (07): &lt;a href="http://channel9.msdn.com/posts/Mango-Jump-Start-07-Using-Windows-Phone-Resources-Bing-Maps-Camera-etc"&gt;Using Windows Phone Resources (Bing Maps, Camera, etc.)&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;blockquote&gt;   &lt;p&gt;o Mango Jump Start (08a): &lt;a href="http://channel9.msdn.com/posts/Mango-Jump-Start-08a-Application-Data-Storage-on-Windows-Phone--Part-1"&gt;Application Data Storage on Windows Phone | Part 1&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;blockquote&gt;   &lt;p&gt;o Mango Jump Start (08b): &lt;a href="http://channel9.msdn.com/posts/Mango-Jump-Start-08b-Application-Data-Storage-on-Windows-Phone-Part-2"&gt;Application Data Storage on Windows Phone | Part 2&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;blockquote&gt;   &lt;p&gt;o Mango Jump Start (09): &lt;a href="http://channel9.msdn.com/posts/Mango-Jump-Start-09-Using-Networks-with-Windows-Phone"&gt;Using Networks with Windows Phone&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;blockquote&gt;   &lt;p&gt;o Mango Jump Start (10): &lt;a href="http://channel9.msdn.com/posts/Mango-Jump-Start-10-Tiles--Notifications-on-Windows-Phone"&gt;Tiles &amp;amp; Notifications on Windows Phone&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;blockquote&gt;   &lt;p&gt;o Mango Jump Start (11a): &lt;a href="http://channel9.msdn.com/posts/Mango-Jump-Start-11a-XNA-for-Windows-Phone--Part-1"&gt;XNA for Windows Phone | Part 1&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;blockquote&gt;   &lt;p&gt;o Mango Jump Start (11b): &lt;a href="http://channel9.msdn.com/posts/Mango-Jump-Start-11b-XNA-for-Windows-Phone--Part-2"&gt;XNA for Windows Phone | Part 2&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;blockquote&gt;   &lt;p&gt;o Mango Jump Start (12): &lt;a href="http://channel9.msdn.com/posts/Mango-Jump-Start-12-Selling-a-Windows-Phone-Application"&gt;Selling a Windows Phone Application&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;· Links to &lt;a href="http://borntolearn.mslearn.net/wpmango/m/mediagallery/default.aspx"&gt;course materials&lt;/a&gt; on Born to Learn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://mobileworld.appamundi.com/aggbug.aspx?PostID=401" width="1" height="1"&gt;</description><category domain="http://mobileworld.appamundi.com/blogs/andywigley/archive/tags/Silverlight/default.aspx">Silverlight</category><category domain="http://mobileworld.appamundi.com/blogs/andywigley/archive/tags/Windows+Phone+7/default.aspx">Windows Phone 7</category><category domain="http://mobileworld.appamundi.com/blogs/andywigley/archive/tags/wp7dev/default.aspx">wp7dev</category></item><item><title>FREE GUI add-on for Isolated Storage Explorer</title><link>http://mobileworld.appamundi.com/blogs/andywigley/archive/2011/09/02/free-gui-add-on-for-isolated-storage-explorer.aspx</link><pubDate>Fri, 02 Sep 2011 09:08:19 GMT</pubDate><guid isPermaLink="false">989b12f5-6f26-47d9-9f0d-67fe982b88db:399</guid><dc:creator>Andy Wigley</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;Last week in the JumpStart video webcasts, I showed how you use a new tool that is included in the Windows Phone 7.1 SDK – the Isolated Storage Explorer Tool. This handy tool allows you to list the files in Isolated Storage on the emulator or a develop-unlocked device for an app you are developing, or to copy the files to and from your development PC. It’s very useful but is a command line tool.&lt;/p&gt;  &lt;p&gt;But we all prefer a graphical user interface, don’t we? So here at Appamundi, we’ve built one. My colleague Pete Vickers has already blogged a detailed post all about it, so if you want to learn more, go to &lt;a href="http://mobileworld.appamundi.com/blogs/petevickers/archive/2011/08/31/appa-mundi-release-free-gui-interface-for-the-isolated-storage-explorer-tool-gui-iset.aspx"&gt;Pete&amp;#39;s&amp;#39; post on GUI-ISET&lt;/a&gt; where Pete explains how to get it and how it works.&lt;/p&gt;  &lt;p&gt;Enjoy!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://mobileworld.appamundi.com/aggbug.aspx?PostID=399" width="1" height="1"&gt;</description><category domain="http://mobileworld.appamundi.com/blogs/andywigley/archive/tags/Windows+Phone+7/default.aspx">Windows Phone 7</category><category domain="http://mobileworld.appamundi.com/blogs/andywigley/archive/tags/wp7dev/default.aspx">wp7dev</category></item></channel></rss>
