<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://msmvps.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/"><channel><title>The Problem Solver : VB</title><link>http://msmvps.com/blogs/theproblemsolver/archive/tags/VB/default.aspx</link><description>Tags: VB</description><dc:language>en</dc:language><generator>CommunityServer 2008.5 SP2 (Build: 40407.4157)</generator><item><title>Workflow 4 and Visual Basic expressions</title><link>http://msmvps.com/blogs/theproblemsolver/archive/2009/10/26/workflow-4-and-visual-basic-expressions.aspx</link><pubDate>Mon, 26 Oct 2009 15:20:46 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1735366</guid><dc:creator>Maurice</dc:creator><slash:comments>11</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/theproblemsolver/rsscomments.aspx?PostID=1735366</wfw:commentRss><comments>http://msmvps.com/blogs/theproblemsolver/archive/2009/10/26/workflow-4-and-visual-basic-expressions.aspx#comments</comments><description>&lt;p&gt;&lt;font color="#ff0000"&gt;Note: This blog post is written using the .NET framework 4.0 Beta 2&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;When using Windows Workflow Foundation 4 you often need to enter expression in some activity property. The new thing is these expressions are all in the Visual Basic dialect regardless of what language you project is in. So when developing a project in C# the expressions are sill in Visual Basic.&lt;/p&gt;  &lt;p&gt;Weird right?&lt;/p&gt;  &lt;p&gt;Well not really when you think about it!&lt;/p&gt;  &lt;p&gt;After all power business users are expected to be able to modify workflows. And guess what their favorite tools are. That would be Microsoft Excel and Word. And what do they use to create macros? Right Visual Basic for Applications is their language of choice.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;So if they use VBA letting them enter VB into expression dialogs is a far more natural fit than having them use C#.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h3&gt;A case for the Delay activity&lt;/h3&gt;  &lt;p&gt;So lets take a look at the delay activity. This activity takes 1 input property Duration of type Time Span. So I guess that means our VBA power users are going to have to enter something like if they want to wait 5 seconds:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://msmvps.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/theproblemsolver.metablogapi/3175.image_5F00_51844A7D.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" border="0" alt="image" src="http://msmvps.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/theproblemsolver.metablogapi/4670.image_5F00_thumb_5F00_10099824.png" width="346" height="201" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Now for some reason I suspect that is not the first thing they are going to type. In fact they are more likely to time something like “0:0:05” instead. Not very VB like right?&lt;/p&gt;  &lt;p&gt;Well it turns out workflow is smart enough to realize it can convert the string literal to a Time Span and use this. So when our power users does the following it just works &lt;img src="http://msmvps.com/emoticons/emotion-1.gif" alt="Smile" /&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://msmvps.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/theproblemsolver.metablogapi/2514.image_5F00_75C92EFF.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" border="0" alt="image" src="http://msmvps.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/theproblemsolver.metablogapi/3187.image_5F00_thumb_5F00_5F9313AD.png" width="344" height="202" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Nice, I like this!&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Enjoy WF4!&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.theproblemsolver.nl/"&gt;www.TheProblemSolver.nl &lt;/a&gt;    &lt;br /&gt;&lt;a href="http://wiki.windowsworkflowfoundation.eu/"&gt;Wiki.WindowsWorkflowFoundation.eu&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1735366" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/.NET/default.aspx">.NET</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/NetFx3/default.aspx">NetFx3</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/Workflow/default.aspx">Workflow</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/VB/default.aspx">VB</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/WF4/default.aspx">WF4</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/VS2010/default.aspx">VS2010</category></item><item><title>Nederlandse CodeCamp 2009</title><link>http://msmvps.com/blogs/theproblemsolver/archive/2009/10/19/nederlandse-codecamp-2009.aspx</link><pubDate>Mon, 19 Oct 2009 10:26:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1732965</guid><dc:creator>Maurice</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/theproblemsolver/rsscomments.aspx?PostID=1732965</wfw:commentRss><comments>http://msmvps.com/blogs/theproblemsolver/archive/2009/10/19/nederlandse-codecamp-2009.aspx#comments</comments><description>&lt;p&gt;Op 21 november 2009 organiseren de &lt;a href="http://www.sdn.nl"&gt;SDN&lt;/a&gt;, &lt;a href="http://www.dotned.nl"&gt;Stichting dotNed&lt;/a&gt; en &lt;a href="http://www.VBcentral.nl"&gt;VBcentral&lt;/a&gt; samen het derde Nederlandse &lt;a href="http://www.codecamp.nl"&gt;Code Camp&lt;/a&gt;. Dit is een dag lang met code, code sharing, freaking en gezellig samenzijn. Een evenement door ontwikkelaars, voor ontwikkelaars. De regie ligt voor een belangrijk deel bij de deelnemers! Het aantal plaatsen voor deelnemers is wel beperkt tot maximaal 150. Wacht dus niet te lang met beslissen want voor je het weet is er geen plaats meer. Vergeet bij je aanmelding niet op te geven welke onderwerpen je interesse hebben. Bovendien nodigen we iedereen graag uit om zelf een sessie in te vullen.&lt;/p&gt;  &lt;p&gt;   &lt;br /&gt;Op de website, &lt;a href="http://www.codecamp.nl"&gt;www.codecamp.nl&lt;/a&gt;, vind je meer informatie en kan je je aanmelden.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1732965" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/.NET/default.aspx">.NET</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/Visual+FoxPro/default.aspx">Visual FoxPro</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/LINQ/default.aspx">LINQ</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/NetFx3/default.aspx">NetFx3</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/Workflow/default.aspx">Workflow</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/VSTO/default.aspx">VSTO</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/WCF/default.aspx">WCF</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/VB/default.aspx">VB</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/webcast/default.aspx">webcast</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/ClickOnce/default.aspx">ClickOnce</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/WPF/default.aspx">WPF</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/Silverlight/default.aspx">Silverlight</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/SDN/default.aspx">SDN</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/Data+Access/default.aspx">Data Access</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/ASP.NET/default.aspx">ASP.NET</category></item><item><title>Nationale Office Dag files</title><link>http://msmvps.com/blogs/theproblemsolver/archive/2009/10/15/nationale-office-dag-files.aspx</link><pubDate>Thu, 15 Oct 2009 20:54:43 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1732609</guid><dc:creator>Maurice</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/theproblemsolver/rsscomments.aspx?PostID=1732609</wfw:commentRss><comments>http://msmvps.com/blogs/theproblemsolver/archive/2009/10/15/nationale-office-dag-files.aspx#comments</comments><description>&lt;p&gt;Looking for the slides and samples from my two presentations at the &lt;a href="http://www.nationaleofficedag.com/"&gt;Nationale Office Dag&lt;/a&gt; in Ede? You can download them from &lt;a href="http://www.theproblemsolver.nl/files/nod2009_presentaties.zip"&gt;here&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;Enjoy!&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.theproblemsolver.nl/"&gt;www.TheProblemSolver.nl &lt;/a&gt;   &lt;br /&gt;&lt;a href="http://wiki.windowsworkflowfoundation.eu/"&gt;Wiki.WindowsWorkflowFoundation.eu&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1732609" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/.NET/default.aspx">.NET</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/VSTO/default.aspx">VSTO</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/VB/default.aspx">VB</category></item><item><title>Error Logging Modules and Handlers for ASP.NET (MVC)</title><link>http://msmvps.com/blogs/theproblemsolver/archive/2009/08/13/error-logging-modules-and-handlers-for-asp-net-mvc.aspx</link><pubDate>Thu, 13 Aug 2009 12:40:20 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1715322</guid><dc:creator>Maurice</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/theproblemsolver/rsscomments.aspx?PostID=1715322</wfw:commentRss><comments>http://msmvps.com/blogs/theproblemsolver/archive/2009/08/13/error-logging-modules-and-handlers-for-asp-net-mvc.aspx#comments</comments><description>&lt;p&gt;I am working on a new ASP.NET MVC app and like so many other applications out there I need to log any errors should they occur. recently I heard about &lt;a href="http://code.google.com/p/elmah/"&gt;ELMAH&lt;/a&gt; Error Logging Modules and Handlers for ASP.NET through &lt;a href="http://www.hanselman.com/blog/ELMAHErrorLoggingModulesAndHandlersForASPNETAndMVCToo.aspx"&gt;this&lt;/a&gt; blog post of Scott Hanselman. So as using en existing and proven solution is always better that reinventing the wheel I decided to try ELMAH and see how easy it is to get started.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Well I can only say I am positively amazed at how easy it is. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://code.google.com/p/elmah/"&gt;&lt;img style="border-bottom:0px;border-left:0px;display:inline;border-top:0px;border-right:0px;" title="homeshot[1]" border="0" alt="homeshot[1]" src="http://msmvps.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/theproblemsolver.metablogapi/8424.homeshot1_5F00_412BE50B.png" width="633" height="484" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Starting from scratch it took me less that 2 hours to download and integrate it into my current ASP.NET MVC application and log all errors to SQL Server. That is including security so not everyone can check the error log.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;There are lots of additional capabilities I haven’t looked at yet like setting up an RSS feed, emailing or even tweeting errors messages. But judging from the experience so far that should prove easy enough.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;My only regret is that I didn’t check it out before.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Checkout the project run by Atif Aziz &lt;a href="http://code.google.com/p/elmah/"&gt;here&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Enjoy!&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.theproblemsolver.nl/"&gt;www.TheProblemSolver.nl &lt;/a&gt;   &lt;br /&gt;&lt;a href="http://wiki.windowsworkflowfoundation.eu/"&gt;Wiki.WindowsWorkflowFoundation.eu&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1715322" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/.NET/default.aspx">.NET</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/VB/default.aspx">VB</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/DevCenter/default.aspx">DevCenter</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/ASP.NET/default.aspx">ASP.NET</category></item><item><title>Getting started with the .NET RIA Services</title><link>http://msmvps.com/blogs/theproblemsolver/archive/2009/06/30/getting-started-with-the-net-ria-services.aspx</link><pubDate>Tue, 30 Jun 2009 16:34:38 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1697362</guid><dc:creator>Maurice</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/theproblemsolver/rsscomments.aspx?PostID=1697362</wfw:commentRss><comments>http://msmvps.com/blogs/theproblemsolver/archive/2009/06/30/getting-started-with-the-net-ria-services.aspx#comments</comments><description>&lt;p&gt;A recent article I wrote for the MSDN website just went live.&lt;/p&gt;  &lt;p&gt;Read is &lt;a href="http://msdn.microsoft.com/en-us/library/dd776095.aspx"&gt;here&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1697362" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/.NET/default.aspx">.NET</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/VB/default.aspx">VB</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/DevCenter/default.aspx">DevCenter</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/Silverlight/default.aspx">Silverlight</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/ASP.NET/default.aspx">ASP.NET</category></item><item><title>Passing data into a Windows Workflow Foundation 4 workflow</title><link>http://msmvps.com/blogs/theproblemsolver/archive/2009/06/30/passing-data-into-a-windows-workflow-foundation-4-workflow.aspx</link><pubDate>Tue, 30 Jun 2009 13:51:03 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1697335</guid><dc:creator>Maurice</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/theproblemsolver/rsscomments.aspx?PostID=1697335</wfw:commentRss><comments>http://msmvps.com/blogs/theproblemsolver/archive/2009/06/30/passing-data-into-a-windows-workflow-foundation-4-workflow.aspx#comments</comments><description>&lt;p&gt;Passing parameters into a workflow is similar in WF4 as it was in WF3.&lt;/p&gt;  &lt;p&gt;In both case a Dictionary&amp;lt;string, object&amp;gt; is passed in when creating the workflow instance object. Alternatively when using the WF4 WorkflowInvoker you can pass it into the Invoke() method.&lt;/p&gt;  &lt;p&gt;This is quite simple but I have never been a fan of the very loose coupling here. basically on the outside you have to create a dictionary with as key something inside of the workflow. No compile time checking. No improvement where, unless you consider the somewhat easier unit testing with the WorkflowInvoker.&lt;/p&gt;  &lt;p&gt;The actual behavior between WF3 and WF4 is quite different however. &lt;/p&gt;  &lt;p&gt;In Wf3 if you pass in a key that doesn’t match up you get a System.Reflection.TargetInvocationException with a System.InvalidOperationException inner exception with the text: “This operation can not be performed at runtime.”. Great help in debugging &lt;img src="http://msmvps.com/emoticons/emotion-6.gif" alt="Sad" /&gt;&lt;/p&gt;  &lt;p&gt;In WF4 on the other hand you get no error at all. The value is just ignored so it is even harder to detect typos. Well I guess not every change can be an improvement. And just in case you where thinking “But a unit test will take care of that right?” keep in mind that workflows tend to be complex and long running things not very well suited to unit testing.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Starting a workflow with a parameter:&lt;/p&gt;  &lt;div id="codeSnippetWrapper"&gt;   &lt;div style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;" id="codeSnippet"&gt;     &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#0000ff;"&gt;Shared&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;Sub&lt;/span&gt; Main()&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;    &lt;span style="color:#0000ff;"&gt;Dim&lt;/span&gt; inArgs &lt;span style="color:#0000ff;"&gt;As&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;New&lt;/span&gt; Dictionary(Of &lt;span style="color:#0000ff;"&gt;String&lt;/span&gt;, &lt;span style="color:#0000ff;"&gt;Object&lt;/span&gt;)&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;    inArgs(&lt;span style="color:#006080;"&gt;&amp;quot;Name&amp;quot;&lt;/span&gt;) = &lt;span style="color:#006080;"&gt;&amp;quot;Maurice&amp;quot;&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;&amp;#160;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;    &lt;span style="color:#0000ff;"&gt;Dim&lt;/span&gt; myInstance &lt;span style="color:#0000ff;"&gt;As&lt;/span&gt; WorkflowInstance = &lt;span style="color:#0000ff;"&gt;New&lt;/span&gt; WorkflowInstance(&lt;span style="color:#0000ff;"&gt;New&lt;/span&gt; Sequence1(), inArgs)&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;    myInstance.OnCompleted = &lt;span style="color:#0000ff;"&gt;AddressOf&lt;/span&gt; OnWorkflowCompleted&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;    myInstance.OnAborted = &lt;span style="color:#0000ff;"&gt;AddressOf&lt;/span&gt; OnWorkflowAborted&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;    myInstance.OnUnhandledException = &lt;span style="color:#0000ff;"&gt;AddressOf&lt;/span&gt; OnWorkflowUnhandledException&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;    myInstance.Run()&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;&amp;#160;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;    syncEvent.WaitOne()&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#0000ff;"&gt;End&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;Sub&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;So where is this Name value actually stored?&lt;/p&gt;

&lt;p&gt;Well in WF3 that would have been stored in a property, possibly a dependency property, or a field. The types must match, exactly.&lt;/p&gt;

&lt;p&gt;In WF4 the notion of properties and fields is gone. No more dependency properties to tie everything together. So instead we have Variables and Arguments. Basically a variable is just like a variable in a function, only here it holds some value for an activity. Big difference is that a Variable is in scope, i.e. visible, to all nested activities as well. So basically it is a way of sharing state between different activities.&lt;/p&gt;

&lt;p&gt;To allows us to pass data into a workflow, or get something out, we need to use an Argument.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://msmvps.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/theproblemsolver.metablogapi/5381.image_5F00_2F4BC456.png"&gt;&lt;img style="border-bottom:0px;border-left:0px;display:inline;border-top:0px;border-right:0px;" title="image" border="0" alt="image" src="http://msmvps.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/theproblemsolver.metablogapi/7444.image_5F00_thumb_5F00_5390A8D8.png" width="644" height="351" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;In this case I have defined two arguments, the Name to pass into the workflow and the Greeting that will be the result of the workflow.&lt;/p&gt;

&lt;p&gt;Getting the result out is done in the OnCompleted delegate. This delegate is passed a WorkflowCompletedEventArgs which in turn contains another dictionary with all out argument.&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#0000ff;"&gt;Shared&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;Sub&lt;/span&gt; OnWorkflowCompleted(&lt;span style="color:#0000ff;"&gt;ByVal&lt;/span&gt; e &lt;span style="color:#0000ff;"&gt;As&lt;/span&gt; WorkflowCompletedEventArgs)&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;    &lt;span style="color:#0000ff;"&gt;Dim&lt;/span&gt; greeting &lt;span style="color:#0000ff;"&gt;As&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;String&lt;/span&gt; = e.Outputs(&lt;span style="color:#006080;"&gt;&amp;quot;Greeting&amp;quot;&lt;/span&gt;)&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;    Console.WriteLine(greeting)&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;&amp;#160;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;    syncEvent.&lt;span style="color:#0000ff;"&gt;Set&lt;/span&gt;()&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#0000ff;"&gt;End&lt;/span&gt; Sub&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;Again not very different from WF3 where we used the WorkflowCompleted event and the OutputParameters dictionary from the WorkflowRuntime.&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;While there are quite a few differences in the details the basic approach remains the same. And as the old approach with dictionaries was rather error prone I consider this a missed chance &lt;img src="http://msmvps.com/emoticons/emotion-6.gif" alt="Sad" /&gt;&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;Enjoy!&lt;/p&gt;

&lt;p&gt;&lt;a href="http://www.theproblemsolver.nl/"&gt;www.TheProblemSolver.nl &lt;/a&gt;
  &lt;br /&gt;&lt;a href="http://wiki.windowsworkflowfoundation.eu/"&gt;Wiki.WindowsWorkflowFoundation.eu&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1697335" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/.NET/default.aspx">.NET</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/Workflow/default.aspx">Workflow</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/VB/default.aspx">VB</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/DevCenter/default.aspx">DevCenter</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/WF4/default.aspx">WF4</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/VS2010/default.aspx">VS2010</category></item><item><title>Paging with the Silverlight RIA services DomainDataSource</title><link>http://msmvps.com/blogs/theproblemsolver/archive/2009/04/27/paging-with-the-silverlight-ria-services-domaindatasource.aspx</link><pubDate>Mon, 27 Apr 2009 08:57:46 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1691375</guid><dc:creator>Maurice</dc:creator><slash:comments>27</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/theproblemsolver/rsscomments.aspx?PostID=1691375</wfw:commentRss><comments>http://msmvps.com/blogs/theproblemsolver/archive/2009/04/27/paging-with-the-silverlight-ria-services-domaindatasource.aspx#comments</comments><description>&lt;p&gt;Using the declarative DomainDataSource that is part of the upcoming Silverlight 3 RIA services makes it quite easy to work with data. All you need to do is add a DomainDataSource control to the the XAML, point it to the generated DomainContext class (in this case NorthwindContext) and tell it which method to use to load the data from the web service(in this case LoadCustomers). Next add a DataGrid to display the data and you are good to go.&lt;/p&gt;  &lt;div id="codeSnippetWrapper" style="border-right:silver 1px solid;padding-right:4px;border-top:silver 1px solid;padding-left:4px;font-size:8pt;padding-bottom:4px;margin:20px 0px 10px;overflow:auto;border-left:silver 1px solid;width:97.5%;cursor:text;direction:ltr;max-height:200px;line-height:12pt;padding-top:4px;border-bottom:silver 1px solid;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;text-align:left;"&gt;   &lt;div id="codeSnippet" style="padding-right:0px;padding-left:0px;font-size:8pt;padding-bottom:0px;overflow:visible;width:100%;color:black;direction:ltr;border-top-style:none;line-height:12pt;padding-top:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;border-right-style:none;border-left-style:none;background-color:#f4f4f4;text-align:left;border-bottom-style:none;"&gt;     &lt;pre style="padding-right:0px;padding-left:0px;font-size:8pt;padding-bottom:0px;margin:0em;overflow:visible;width:100%;color:black;direction:ltr;border-top-style:none;line-height:12pt;padding-top:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;border-right-style:none;border-left-style:none;background-color:white;text-align:left;border-bottom-style:none;"&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;UserControl&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;xmlns:dataControls&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data.DataForm&amp;quot;&lt;/span&gt;  &lt;span style="color:#ff0000;"&gt;x:Class&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;LOBUsingRIAServices.CustomerListPage&amp;quot;&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="padding-right:0px;padding-left:0px;font-size:8pt;padding-bottom:0px;margin:0em;overflow:visible;width:100%;color:black;direction:ltr;border-top-style:none;line-height:12pt;padding-top:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;border-right-style:none;border-left-style:none;background-color:#f4f4f4;text-align:left;border-bottom-style:none;"&gt;             &lt;span style="color:#ff0000;"&gt;xmlns:data&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data&amp;quot;&lt;/span&gt;  &lt;/pre&gt;


    &lt;pre style="padding-right:0px;padding-left:0px;font-size:8pt;padding-bottom:0px;margin:0em;overflow:visible;width:100%;color:black;direction:ltr;border-top-style:none;line-height:12pt;padding-top:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;border-right-style:none;border-left-style:none;background-color:white;text-align:left;border-bottom-style:none;"&gt;             &lt;span style="color:#ff0000;"&gt;xmlns:riaControls&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;clr-namespace:System.Windows.Controls;assembly=System.Windows.Ria.Controls&amp;quot;&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="padding-right:0px;padding-left:0px;font-size:8pt;padding-bottom:0px;margin:0em;overflow:visible;width:100%;color:black;direction:ltr;border-top-style:none;line-height:12pt;padding-top:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;border-right-style:none;border-left-style:none;background-color:#f4f4f4;text-align:left;border-bottom-style:none;"&gt;             &lt;span style="color:#ff0000;"&gt;xmlns:web&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;clr-namespace:LOBUsingRIAServices.Web&amp;quot;&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="padding-right:0px;padding-left:0px;font-size:8pt;padding-bottom:0px;margin:0em;overflow:visible;width:100%;color:black;direction:ltr;border-top-style:none;line-height:12pt;padding-top:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;border-right-style:none;border-left-style:none;background-color:white;text-align:left;border-bottom-style:none;"&gt;             &lt;span style="color:#ff0000;"&gt;xmlns&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&amp;quot;&lt;/span&gt; &lt;/pre&gt;


    &lt;pre style="padding-right:0px;padding-left:0px;font-size:8pt;padding-bottom:0px;margin:0em;overflow:visible;width:100%;color:black;direction:ltr;border-top-style:none;line-height:12pt;padding-top:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;border-right-style:none;border-left-style:none;background-color:#f4f4f4;text-align:left;border-bottom-style:none;"&gt;             &lt;span style="color:#ff0000;"&gt;xmlns:x&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml&amp;quot;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="padding-right:0px;padding-left:0px;font-size:8pt;padding-bottom:0px;margin:0em;overflow:visible;width:100%;color:black;direction:ltr;border-top-style:none;line-height:12pt;padding-top:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;border-right-style:none;border-left-style:none;background-color:white;text-align:left;border-bottom-style:none;"&gt;    &lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;Grid&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;x:Name&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;LayoutRoot&amp;quot;&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;Background&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;White&amp;quot;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="padding-right:0px;padding-left:0px;font-size:8pt;padding-bottom:0px;margin:0em;overflow:visible;width:100%;color:black;direction:ltr;border-top-style:none;line-height:12pt;padding-top:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;border-right-style:none;border-left-style:none;background-color:#f4f4f4;text-align:left;border-bottom-style:none;"&gt;        &lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;riaControls:DomainDataSource&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;x:Name&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;CustomerDataSource&amp;quot;&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="padding-right:0px;padding-left:0px;font-size:8pt;padding-bottom:0px;margin:0em;overflow:visible;width:100%;color:black;direction:ltr;border-top-style:none;line-height:12pt;padding-top:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;border-right-style:none;border-left-style:none;background-color:white;text-align:left;border-bottom-style:none;"&gt;                                      &lt;span style="color:#ff0000;"&gt;LoadMethodName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;LoadCustomers&amp;quot;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="padding-right:0px;padding-left:0px;font-size:8pt;padding-bottom:0px;margin:0em;overflow:visible;width:100%;color:black;direction:ltr;border-top-style:none;line-height:12pt;padding-top:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;border-right-style:none;border-left-style:none;background-color:#f4f4f4;text-align:left;border-bottom-style:none;"&gt;            &lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;riaControls:DomainDataSource.DomainContext&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="padding-right:0px;padding-left:0px;font-size:8pt;padding-bottom:0px;margin:0em;overflow:visible;width:100%;color:black;direction:ltr;border-top-style:none;line-height:12pt;padding-top:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;border-right-style:none;border-left-style:none;background-color:white;text-align:left;border-bottom-style:none;"&gt;                &lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;web:NorthwindContext&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="padding-right:0px;padding-left:0px;font-size:8pt;padding-bottom:0px;margin:0em;overflow:visible;width:100%;color:black;direction:ltr;border-top-style:none;line-height:12pt;padding-top:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;border-right-style:none;border-left-style:none;background-color:#f4f4f4;text-align:left;border-bottom-style:none;"&gt;            &lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#800000;"&gt;riaControls:DomainDataSource.DomainContext&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="padding-right:0px;padding-left:0px;font-size:8pt;padding-bottom:0px;margin:0em;overflow:visible;width:100%;color:black;direction:ltr;border-top-style:none;line-height:12pt;padding-top:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;border-right-style:none;border-left-style:none;background-color:white;text-align:left;border-bottom-style:none;"&gt;        &lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#800000;"&gt;riaControls:DomainDataSource&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="padding-right:0px;padding-left:0px;font-size:8pt;padding-bottom:0px;margin:0em;overflow:visible;width:100%;color:black;direction:ltr;border-top-style:none;line-height:12pt;padding-top:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;border-right-style:none;border-left-style:none;background-color:#f4f4f4;text-align:left;border-bottom-style:none;"&gt;        &lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;data:DataGrid&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;ItemsSource&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;{Binding Data, ElementName=CustomerDataSource}&amp;quot;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="padding-right:0px;padding-left:0px;font-size:8pt;padding-bottom:0px;margin:0em;overflow:visible;width:100%;color:black;direction:ltr;border-top-style:none;line-height:12pt;padding-top:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;border-right-style:none;border-left-style:none;background-color:white;text-align:left;border-bottom-style:none;"&gt;    &lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#800000;"&gt;Grid&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="padding-right:0px;padding-left:0px;font-size:8pt;padding-bottom:0px;margin:0em;overflow:visible;width:100%;color:black;direction:ltr;border-top-style:none;line-height:12pt;padding-top:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;border-right-style:none;border-left-style:none;background-color:#f4f4f4;text-align:left;border-bottom-style:none;"&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#800000;"&gt;UserControl&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;Pretty simple and that is the way I like it &lt;img src="http://msmvps.com/emoticons/emotion-1.gif" alt="Smile" /&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Adding paging.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Sometimes the lost of data to load can get somewhat large and you might not want to load all data. In that case all you need to do is add a PageSize and the DomainDataSource will only load enough data to display on a single page. You can do this by just setting the PageSize on the DomainDataSource but as we also need a control to allow the user to page trough the data it is easier to also add the DataPager control. Now you have the option of setting the PageSize on the DomainDataSource or the DataPager. I found that setting it on either would work just was well except for the initial load where the DataPager shows page 0 when the PageSize is set on the DomainDataSource while it is set to 1, the correct value, when set on the DataPager. I assume this is just a small bug in the current preview.&lt;/p&gt;

&lt;p&gt;Another thing you can specify is the LoadSize. This determines how many rows are loaded with each request and if not set equals the PageSize. Setting this to double the PageSize will improve the responsiveness of the the client application so might be a good idea if the data isn’t too large.&lt;/p&gt;

&lt;div id="codeSnippetWrapper" style="border-right:silver 1px solid;padding-right:4px;border-top:silver 1px solid;padding-left:4px;font-size:8pt;padding-bottom:4px;margin:20px 0px 10px;overflow:auto;border-left:silver 1px solid;width:97.5%;cursor:text;direction:ltr;max-height:200px;line-height:12pt;padding-top:4px;border-bottom:silver 1px solid;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;text-align:left;"&gt;
  &lt;div id="codeSnippet" style="padding-right:0px;padding-left:0px;font-size:8pt;padding-bottom:0px;overflow:visible;width:100%;color:black;direction:ltr;border-top-style:none;line-height:12pt;padding-top:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;border-right-style:none;border-left-style:none;background-color:#f4f4f4;text-align:left;border-bottom-style:none;"&gt;
    &lt;pre style="padding-right:0px;padding-left:0px;font-size:8pt;padding-bottom:0px;margin:0em;overflow:visible;width:100%;color:black;direction:ltr;border-top-style:none;line-height:12pt;padding-top:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;border-right-style:none;border-left-style:none;background-color:white;text-align:left;border-bottom-style:none;"&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;UserControl&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;xmlns:dataControls&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data.DataForm&amp;quot;&lt;/span&gt;  &lt;span style="color:#ff0000;"&gt;x:Class&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;LOBUsingRIAServices.CustomerListPage&amp;quot;&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="padding-right:0px;padding-left:0px;font-size:8pt;padding-bottom:0px;margin:0em;overflow:visible;width:100%;color:black;direction:ltr;border-top-style:none;line-height:12pt;padding-top:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;border-right-style:none;border-left-style:none;background-color:#f4f4f4;text-align:left;border-bottom-style:none;"&gt;             &lt;span style="color:#ff0000;"&gt;xmlns:data&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data&amp;quot;&lt;/span&gt;  &lt;/pre&gt;


    &lt;pre style="padding-right:0px;padding-left:0px;font-size:8pt;padding-bottom:0px;margin:0em;overflow:visible;width:100%;color:black;direction:ltr;border-top-style:none;line-height:12pt;padding-top:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;border-right-style:none;border-left-style:none;background-color:white;text-align:left;border-bottom-style:none;"&gt;             &lt;span style="color:#ff0000;"&gt;xmlns:riaControls&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;clr-namespace:System.Windows.Controls;assembly=System.Windows.Ria.Controls&amp;quot;&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="padding-right:0px;padding-left:0px;font-size:8pt;padding-bottom:0px;margin:0em;overflow:visible;width:100%;color:black;direction:ltr;border-top-style:none;line-height:12pt;padding-top:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;border-right-style:none;border-left-style:none;background-color:#f4f4f4;text-align:left;border-bottom-style:none;"&gt;             &lt;span style="color:#ff0000;"&gt;xmlns:web&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;clr-namespace:LOBUsingRIAServices.Web&amp;quot;&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="padding-right:0px;padding-left:0px;font-size:8pt;padding-bottom:0px;margin:0em;overflow:visible;width:100%;color:black;direction:ltr;border-top-style:none;line-height:12pt;padding-top:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;border-right-style:none;border-left-style:none;background-color:white;text-align:left;border-bottom-style:none;"&gt;             &lt;span style="color:#ff0000;"&gt;xmlns&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&amp;quot;&lt;/span&gt; &lt;/pre&gt;


    &lt;pre style="padding-right:0px;padding-left:0px;font-size:8pt;padding-bottom:0px;margin:0em;overflow:visible;width:100%;color:black;direction:ltr;border-top-style:none;line-height:12pt;padding-top:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;border-right-style:none;border-left-style:none;background-color:#f4f4f4;text-align:left;border-bottom-style:none;"&gt;             &lt;span style="color:#ff0000;"&gt;xmlns:x&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml&amp;quot;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="padding-right:0px;padding-left:0px;font-size:8pt;padding-bottom:0px;margin:0em;overflow:visible;width:100%;color:black;direction:ltr;border-top-style:none;line-height:12pt;padding-top:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;border-right-style:none;border-left-style:none;background-color:white;text-align:left;border-bottom-style:none;"&gt;    &lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;Grid&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;x:Name&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;LayoutRoot&amp;quot;&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;Background&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;White&amp;quot;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="padding-right:0px;padding-left:0px;font-size:8pt;padding-bottom:0px;margin:0em;overflow:visible;width:100%;color:black;direction:ltr;border-top-style:none;line-height:12pt;padding-top:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;border-right-style:none;border-left-style:none;background-color:#f4f4f4;text-align:left;border-bottom-style:none;"&gt;        &lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;riaControls:DomainDataSource&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;x:Name&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;CustomerDataSource&amp;quot;&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="padding-right:0px;padding-left:0px;font-size:8pt;padding-bottom:0px;margin:0em;overflow:visible;width:100%;color:black;direction:ltr;border-top-style:none;line-height:12pt;padding-top:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;border-right-style:none;border-left-style:none;background-color:white;text-align:left;border-bottom-style:none;"&gt;                                      &lt;span style="color:#ff0000;"&gt;LoadMethodName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;LoadCustomers&amp;quot;&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="padding-right:0px;padding-left:0px;font-size:8pt;padding-bottom:0px;margin:0em;overflow:visible;width:100%;color:black;direction:ltr;border-top-style:none;line-height:12pt;padding-top:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;border-right-style:none;border-left-style:none;background-color:#f4f4f4;text-align:left;border-bottom-style:none;"&gt;                                      &lt;span style="color:#ff0000;"&gt;LoadSize&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;40&amp;quot;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="padding-right:0px;padding-left:0px;font-size:8pt;padding-bottom:0px;margin:0em;overflow:visible;width:100%;color:black;direction:ltr;border-top-style:none;line-height:12pt;padding-top:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;border-right-style:none;border-left-style:none;background-color:white;text-align:left;border-bottom-style:none;"&gt;            &lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;riaControls:DomainDataSource.DomainContext&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="padding-right:0px;padding-left:0px;font-size:8pt;padding-bottom:0px;margin:0em;overflow:visible;width:100%;color:black;direction:ltr;border-top-style:none;line-height:12pt;padding-top:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;border-right-style:none;border-left-style:none;background-color:#f4f4f4;text-align:left;border-bottom-style:none;"&gt;                &lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;web:NorthwindContext&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="padding-right:0px;padding-left:0px;font-size:8pt;padding-bottom:0px;margin:0em;overflow:visible;width:100%;color:black;direction:ltr;border-top-style:none;line-height:12pt;padding-top:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;border-right-style:none;border-left-style:none;background-color:white;text-align:left;border-bottom-style:none;"&gt;            &lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#800000;"&gt;riaControls:DomainDataSource.DomainContext&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="padding-right:0px;padding-left:0px;font-size:8pt;padding-bottom:0px;margin:0em;overflow:visible;width:100%;color:black;direction:ltr;border-top-style:none;line-height:12pt;padding-top:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;border-right-style:none;border-left-style:none;background-color:#f4f4f4;text-align:left;border-bottom-style:none;"&gt;        &lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#800000;"&gt;riaControls:DomainDataSource&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="padding-right:0px;padding-left:0px;font-size:8pt;padding-bottom:0px;margin:0em;overflow:visible;width:100%;color:black;direction:ltr;border-top-style:none;line-height:12pt;padding-top:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;border-right-style:none;border-left-style:none;background-color:white;text-align:left;border-bottom-style:none;"&gt;        &lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;data:DataGrid&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;ItemsSource&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;{Binding Data, ElementName=CustomerDataSource}&amp;quot;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="padding-right:0px;padding-left:0px;font-size:8pt;padding-bottom:0px;margin:0em;overflow:visible;width:100%;color:black;direction:ltr;border-top-style:none;line-height:12pt;padding-top:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;border-right-style:none;border-left-style:none;background-color:#f4f4f4;text-align:left;border-bottom-style:none;"&gt;        &lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;dataControls:DataPager&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;Source&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;{Binding Data, ElementName=CustomerDataSource}&amp;quot;&lt;/span&gt; &lt;/pre&gt;


    &lt;pre style="padding-right:0px;padding-left:0px;font-size:8pt;padding-bottom:0px;margin:0em;overflow:visible;width:100%;color:black;direction:ltr;border-top-style:none;line-height:12pt;padding-top:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;border-right-style:none;border-left-style:none;background-color:white;text-align:left;border-bottom-style:none;"&gt;                                &lt;span style="color:#ff0000;"&gt;PageSize&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;20&amp;quot;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="padding-right:0px;padding-left:0px;font-size:8pt;padding-bottom:0px;margin:0em;overflow:visible;width:100%;color:black;direction:ltr;border-top-style:none;line-height:12pt;padding-top:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;border-right-style:none;border-left-style:none;background-color:#f4f4f4;text-align:left;border-bottom-style:none;"&gt;    &lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#800000;"&gt;Grid&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="padding-right:0px;padding-left:0px;font-size:8pt;padding-bottom:0px;margin:0em;overflow:visible;width:100%;color:black;direction:ltr;border-top-style:none;line-height:12pt;padding-top:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;border-right-style:none;border-left-style:none;background-color:white;text-align:left;border-bottom-style:none;"&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#800000;"&gt;UserControl&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;The DataPager control is quite easy to use as well. Just drop it below the DataGrid and point it to the DomainDataSource to use and it just works. One problem I ran into was adding the DataPager above the DataGrid though. When I did that the DataPager didn’t show up on the UI so the user could not page through the data even though it still limited the data to the first page.&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Using progressive loading&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Another nice option is delayed loading. When using progressive loading all you need to do is specify the LoadSize on the DomainDataSource. The DomainDataSource will now load the specified number of rows, wait a bit and load the next set of rows. It will keep on doing this until all data is loaded. The nice thing here is that all the data is loaded but the UI still stays responsive for the user. De the default interval between load requests is 0.75 seconds but this can be fine tuned using the LoadDelay time span on the DomainDataSource.&lt;/p&gt;

&lt;div id="codeSnippetWrapper" style="border-right:silver 1px solid;padding-right:4px;border-top:silver 1px solid;padding-left:4px;font-size:8pt;padding-bottom:4px;margin:20px 0px 10px;overflow:auto;border-left:silver 1px solid;width:97.5%;cursor:text;direction:ltr;max-height:200px;line-height:12pt;padding-top:4px;border-bottom:silver 1px solid;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;text-align:left;"&gt;
  &lt;div id="codeSnippet" style="padding-right:0px;padding-left:0px;font-size:8pt;padding-bottom:0px;overflow:visible;width:100%;color:black;direction:ltr;border-top-style:none;line-height:12pt;padding-top:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;border-right-style:none;border-left-style:none;background-color:#f4f4f4;text-align:left;border-bottom-style:none;"&gt;
    &lt;pre style="padding-right:0px;padding-left:0px;font-size:8pt;padding-bottom:0px;margin:0em;overflow:visible;width:100%;color:black;direction:ltr;border-top-style:none;line-height:12pt;padding-top:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;border-right-style:none;border-left-style:none;background-color:white;text-align:left;border-bottom-style:none;"&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;UserControl&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;xmlns:dataControls&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data.DataForm&amp;quot;&lt;/span&gt;  &lt;span style="color:#ff0000;"&gt;x:Class&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;LOBUsingRIAServices.CustomerListPage&amp;quot;&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="padding-right:0px;padding-left:0px;font-size:8pt;padding-bottom:0px;margin:0em;overflow:visible;width:100%;color:black;direction:ltr;border-top-style:none;line-height:12pt;padding-top:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;border-right-style:none;border-left-style:none;background-color:#f4f4f4;text-align:left;border-bottom-style:none;"&gt;             &lt;span style="color:#ff0000;"&gt;xmlns:data&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data&amp;quot;&lt;/span&gt;  &lt;/pre&gt;


    &lt;pre style="padding-right:0px;padding-left:0px;font-size:8pt;padding-bottom:0px;margin:0em;overflow:visible;width:100%;color:black;direction:ltr;border-top-style:none;line-height:12pt;padding-top:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;border-right-style:none;border-left-style:none;background-color:white;text-align:left;border-bottom-style:none;"&gt;             &lt;span style="color:#ff0000;"&gt;xmlns:riaControls&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;clr-namespace:System.Windows.Controls;assembly=System.Windows.Ria.Controls&amp;quot;&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="padding-right:0px;padding-left:0px;font-size:8pt;padding-bottom:0px;margin:0em;overflow:visible;width:100%;color:black;direction:ltr;border-top-style:none;line-height:12pt;padding-top:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;border-right-style:none;border-left-style:none;background-color:#f4f4f4;text-align:left;border-bottom-style:none;"&gt;             &lt;span style="color:#ff0000;"&gt;xmlns:web&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;clr-namespace:LOBUsingRIAServices.Web&amp;quot;&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="padding-right:0px;padding-left:0px;font-size:8pt;padding-bottom:0px;margin:0em;overflow:visible;width:100%;color:black;direction:ltr;border-top-style:none;line-height:12pt;padding-top:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;border-right-style:none;border-left-style:none;background-color:white;text-align:left;border-bottom-style:none;"&gt;             &lt;span style="color:#ff0000;"&gt;xmlns&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&amp;quot;&lt;/span&gt; &lt;/pre&gt;


    &lt;pre style="padding-right:0px;padding-left:0px;font-size:8pt;padding-bottom:0px;margin:0em;overflow:visible;width:100%;color:black;direction:ltr;border-top-style:none;line-height:12pt;padding-top:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;border-right-style:none;border-left-style:none;background-color:#f4f4f4;text-align:left;border-bottom-style:none;"&gt;             &lt;span style="color:#ff0000;"&gt;xmlns:x&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml&amp;quot;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="padding-right:0px;padding-left:0px;font-size:8pt;padding-bottom:0px;margin:0em;overflow:visible;width:100%;color:black;direction:ltr;border-top-style:none;line-height:12pt;padding-top:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;border-right-style:none;border-left-style:none;background-color:white;text-align:left;border-bottom-style:none;"&gt;    &lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;Grid&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;x:Name&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;LayoutRoot&amp;quot;&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;Background&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;White&amp;quot;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="padding-right:0px;padding-left:0px;font-size:8pt;padding-bottom:0px;margin:0em;overflow:visible;width:100%;color:black;direction:ltr;border-top-style:none;line-height:12pt;padding-top:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;border-right-style:none;border-left-style:none;background-color:#f4f4f4;text-align:left;border-bottom-style:none;"&gt;        &lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;riaControls:DomainDataSource&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;x:Name&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;CustomerDataSource&amp;quot;&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="padding-right:0px;padding-left:0px;font-size:8pt;padding-bottom:0px;margin:0em;overflow:visible;width:100%;color:black;direction:ltr;border-top-style:none;line-height:12pt;padding-top:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;border-right-style:none;border-left-style:none;background-color:white;text-align:left;border-bottom-style:none;"&gt;                                      &lt;span style="color:#ff0000;"&gt;LoadMethodName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;LoadCustomers&amp;quot;&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="padding-right:0px;padding-left:0px;font-size:8pt;padding-bottom:0px;margin:0em;overflow:visible;width:100%;color:black;direction:ltr;border-top-style:none;line-height:12pt;padding-top:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;border-right-style:none;border-left-style:none;background-color:#f4f4f4;text-align:left;border-bottom-style:none;"&gt;                                      &lt;span style="color:#ff0000;"&gt;LoadSize&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;10&amp;quot;&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="padding-right:0px;padding-left:0px;font-size:8pt;padding-bottom:0px;margin:0em;overflow:visible;width:100%;color:black;direction:ltr;border-top-style:none;line-height:12pt;padding-top:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;border-right-style:none;border-left-style:none;background-color:white;text-align:left;border-bottom-style:none;"&gt;                                      &lt;span style="color:#ff0000;"&gt;LoadDelay&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;0:0:0.25&amp;quot;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="padding-right:0px;padding-left:0px;font-size:8pt;padding-bottom:0px;margin:0em;overflow:visible;width:100%;color:black;direction:ltr;border-top-style:none;line-height:12pt;padding-top:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;border-right-style:none;border-left-style:none;background-color:#f4f4f4;text-align:left;border-bottom-style:none;"&gt;            &lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;riaControls:DomainDataSource.DomainContext&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="padding-right:0px;padding-left:0px;font-size:8pt;padding-bottom:0px;margin:0em;overflow:visible;width:100%;color:black;direction:ltr;border-top-style:none;line-height:12pt;padding-top:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;border-right-style:none;border-left-style:none;background-color:white;text-align:left;border-bottom-style:none;"&gt;                &lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;web:NorthwindContext&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="padding-right:0px;padding-left:0px;font-size:8pt;padding-bottom:0px;margin:0em;overflow:visible;width:100%;color:black;direction:ltr;border-top-style:none;line-height:12pt;padding-top:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;border-right-style:none;border-left-style:none;background-color:#f4f4f4;text-align:left;border-bottom-style:none;"&gt;            &lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#800000;"&gt;riaControls:DomainDataSource.DomainContext&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="padding-right:0px;padding-left:0px;font-size:8pt;padding-bottom:0px;margin:0em;overflow:visible;width:100%;color:black;direction:ltr;border-top-style:none;line-height:12pt;padding-top:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;border-right-style:none;border-left-style:none;background-color:white;text-align:left;border-bottom-style:none;"&gt;        &lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#800000;"&gt;riaControls:DomainDataSource&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="padding-right:0px;padding-left:0px;font-size:8pt;padding-bottom:0px;margin:0em;overflow:visible;width:100%;color:black;direction:ltr;border-top-style:none;line-height:12pt;padding-top:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;border-right-style:none;border-left-style:none;background-color:#f4f4f4;text-align:left;border-bottom-style:none;"&gt;        &lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;data:DataGrid&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;ItemsSource&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;{Binding Data, ElementName=CustomerDataSource}&amp;quot;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="padding-right:0px;padding-left:0px;font-size:8pt;padding-bottom:0px;margin:0em;overflow:visible;width:100%;color:black;direction:ltr;border-top-style:none;line-height:12pt;padding-top:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;border-right-style:none;border-left-style:none;background-color:white;text-align:left;border-bottom-style:none;"&gt;    &lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#800000;"&gt;Grid&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="padding-right:0px;padding-left:0px;font-size:8pt;padding-bottom:0px;margin:0em;overflow:visible;width:100%;color:black;direction:ltr;border-top-style:none;line-height:12pt;padding-top:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;border-right-style:none;border-left-style:none;background-color:#f4f4f4;text-align:left;border-bottom-style:none;"&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#800000;"&gt;UserControl&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;And all of this was done without writing any code add everything was completely declarative. Of course it is just a matter of setting properties so doing so from code is easy enough.&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;Enjoy!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1691375" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/.NET/default.aspx">.NET</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/VB/default.aspx">VB</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/DevCenter/default.aspx">DevCenter</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/Silverlight/default.aspx">Silverlight</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/Data+Access/default.aspx">Data Access</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/ASP.NET/default.aspx">ASP.NET</category></item><item><title>Adding a custom machineKey section to the web.config</title><link>http://msmvps.com/blogs/theproblemsolver/archive/2009/04/08/adding-a-custom-machinekey-section-to-the-web-config.aspx</link><pubDate>Wed, 08 Apr 2009 12:41:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1685915</guid><dc:creator>Maurice</dc:creator><slash:comments>4</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/theproblemsolver/rsscomments.aspx?PostID=1685915</wfw:commentRss><comments>http://msmvps.com/blogs/theproblemsolver/archive/2009/04/08/adding-a-custom-machinekey-section-to-the-web-config.aspx#comments</comments><description>&lt;p&gt;






 
  Normal
  0
  21
  
  
  false
  false
  false
  
   
   
   
   
   
  
  MicrosoftInternetExplorer4
 

 
 


&amp;lt;!--
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{mso-style-parent:&amp;quot;&amp;quot;;
	margin:0cm;
	margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	font-size:12.0pt;
	font-family:&amp;quot;Times New Roman&amp;quot;;
	mso-fareast-font-family:&amp;quot;Times New Roman&amp;quot;;}
a:link, span.MsoHyperlink
	{color:blue;
	text-decoration:underline;
	text-underline:single;}
a:visited, span.MsoHyperlinkFollowed
	{color:purple;
	text-decoration:underline;
	text-underline:single;}
@page Section1
	{size:612.0pt 792.0pt;
	margin:70.85pt 70.85pt 70.85pt 70.85pt;
	mso-header-margin:35.4pt;
	mso-footer-margin:35.4pt;
	mso-paper-source:0;}
div.Section1
	{page:Section1;}
--&amp;gt;



 /* Style Definitions */
 table.MsoNormalTable
	{mso-style-name:&amp;quot;Table Normal&amp;quot;;
	mso-tstyle-rowband-size:0;
	mso-tstyle-colband-size:0;
	mso-style-noshow:yes;
	mso-style-parent:&amp;quot;&amp;quot;;
	mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
	mso-para-margin:0cm;
	mso-para-margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	font-size:10.0pt;
	font-family:&amp;quot;Times New Roman&amp;quot;;
	mso-ansi-language:#0400;
	mso-fareast-language:#0400;
	mso-bidi-language:#0400;}

&lt;/p&gt;
&lt;p&gt;Normally you should never have to set the &amp;lt;machineKey&amp;gt; in the in the web.config. This is only needed when am ASP.NET site runs on a web farm and in that case the machines in question should be configured using the &lt;a href="http://msdn.microsoft.com/en-us/library/ms998288.aspx#paght000007_machinekeyexplained"&gt;machineKey&lt;/a&gt; instead of individual web applications. However we have run into the following exception a few times: &amp;ldquo;System.Web.UI.ViewStateException: Invalid viewstate&amp;rdquo; after leaving the browser idle for some time.&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Turns out that the &amp;lt;machineKey&amp;gt; that where supposed to be on the web farm where missing. Now this is a shared hoster so not much we can do about the machine configuration but adding this key to the web.config before deploying is simple enough.&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&lt;br /&gt;And generating the values to add is simple using &lt;a href="http://www.eggheadcafe.com/articles/GenerateMachineKey/GenerateMachineKey.aspx"&gt;this&lt;/a&gt; nifty, not my words, little generator.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.theproblemsolver.nl/"&gt;www.TheProblemSolver.nl &lt;/a&gt;&lt;br /&gt;&lt;a href="http://wiki.windowsworkflowfoundation.eu/"&gt;Wiki.WindowsWorkflowFoundation.eu&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1685915" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/.NET/default.aspx">.NET</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/VB/default.aspx">VB</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/ASP.NET/default.aspx">ASP.NET</category></item><item><title>.NET RIA Services and data communication</title><link>http://msmvps.com/blogs/theproblemsolver/archive/2009/04/06/net-ria-services-and-data-communication.aspx</link><pubDate>Mon, 06 Apr 2009 13:55:02 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1685128</guid><dc:creator>Maurice</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/theproblemsolver/rsscomments.aspx?PostID=1685128</wfw:commentRss><comments>http://msmvps.com/blogs/theproblemsolver/archive/2009/04/06/net-ria-services-and-data-communication.aspx#comments</comments><description>&lt;p&gt;I was working on an article about the .NET RIA Services and decided to fire up &lt;a href="http://www.fiddler2.com/fiddler2/"&gt;Fiddler&lt;/a&gt; to take a close look at the data actually passed around. I was sort of expecting to see a WCF REST based approach with XML messages. Turns out I was wrong, though I expect this option will be added in the future.&lt;/p&gt;  &lt;p&gt;It turns out the .NET RIA Services use JSON as their serialization format. This is actually kind of nice as the &lt;a href="http://msdn.microsoft.com/en-us/library/system.runtime.serialization.json.datacontractjsonserializer.aspx"&gt;DataContractJsonSerializer&lt;/a&gt; is part of the System.ServiceModel.Web assembly and therefore usable by all .NET clients. &lt;/p&gt;  &lt;p&gt;The good part is that a .NET RIA Service is also usable from a JavaScript browser based client. So the same .NET RIA Services library gives us lots of client options. Now this was always the plan but it is nice to see that the default already enable it.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;And the best thing?&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Well that is that I was already using the .NET RIA Services and never even needed to know how the messages where actually send across the wire, something I shouldn&amp;#39;t have to worry about when developing a RIA style application. Which is exactly the goal of the .NET RIA Services.&lt;/p&gt;  &lt;p&gt;Cool stuff and highly recommended if you want to create browser based LOB apps &lt;img src="http://msmvps.com/emoticons/emotion-1.gif" alt="Smile" /&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.theproblemsolver.nl/"&gt;www.TheProblemSolver.nl &lt;/a&gt;   &lt;br /&gt;&lt;a href="http://wiki.windowsworkflowfoundation.eu/"&gt;Wiki.WindowsWorkflowFoundation.eu&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;And now on Twitter at &lt;a href="http://twitter.com/mauricedb"&gt;http://twitter.com/mauricedb&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1685128" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/.NET/default.aspx">.NET</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/WCF/default.aspx">WCF</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/VB/default.aspx">VB</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/Silverlight/default.aspx">Silverlight</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/ASP.NET/default.aspx">ASP.NET</category></item><item><title>Want to download all MIX sessions?</title><link>http://msmvps.com/blogs/theproblemsolver/archive/2009/03/31/want-to-download-all-mix-sessions.aspx</link><pubDate>Tue, 31 Mar 2009 06:52:40 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1683235</guid><dc:creator>Maurice</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/theproblemsolver/rsscomments.aspx?PostID=1683235</wfw:commentRss><comments>http://msmvps.com/blogs/theproblemsolver/archive/2009/03/31/want-to-download-all-mix-sessions.aspx#comments</comments><description>&lt;p&gt;Then you should check Mike Swanson’s blog post &lt;a href="http://blogs.msdn.com/mswanson/archive/2009/03/26/mix09-keynote-and-session-videos.aspx"&gt;here&lt;/a&gt;. He has two batch files, the first downloads all MIX session recordings with in the format you like, the second renames them so it is easier to make sense of all the media file names.&lt;/p&gt;  &lt;p&gt;If you just want a list of all sessions with download links &lt;a href="http://videos.visitmix.com/MIX09/All"&gt;this&lt;/a&gt; page might be the thing for you.&lt;/p&gt;  &lt;p&gt;So much better than downloading them by hand. Not as good as going to the MIX itself but if you, like me, couldn’t go it is still a nice way to see all the content.&lt;/p&gt;  &lt;p&gt;Enjoy!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1683235" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/.NET/default.aspx">.NET</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/LINQ/default.aspx">LINQ</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/NetFx3/default.aspx">NetFx3</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/WCF/default.aspx">WCF</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/VB/default.aspx">VB</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/webcast/default.aspx">webcast</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/DevCenter/default.aspx">DevCenter</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/WPF/default.aspx">WPF</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/IronPython/default.aspx">IronPython</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/Silverlight/default.aspx">Silverlight</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/ASP.NET/default.aspx">ASP.NET</category></item><item><title>Visual Basic QuickStarts and How-to Topics for the Composite Application Guidance for WPF and Silverlight</title><link>http://msmvps.com/blogs/theproblemsolver/archive/2009/03/25/visual-basic-quickstarts-and-how-to-topics-for-the-composite-application-guidance-for-wpf-and-silverlight.aspx</link><pubDate>Wed, 25 Mar 2009 08:12:57 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1681248</guid><dc:creator>Maurice</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/theproblemsolver/rsscomments.aspx?PostID=1681248</wfw:commentRss><comments>http://msmvps.com/blogs/theproblemsolver/archive/2009/03/25/visual-basic-quickstarts-and-how-to-topics-for-the-composite-application-guidance-for-wpf-and-silverlight.aspx#comments</comments><description>&lt;p&gt;The P&amp;amp;P team have just release a VB version of the Prism quick starts.&lt;/p&gt;  &lt;p&gt;You can download the goods &lt;a href="http://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;amp;FamilyID=537da1cd-43e1-4799-88e7-a1da9166fb46"&gt;here&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;Enjoy!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1681248" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/.NET/default.aspx">.NET</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/VB/default.aspx">VB</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/DevCenter/default.aspx">DevCenter</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/WPF/default.aspx">WPF</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/Silverlight/default.aspx">Silverlight</category></item><item><title>Software Development Event march 30th</title><link>http://msmvps.com/blogs/theproblemsolver/archive/2009/03/23/software-development-event-march-30th.aspx</link><pubDate>Mon, 23 Mar 2009 15:40:29 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1680616</guid><dc:creator>Maurice</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/theproblemsolver/rsscomments.aspx?PostID=1680616</wfw:commentRss><comments>http://msmvps.com/blogs/theproblemsolver/archive/2009/03/23/software-development-event-march-30th.aspx#comments</comments><description>&lt;p&gt;Just one week to go to the next Software Development Event. The schedule with all the sessions is looking good. But this time there is even more! &lt;/p&gt;  &lt;p align="center"&gt;&lt;img height="384" src="http://blogs.microsoft.nl/blogs/ux/MSSC_34View_7C1948A0.jpg" width="572" alt="" /&gt; &lt;/p&gt;  &lt;p&gt;We will have a Microsoft &lt;a href="http://www.microsoft.com/surface/"&gt;Surface&lt;/a&gt; machine somewhere in the common area for people to try our. And if you have never played, oops tested, with a Surface machine before this is a truly exiting machine!&lt;/p&gt;  &lt;p&gt;Just goes to show, the SDN will go to extraordinary efforts to please all attendees &lt;img src="http://msmvps.com/emoticons/emotion-1.gif" alt="Smile" /&gt; &lt;/p&gt;  &lt;p&gt;You can see the full schedule &lt;a href="http://www.sdn.nl/SDN/SDNEvent/tabid/68/Default.aspx"&gt;here&lt;/a&gt;. And don’t forget, we are &lt;strong&gt;not&lt;/strong&gt; in Ede this time but in a great new &lt;a href="http://www.debergsebossen.nl/"&gt;location&lt;/a&gt; in Driebergen.&lt;/p&gt;  &lt;p&gt;Hope to see everyone there next week Monday.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.theproblemsolver.nl/"&gt;www.TheProblemSolver.nl &lt;/a&gt;   &lt;br /&gt;&lt;a href="http://wiki.windowsworkflowfoundation.eu/"&gt;Wiki.WindowsWorkflowFoundation.eu&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;And now on Twitter at &lt;a title="http://twitter.com/mauricedb" href="http://twitter.com/mauricedb"&gt;http://twitter.com/mauricedb&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1680616" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/.NET/default.aspx">.NET</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/LINQ/default.aspx">LINQ</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/NetFx3/default.aspx">NetFx3</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/WCF/default.aspx">WCF</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/VB/default.aspx">VB</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/WPF/default.aspx">WPF</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/Silverlight/default.aspx">Silverlight</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/SDN/default.aspx">SDN</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/ASP.NET/default.aspx">ASP.NET</category></item><item><title>Samples and PowerPoint from my WCF talk</title><link>http://msmvps.com/blogs/theproblemsolver/archive/2009/03/11/samples-and-powerpoint-from-my-wcf-talk.aspx</link><pubDate>Wed, 11 Mar 2009 04:25:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1677296</guid><dc:creator>Maurice</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/theproblemsolver/rsscomments.aspx?PostID=1677296</wfw:commentRss><comments>http://msmvps.com/blogs/theproblemsolver/archive/2009/03/11/samples-and-powerpoint-from-my-wcf-talk.aspx#comments</comments><description>&lt;p&gt;Attached is are the samples and slides I used for my intro into WCF talk yesterday at the VB Central meeting in the Netherlands.&lt;/p&gt;
&lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:fb3a1972-4489-4e52-abe7-25a00bb07fdf:1f5c7f80-8a87-47f9-8bd3-43a77d44b475" class="wlWriterEditableSmartContent"&gt;
&lt;p&gt;Download &lt;a href="http://msmvps.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/theproblemsolver/VBCentralWCF_5F00_1F391FD8.zip" target="_blank"&gt;samples&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Enjoy!&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.theproblemsolver.nl/"&gt;www.TheProblemSolver.nl &lt;/a&gt;    &lt;br /&gt;&lt;a href="http://wiki.windowsworkflowfoundation.eu/"&gt;Wiki.WindowsWorkflowFoundation.eu&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Now also on twitter at &lt;a title="http://twitter.com/mauricedb" href="http://twitter.com/mauricedb"&gt;http://twitter.com/mauricedb&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1677296" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/.NET/default.aspx">.NET</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/NetFx3/default.aspx">NetFx3</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/WCF/default.aspx">WCF</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/VB/default.aspx">VB</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/DevCenter/default.aspx">DevCenter</category></item><item><title>Using a TransactionScopeActivity with a WCF ReceiveActivity revisited</title><link>http://msmvps.com/blogs/theproblemsolver/archive/2009/03/10/using-a-transactionscopeactivity-with-a-wcf-receiveactivity-revisited.aspx</link><pubDate>Tue, 10 Mar 2009 12:42:15 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1677300</guid><dc:creator>Maurice</dc:creator><slash:comments>17</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/theproblemsolver/rsscomments.aspx?PostID=1677300</wfw:commentRss><comments>http://msmvps.com/blogs/theproblemsolver/archive/2009/03/10/using-a-transactionscopeactivity-with-a-wcf-receiveactivity-revisited.aspx#comments</comments><description>&lt;p&gt;Last year &lt;a href="http://blogs.infosupport.com/marcelv/"&gt;Marcel&lt;/a&gt; and I worked on a problem using a TransactionScopeActivity inside a WCF ReceiveActivity. I blogged a number of time about our finding, for example &lt;a href="http://msmvps.com/blogs/theproblemsolver/archive/2008/08/06/using-a-transactionscopeactivity-with-a-wcf-receiveactivity.aspx"&gt;here&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;Last week I heard from Marcel that a hotfix was finally available that solves this problem. He blogged about it &lt;a href="http://blogs.infosupport.com/marcelv/archive/2009/03/08/Hot-fix-available-for-Transaction-inside-receive-activity-scope-bug-workflow-3.5.aspx"&gt;here&lt;/a&gt;. Great work to see there is a fix for this serious problem.&lt;/p&gt; &lt;p&gt;Enjoy!&lt;/p&gt; &lt;p&gt;&lt;a href="http://www.theproblemsolver.nl/"&gt;www.TheProblemSolver.nl &lt;/a&gt;&lt;br /&gt;&lt;a href="http://wiki.windowsworkflowfoundation.eu/"&gt;Wiki.WindowsWorkflowFoundation.eu&lt;/a&gt;&lt;/p&gt; &lt;p&gt;And now on Twitter at &lt;a title="http://twitter.com/mauricedb" href="http://twitter.com/mauricedb"&gt;http://twitter.com/mauricedb&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1677300" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/.NET/default.aspx">.NET</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/NetFx3/default.aspx">NetFx3</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/Workflow/default.aspx">Workflow</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/WCF/default.aspx">WCF</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/VB/default.aspx">VB</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/DevCenter/default.aspx">DevCenter</category></item><item><title>Looking back at the MVP Summit</title><link>http://msmvps.com/blogs/theproblemsolver/archive/2009/03/07/looking-back-at-the-mvp-summit.aspx</link><pubDate>Sat, 07 Mar 2009 11:08:09 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1676278</guid><dc:creator>Maurice</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/theproblemsolver/rsscomments.aspx?PostID=1676278</wfw:commentRss><comments>http://msmvps.com/blogs/theproblemsolver/archive/2009/03/07/looking-back-at-the-mvp-summit.aspx#comments</comments><description>&lt;p&gt;Last week lots of MVP, myself included, where in Redmond visiting Microsoft on our yearly MVP pilgrimage. The MVP Summit is always a great event. Not only do we get to talk to the MS team members who actually design and build all the software we love and use but we also get to meet each other. And with MVP’s being located around the world that is kind of rare as well.&lt;/p&gt;  &lt;p&gt;Despite this being a great event I still have very mixed feelings about this last MVP summit. The problem isn’t the events itself or the people I met, that was al great &lt;img src="http://msmvps.com/emoticons/emotion-1.gif" alt="Smile" /&gt;. No the problem was in some of the technological decisions made in product groups. Unfortunately I can’t divulge details yet because I have signed an NDA but as soon .NET 4.0 as beta 1 is made public I will be able to blog about some of these decisions. And rest assured I will!&lt;/p&gt;  &lt;p&gt;The reason we really need to is the way these important changes are communicated. Or should I say not communicated. Some very important changes where not communicated at all and could only be derived by bullet points missing from PowerPoint slides. Only when directly asked about the missing bullet point would someone say “Yes that is right, we decided to …. NDA … because … NDA …”. Sorry about the NDA part &lt;img src="http://msmvps.com/emoticons/emotion-6.gif" alt="Sad" /&gt;.&lt;/p&gt;  &lt;p&gt;I can only say that these decisions are a big problem and I know several MVP’s who decided to skip other sessions on the same product as a result. I didn’t, as far as I am concerned ignoring a problem is not going to make it go away, but I really think this product team needs to reevaluate this decision and the general future trend.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Despite this hiccup I am very exited about lots of the things I got to see and am really looking forward to .NET 4 and Visual Studio 2010. Now if we only could have a beta today &lt;img src="http://msmvps.com/emoticons/emotion-1.gif" alt="Smile" /&gt;. When we will have a first beta is still a big question though. If a date was announced I missed it, the best I heard was a quarter and is quite a time span.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Enjoy.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.theproblemsolver.nl/"&gt;www.TheProblemSolver.nl &lt;/a&gt;   &lt;br /&gt;&lt;a href="http://wiki.windowsworkflowfoundation.eu/"&gt;Wiki.WindowsWorkflowFoundation.eu&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1676278" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/.NET/default.aspx">.NET</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/LINQ/default.aspx">LINQ</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/NetFx3/default.aspx">NetFx3</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/Workflow/default.aspx">Workflow</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/WCF/default.aspx">WCF</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/VB/default.aspx">VB</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/DevCenter/default.aspx">DevCenter</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/WPF/default.aspx">WPF</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/Silverlight/default.aspx">Silverlight</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/WF4/default.aspx">WF4</category></item><item><title>Presenting at VB Central</title><link>http://msmvps.com/blogs/theproblemsolver/archive/2009/03/03/presenting-at-vb-central.aspx</link><pubDate>Tue, 03 Mar 2009 13:46:17 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1675358</guid><dc:creator>Maurice</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/theproblemsolver/rsscomments.aspx?PostID=1675358</wfw:commentRss><comments>http://msmvps.com/blogs/theproblemsolver/archive/2009/03/03/presenting-at-vb-central.aspx#comments</comments><description>&lt;p&gt;Next week, on march 10th, I will be doing a presentation on getting started with WCF at the VB Central user group in the Netherlands. Its a free event so if you are in the neighborhood feel free to drop by. They do ask you register beforehand. Besides my session on WCF there will also be a session on using WPF and data binding.&lt;/p&gt;  &lt;p&gt;Mode details and the registration page can be found &lt;a href="http://www.vbcentral.nl/tabid/175/Default.aspx"&gt;here&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;Hope to see you there.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.theproblemsolver.nl/"&gt;www.TheProblemSolver.nl &lt;/a&gt;   &lt;br /&gt;&lt;a href="http://wiki.windowsworkflowfoundation.eu/"&gt;Wiki.WindowsWorkflowFoundation.eu&lt;/a&gt; &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1675358" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/.NET/default.aspx">.NET</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/NetFx3/default.aspx">NetFx3</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/WCF/default.aspx">WCF</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/VB/default.aspx">VB</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/WPF/default.aspx">WPF</category></item><item><title>SilverUnit - Unit testing framework for Silverlight</title><link>http://msmvps.com/blogs/theproblemsolver/archive/2009/02/25/silverunit-unit-testing-framework-for-silverlight.aspx</link><pubDate>Wed, 25 Feb 2009 08:11:13 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1673689</guid><dc:creator>Maurice</dc:creator><slash:comments>6</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/theproblemsolver/rsscomments.aspx?PostID=1673689</wfw:commentRss><comments>http://msmvps.com/blogs/theproblemsolver/archive/2009/02/25/silverunit-unit-testing-framework-for-silverlight.aspx#comments</comments><description>&lt;p&gt;Roy Osherove has just released SilverUnit, a unit testing framework for Silverlight code. I haven&amp;#39;t tried this yet but it certainly looks really interesting as you can start running your Silverlight unit tests inside of MS Test or NUnit.&lt;/p&gt; &lt;p&gt;And kind cool to hear this is written in VB &lt;img src="http://msmvps.com/emoticons/emotion-1.gif" alt="Smile" /&gt;&lt;/p&gt; &lt;p&gt;You can find more information and download SilverUnit from &lt;a href="http://www.codeplex.com/CThru"&gt;CodePlex&lt;/a&gt; here.&lt;/p&gt; &lt;p&gt;Enjoy!&lt;/p&gt; &lt;p&gt;&lt;a href="http://www.theproblemsolver.nl/"&gt;www.TheProblemSolver.nl &lt;/a&gt;&lt;br /&gt;&lt;a href="http://wiki.windowsworkflowfoundation.eu/"&gt;Wiki.WindowsWorkflowFoundation.eu&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1673689" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/.NET/default.aspx">.NET</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/VB/default.aspx">VB</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/DevCenter/default.aspx">DevCenter</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/Silverlight/default.aspx">Silverlight</category></item><item><title>WrapPanel in ListBox revisited</title><link>http://msmvps.com/blogs/theproblemsolver/archive/2008/12/08/wrappanel-in-listbox-revisited.aspx</link><pubDate>Mon, 08 Dec 2008 18:11:42 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1656182</guid><dc:creator>Maurice</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/theproblemsolver/rsscomments.aspx?PostID=1656182</wfw:commentRss><comments>http://msmvps.com/blogs/theproblemsolver/archive/2008/12/08/wrappanel-in-listbox-revisited.aspx#comments</comments><description>&lt;p&gt;Last week logged about using a WrapPanel in a listBox and demonstrated how to get the content to wrap around, read about it &lt;a href="http://msmvps.com/blogs/theproblemsolver/archive/2008/11/18/some-more-fun-with-a-silverlight-listbox.aspx"&gt;here&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;Turns out the XAML can be even easier. In the previous post I used a ControlTemplate with a Grid to stop the WrapPanel from just expanding horizontally. Turns out there us an even easier way to do so by disabling the horizontal scrollbar using the ListBox ScrollViewer. The following XAML will do the trick just fine:&lt;/p&gt;  &lt;div&gt;   &lt;pre style="padding-right:0px;padding-left:0px;font-size:8pt;padding-bottom:0px;margin:0em;overflow:visible;width:100%;color:black;border-top-style:none;line-height:12pt;padding-top:0px;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;border-right-style:none;border-left-style:none;background-color:#f4f4f4;border-bottom-style:none;"&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;UserControl&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;xmlns:controls&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;clr-namespace:Microsoft.Windows.Controls;assembly=Microsoft.Windows.Controls&amp;quot;&lt;/span&gt;  
             &lt;span style="color:#ff0000;"&gt;x:Class&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;SilverlightApplication4.Page&amp;quot;&lt;/span&gt;
             &lt;span style="color:#ff0000;"&gt;xmlns&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&amp;quot;&lt;/span&gt; 
             &lt;span style="color:#ff0000;"&gt;xmlns:x&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml&amp;quot;&lt;/span&gt; 
             &lt;span style="color:#ff0000;"&gt;Width&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;400&amp;quot;&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;Height&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;300&amp;quot;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;
    &lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;Grid&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;x:Name&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;LayoutRoot&amp;quot;&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;Background&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;White&amp;quot;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;
        &lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;ListBox&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;x:Name&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;DemoList&amp;quot;&lt;/span&gt; 
                 &lt;span style="color:#ff0000;"&gt;ScrollViewer&lt;/span&gt;.&lt;span style="color:#ff0000;"&gt;HorizontalScrollBarVisibility&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;Disabled&amp;quot;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;
            &lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;ListBox.ItemsPanel&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;
                &lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;ItemsPanelTemplate&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;
                    &lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;controls:WrapPanel&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;/&amp;gt;&lt;/span&gt;
                &lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#800000;"&gt;ItemsPanelTemplate&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;
            &lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#800000;"&gt;ListBox.ItemsPanel&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;
            &lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;ListBox.ItemTemplate&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;
                &lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;DataTemplate&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;
                    &lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;TextBlock&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;Text&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;{Binding}&amp;quot;&lt;/span&gt; 
                   &lt;span style="color:#ff0000;"&gt;TextAlignment&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;Right&amp;quot;&lt;/span&gt; 
                   &lt;span style="color:#ff0000;"&gt;Width&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;25&amp;quot;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;/&amp;gt;&lt;/span&gt;
                &lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#800000;"&gt;DataTemplate&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;
            &lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#800000;"&gt;ListBox.ItemTemplate&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;
        &lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#800000;"&gt;ListBox&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;
    &lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#800000;"&gt;Grid&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;
&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#800000;"&gt;UserControl&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Used in combination with the following code:&lt;/p&gt;

&lt;div&gt;
  &lt;pre style="padding-right:0px;padding-left:0px;font-size:8pt;padding-bottom:0px;margin:0em;overflow:visible;width:100%;color:black;border-top-style:none;line-height:12pt;padding-top:0px;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;border-right-style:none;border-left-style:none;background-color:#f4f4f4;border-bottom-style:none;"&gt;&lt;span style="color:#0000ff;"&gt;using&lt;/span&gt; System.Linq;
&lt;span style="color:#0000ff;"&gt;using&lt;/span&gt; System.Windows;
&lt;span style="color:#0000ff;"&gt;using&lt;/span&gt; System.Windows.Controls;

&lt;span style="color:#0000ff;"&gt;namespace&lt;/span&gt; SilverlightApplication4
{
    &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;partial&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;class&lt;/span&gt; Page : UserControl
    {
        &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; Page()
        {
            InitializeComponent();
            Loaded += &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; RoutedEventHandler(Page_Loaded);
        }

        &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; Page_Loaded(&lt;span style="color:#0000ff;"&gt;object&lt;/span&gt; sender, RoutedEventArgs e)
        {
            DemoList.ItemsSource = Enumerable.Range(1, 250);
        }
    }
}&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;it produces this Silverlight page:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://msmvps.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/theproblemsolver/image_5F00_4C441D02.png"&gt;&lt;img title="image" style="border-right:0px;border-top:0px;display:inline;border-left:0px;border-bottom:0px;" height="244" alt="image" src="http://msmvps.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/theproblemsolver/image_5F00_thumb_5F00_0BA46144.png" width="234" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;We even get some keyboard support with the new XAML although I am not quite sure if I am happy about that or not. Selecting an element and pressing the down arrow key makes the selection move to the right. Makes sense in that it is the next item in the ItemsSource bit not quite what I was hoping for.&lt;/p&gt;

&lt;p&gt;Just for a quick comparison I copied the XAML and code to a WPF application to see what would happen there. Fortunately the only change I hard to make to the ListBox was removing the controls namespace. Great &lt;img src="http://msmvps.com/emoticons/emotion-1.gif" alt="Smile" /&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://msmvps.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/theproblemsolver/image_5F00_71D2BBC5.png"&gt;&lt;img title="image" style="border-right:0px;border-top:0px;display:inline;border-left:0px;border-bottom:0px;" height="244" alt="image" src="http://msmvps.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/theproblemsolver/image_5F00_thumb_5F00_01092493.png" width="244" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;When I ran the same in WPF I do see the keyboard behavior I would like. Pressing the down arrow selects the next item below the current, the same with up and the other arrow keys and even the page up/down scroll a page but move in the same column. Now this is much better behavior!&lt;/p&gt;

&lt;p&gt;Enjoy!&lt;/p&gt;

&lt;p&gt;&lt;a href="http://www.theproblemsolver.nl/"&gt;www.TheProblemSolver.nl &lt;/a&gt;
  &lt;br /&gt;&lt;a href="http://wiki.windowsworkflowfoundation.eu/"&gt;Wiki.WindowsWorkflowFoundation.eu&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1656182" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/.NET/default.aspx">.NET</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/NetFx3/default.aspx">NetFx3</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/VB/default.aspx">VB</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/DevCenter/default.aspx">DevCenter</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/WPF/default.aspx">WPF</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/Silverlight/default.aspx">Silverlight</category></item><item><title>Unit testing in Silverlight part 2</title><link>http://msmvps.com/blogs/theproblemsolver/archive/2008/12/07/unit-testing-in-silverlight-part-2.aspx</link><pubDate>Sun, 07 Dec 2008 21:11:23 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1656093</guid><dc:creator>Maurice</dc:creator><slash:comments>9</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/theproblemsolver/rsscomments.aspx?PostID=1656093</wfw:commentRss><comments>http://msmvps.com/blogs/theproblemsolver/archive/2008/12/07/unit-testing-in-silverlight-part-2.aspx#comments</comments><description>&lt;a href="http://msmvps.com/blogs/theproblemsolver/archive/2008/12/02/unit-testing-in-silverlight-part-1.aspx"&gt;Part 1&lt;/a&gt;   &lt;br /&gt;&lt;a href="http://msmvps.com/blogs/theproblemsolver/archive/2008/12/07/unit-testing-in-silverlight-part-2.aspx"&gt;Part 2&lt;/a&gt;   &lt;br /&gt;&lt;a href="http://msmvps.com/blogs/theproblemsolver/archive/2008/12/07/unit-testing-in-silverlight-part-3.aspx"&gt;Part 3&lt;/a&gt;   &lt;br /&gt;&lt;a href="http://msmvps.com/blogs/theproblemsolver/archive/2009/01/26/unit-testing-in-silverlight-part-4-the-ui.aspx"&gt;Part 4&lt;/a&gt;   &lt;p&gt;In my previous post I described the basic setup of unit testing in Silverlight, you can read all about it &lt;a href="http://msmvps.com/blogs/theproblemsolver/archive/2008/12/02/unit-testing-in-silverlight-part-1.aspx"&gt;here&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;The basics where very nice but lots of code we write in Silverlight has to do with networking and in Silverlight that means asynchronous code, something that is always hard to test!&lt;/p&gt;  &lt;p&gt;Because, just I like using &lt;a href="http://www.flickr.com"&gt;Flickr&lt;/a&gt;, lets download some pictures and see what it takes to make that testable. Below is the very simple application we need to unit test, basically a list of pictures from &lt;a href="http://www.flickr.com/photos/mauricedb/"&gt;my Flickr photo stream&lt;/a&gt;.&lt;/p&gt; &lt;a href="http://msmvps.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/theproblemsolver/image_5F00_2698148C.png"&gt;&lt;img title="image" style="border-top-width:0px;display:inline;border-left-width:0px;border-bottom-width:0px;border-right-width:0px;" height="215" alt="image" src="http://msmvps.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/theproblemsolver/image_5F00_thumb_5F00_6376D922.png" width="244" border="0" /&gt;&lt;/a&gt;   &lt;p&gt;Nothing fancy, just a ListBox with pictures &lt;img src="http://msmvps.com/emoticons/emotion-1.gif" alt="Smile" /&gt;&lt;/p&gt;  &lt;p&gt;The code in the page is no big deal either and looks like this:&lt;/p&gt;  &lt;div&gt;   &lt;pre style="padding-right:0px;padding-left:0px;font-size:8pt;padding-bottom:0px;margin:0em;overflow:visible;width:100%;color:black;border-top-style:none;line-height:12pt;padding-top:0px;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;border-right-style:none;border-left-style:none;background-color:#f4f4f4;border-bottom-style:none;"&gt;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;partial&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;class&lt;/span&gt; Page : UserControl
{
    &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; Page()
    {
        InitializeComponent();
        Loaded += &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; RoutedEventHandler(Page_Loaded);
    }

    &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; Page_Loaded(&lt;span style="color:#0000ff;"&gt;object&lt;/span&gt; sender, RoutedEventArgs e)
    {
        PhotoCollection photoCollection = 
            (PhotoCollection)Resources[&lt;span style="color:#006080;"&gt;&amp;quot;PhotoCollectionDS&amp;quot;&lt;/span&gt;];
        FlickrRequest request = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; FlickrRequest();

        request.PhotoSearchByUser(&lt;span style="color:#006080;"&gt;&amp;quot;97044050@N00&amp;quot;&lt;/span&gt;, 
            (photo) =&amp;gt; photoCollection.Add(photo));
    }
}&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Basically it just retrieves the PhotoCollection, creates a FlickrRequest object and tells it to search for a users photos and add each photo found to the collection. The PhotoCollection is no big deal either and is just a ObservableCollection&amp;lt;Photo&amp;gt;.&lt;/p&gt;

&lt;p&gt;The interesting stuff is in the FlickrRequest class. This is the one that needs to be unit tested and looks like this:&lt;/p&gt;

&lt;div&gt;
  &lt;pre style="padding-right:0px;padding-left:0px;font-size:8pt;padding-bottom:0px;margin:0em;overflow:visible;width:100%;color:black;border-top-style:none;line-height:12pt;padding-top:0px;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;border-right-style:none;border-left-style:none;background-color:#f4f4f4;border-bottom-style:none;"&gt;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;class&lt;/span&gt; FlickrRequest
{
    &lt;span style="color:#0000ff;"&gt;private&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;const&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; _flickrUrl = &lt;span style="color:#006080;"&gt;&amp;quot;http://api.flickr.com/services/rest&amp;quot;&lt;/span&gt;;

    &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; PhotoSearchByUser(&lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; userId, Action&amp;lt;Photo&amp;gt; action)
    {
        &lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; url = &lt;span style="color:#0000ff;"&gt;string&lt;/span&gt;.Format(
            &lt;span style="color:#006080;"&gt;@&amp;quot;{0}/?method={1}&amp;amp;api_key={2}&amp;amp;user_id={3}&amp;amp;extras=original_format&amp;quot;&lt;/span&gt;,
            _flickrUrl, &lt;span style="color:#006080;"&gt;&amp;quot;flickr.photos.search&amp;quot;&lt;/span&gt;, App.FlickrApiKey, userId);

        WebClient client = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; WebClient();
        client.OpenReadCompleted += (sender, e) =&amp;gt;
        {
            &lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (e.Error == &lt;span style="color:#0000ff;"&gt;null&lt;/span&gt;)
            {
                FlickrResponse response = DeserializeResult(e.Result);
                &lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (response.Status == &lt;span style="color:#006080;"&gt;&amp;quot;ok&amp;quot;&lt;/span&gt;)
                {
                    &lt;span style="color:#0000ff;"&gt;foreach&lt;/span&gt; (var photo &lt;span style="color:#0000ff;"&gt;in&lt;/span&gt; response.Photos.Photos)
                        action(photo);

                    &lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (response.Photos.Page &amp;lt; response.Photos.PageCount)
                    {
                        &lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; nextUrl = &lt;span style="color:#0000ff;"&gt;string&lt;/span&gt;.Format(&lt;span style="color:#006080;"&gt;&amp;quot;{0}&amp;amp;page={1}&amp;quot;&lt;/span&gt;, 
                            url, response.Photos.Page + 1);
                        client.OpenReadAsync(&lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; Uri(nextUrl));
                    }
                }
            }
        };

        client.OpenReadAsync(&lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; Uri(url));
    }

    &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;static&lt;/span&gt; FlickrResponse DeserializeResult(Stream stream)
    {
        FlickrResponse response = &lt;span style="color:#0000ff;"&gt;null&lt;/span&gt;;
        &lt;span style="color:#0000ff;"&gt;try&lt;/span&gt;
        {
            XmlSerializer ser = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; XmlSerializer(&lt;span style="color:#0000ff;"&gt;typeof&lt;/span&gt;(FlickrResponse));
            response = (FlickrResponse)ser.Deserialize(stream);
        }
        &lt;span style="color:#0000ff;"&gt;catch&lt;/span&gt; (InvalidOperationException)
        {
            response = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; FlickrResponse();
        }

        &lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (response.Photos == &lt;span style="color:#0000ff;"&gt;null&lt;/span&gt;)
            response.Photos = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; ResponsePhotoCollection();
        &lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (response.Photos.Photos == &lt;span style="color:#0000ff;"&gt;null&lt;/span&gt;)
            response.Photos.Photos = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; Photo[] { };

        &lt;span style="color:#0000ff;"&gt;return&lt;/span&gt; response;
    }
}&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;The PhotoSearchByUser function here is the interesting one as it uses the WebClient class and the Flickr REST API to download the photo information. This code also has the complexity that not all the data is returned from the first call but we need to do multiple calls to get all the photo information. Creating a unit test should be straightforward expect for the fact that we do not want to depend on Flickr and fake out the networking parts. After all if we didn’t it would be a integration test instead of a unit test. So we need to somehow fake the networking behavior.&lt;/p&gt;

&lt;p&gt;With regular .NET code I use TypeMock to help out with unit testing and I am sure that would make live easy here but unfortunately there is no Silverlight version of TypeMock yet. In fact, as far as I am aware, there is not a single mock framework for use with Silverlight. So we need to do this some other way.&lt;/p&gt;

&lt;p&gt;First we need to get rid of the WebClient class because non of its methods are virtual and we cannot substitute another type. So the first thing I did was create a TestableWebClient, which looks just like the original WebClient only it allows me to change the behavior for testing purposes. The TestableWeblient looks like this:&lt;/p&gt;

&lt;div&gt;
  &lt;pre style="padding-right:0px;padding-left:0px;font-size:8pt;padding-bottom:0px;margin:0em;overflow:visible;width:100%;color:black;border-top-style:none;line-height:12pt;padding-top:0px;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;border-right-style:none;border-left-style:none;background-color:#f4f4f4;border-bottom-style:none;"&gt;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;class&lt;/span&gt; TestableWebClient
{
    &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;event&lt;/span&gt; EventHandler&amp;lt;TestableOpenReadCompletedEventArgs&amp;gt; OpenReadCompleted;

    &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;virtual&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; OpenReadAsync(Uri address)
    {
        WebClient client = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; WebClient();
        client.OpenReadCompleted += (s, e) =&amp;gt;
            {
                OnOpenReadCompleted(e);
            };
        client.OpenReadAsync(address);
    }

    &lt;span style="color:#0000ff;"&gt;protected&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; OnOpenReadCompleted(OpenReadCompletedEventArgs e)
    {
        TestableOpenReadCompletedEventArgs args = &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; TestableOpenReadCompletedEventArgs(e);
        OnOpenReadCompleted(args);
    }

    &lt;span style="color:#0000ff;"&gt;protected&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; OnOpenReadCompleted(TestableOpenReadCompletedEventArgs e)
    {
        &lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (OpenReadCompleted != &lt;span style="color:#0000ff;"&gt;null&lt;/span&gt;)
        {
            OpenReadCompleted(&lt;span style="color:#0000ff;"&gt;this&lt;/span&gt;, e);
        }
    }
}&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Unfortunately the OpenReadCompletedEventArgs type doesn’t have a public constructor so I cannot create one myself so I have to use a TestableOpenReadCompletedEventArgs instead. This class looks like this:&lt;/p&gt;

&lt;div&gt;
  &lt;pre style="padding-right:0px;padding-left:0px;font-size:8pt;padding-bottom:0px;margin:0em;overflow:visible;width:100%;color:black;border-top-style:none;line-height:12pt;padding-top:0px;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;border-right-style:none;border-left-style:none;background-color:#f4f4f4;border-bottom-style:none;"&gt;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;class&lt;/span&gt; TestableOpenReadCompletedEventArgs : AsyncCompletedEventArgs
{
    &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; TestableOpenReadCompletedEventArgs(
        Stream result, Exception error, &lt;span style="color:#0000ff;"&gt;bool&lt;/span&gt; cancelled, &lt;span style="color:#0000ff;"&gt;object&lt;/span&gt; userState)
        : &lt;span style="color:#0000ff;"&gt;base&lt;/span&gt;(error, cancelled, userState)
    {
        Result = result;
    }

    &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; TestableOpenReadCompletedEventArgs(
        OpenReadCompletedEventArgs args)
        : &lt;span style="color:#0000ff;"&gt;base&lt;/span&gt;(args.Error, args.Cancelled, args.UserState)
    {
        Result = args.Result;
    }

    &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; Stream Result { get; &lt;span style="color:#0000ff;"&gt;private&lt;/span&gt; set; }
}&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;So with these new classes I can change the PhotoSearchByUser function to use the new class and it now looks like this:&lt;/p&gt;

&lt;div&gt;
  &lt;pre style="padding-right:0px;padding-left:0px;font-size:8pt;padding-bottom:0px;margin:0em;overflow:visible;width:100%;color:black;border-top-style:none;line-height:12pt;padding-top:0px;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;border-right-style:none;border-left-style:none;background-color:#f4f4f4;border-bottom-style:none;"&gt;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; PhotoSearchByUser(&lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; userId, Action&amp;lt;Photo&amp;gt; action)
{
    &lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; url = &lt;span style="color:#0000ff;"&gt;string&lt;/span&gt;.Format(
        &lt;span style="color:#006080;"&gt;@&amp;quot;{0}/?method={1}&amp;amp;api_key={2}&amp;amp;user_id={3}&amp;amp;extras=original_format&amp;quot;&lt;/span&gt;,
        _flickrUrl, &lt;span style="color:#006080;"&gt;&amp;quot;flickr.photos.search&amp;quot;&lt;/span&gt;, App.FlickrApiKey, userId);

    TestableWebClient client = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; TestableWebClient();
    client.OpenReadCompleted += (sender, e) =&amp;gt;
    {
        &lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (e.Error == &lt;span style="color:#0000ff;"&gt;null&lt;/span&gt;)
        {
            FlickrResponse response = DeserializeResult(e.Result);
            &lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (response.Status == &lt;span style="color:#006080;"&gt;&amp;quot;ok&amp;quot;&lt;/span&gt;)
            {
                &lt;span style="color:#0000ff;"&gt;foreach&lt;/span&gt; (var photo &lt;span style="color:#0000ff;"&gt;in&lt;/span&gt; response.Photos.Photos)
                    action(photo);

                &lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (response.Photos.Page &amp;lt; response.Photos.PageCount)
                {
                    &lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; nextUrl = &lt;span style="color:#0000ff;"&gt;string&lt;/span&gt;.Format(&lt;span style="color:#006080;"&gt;&amp;quot;{0}&amp;amp;page={1}&amp;quot;&lt;/span&gt;, 
                        url, response.Photos.Page + 1);
                    client.OpenReadAsync(&lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; Uri(nextUrl));
                }
            }
        }
    };

    client.OpenReadAsync(&lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; Uri(url));
}&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;Not much changes, in fact only a single line changed but we are not quite there yet. We still need a way to get our unit tests to use a different TestableWebClient implementation. Do do so I will pass in the type of TestableWebClient to use with the FlickrRequest constructor. Check the new code:&lt;/p&gt;

&lt;div&gt;
  &lt;pre style="padding-right:0px;padding-left:0px;font-size:8pt;padding-bottom:0px;margin:0em;overflow:visible;width:100%;color:black;border-top-style:none;line-height:12pt;padding-top:0px;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;border-right-style:none;border-left-style:none;background-color:#f4f4f4;border-bottom-style:none;"&gt;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;class&lt;/span&gt; FlickrRequest
{
    &lt;span style="color:#0000ff;"&gt;private&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; _flickrUrl = &lt;span style="color:#006080;"&gt;&amp;quot;http://api.flickr.com/services/rest&amp;quot;&lt;/span&gt;;
    &lt;span style="color:#0000ff;"&gt;private&lt;/span&gt; Type _webClientType = &lt;span style="color:#0000ff;"&gt;typeof&lt;/span&gt;(TestableWebClient);

    &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; FlickrRequest()
    {
    }

    &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; FlickrRequest(Type webClientType)
    {
        _webClientType = webClientType;
    }

    &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; PhotoSearchByUser(&lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; userId, Action&amp;lt;Photo&amp;gt; action)
    {
        &lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; url = &lt;span style="color:#0000ff;"&gt;string&lt;/span&gt;.Format(
            &lt;span style="color:#006080;"&gt;@&amp;quot;{0}/?method={1}&amp;amp;api_key={2}&amp;amp;user_id={3}&amp;amp;extras=original_format&amp;quot;&lt;/span&gt;,
            _flickrUrl, &lt;span style="color:#006080;"&gt;&amp;quot;flickr.photos.search&amp;quot;&lt;/span&gt;, App.FlickrApiKey, userId);

        TestableWebClient client = (TestableWebClient)&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Activator.CreateInstance(_webClientType);
        
        &lt;span style="color:#008000;"&gt;// Rest of the code left out.&lt;/span&gt;
    }
}&lt;/pre&gt;
&lt;/div&gt;
Now we can start testing this code &lt;img src="http://msmvps.com/emoticons/emotion-1.gif" alt="Smile" /&gt; 

&lt;p&gt;I created two unit tests for this code as an example, they look like this:&lt;/p&gt;

&lt;div&gt;
  &lt;pre style="padding-right:0px;padding-left:0px;font-size:8pt;padding-bottom:0px;margin:0em;overflow:visible;width:100%;color:black;border-top-style:none;line-height:12pt;padding-top:0px;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;border-right-style:none;border-left-style:none;background-color:#f4f4f4;border-bottom-style:none;"&gt;[TestClass]
&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;class&lt;/span&gt; FlickrDownloadTest : SilverlightTest
{
    [TestMethod]
    [Asynchronous]
    &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; Test1()
    {
        FlickrRequest request = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; FlickrRequest(&lt;span style="color:#0000ff;"&gt;typeof&lt;/span&gt;(MockTestableWebClient));

        request.PhotoSearchByUser(&lt;span style="color:#006080;"&gt;&amp;quot;97044050@N00&amp;quot;&lt;/span&gt;, (photo) =&amp;gt; EnqueueTestComplete());
    }
    
    [TestMethod]
    [Asynchronous]
    &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; Test2()
    {
        &lt;span style="color:#0000ff;"&gt;int&lt;/span&gt; pageCount = 0;
        FlickrRequest request = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; FlickrRequest(&lt;span style="color:#0000ff;"&gt;typeof&lt;/span&gt;(MockTestableWebClient));

        request.PhotoSearchByUser(&lt;span style="color:#006080;"&gt;&amp;quot;97044050@N00&amp;quot;&lt;/span&gt;, (photo) =&amp;gt; pageCount++);
        EnqueueConditional(() =&amp;gt;
            {
                &lt;span style="color:#0000ff;"&gt;return&lt;/span&gt; pageCount == 5;
            });
        EnqueueTestComplete();
    }
}&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;The fake, or mock, WebClient looks like this:&lt;/p&gt;

&lt;div&gt;
  &lt;pre style="padding-right:0px;padding-left:0px;font-size:8pt;padding-bottom:0px;margin:0em;overflow:visible;width:100%;color:black;border-top-style:none;line-height:12pt;padding-top:0px;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;border-right-style:none;border-left-style:none;background-color:#f4f4f4;border-bottom-style:none;"&gt;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;class&lt;/span&gt; MockTestableWebClient : TestableWebClient
{
    &lt;span style="color:#0000ff;"&gt;private&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;int&lt;/span&gt; _page = 0;

    &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;override&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; OpenReadAsync(Uri address)
    {
        _page++;

        FlickrResponse response = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; FlickrResponse();
        response.Status = &lt;span style="color:#006080;"&gt;&amp;quot;ok&amp;quot;&lt;/span&gt;;
        response.Photos = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; ResponsePhotoCollection();
        response.Photos.Page = _page;
        response.Photos.PageCount = 5;
        response.Photos.Photos = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; Photo[] { &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; Photo() };
        Stream stream = SerializeResult(response);
        stream.Position = 0;
        TestableOpenReadCompletedEventArgs args = 
            &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; TestableOpenReadCompletedEventArgs(stream, &lt;span style="color:#0000ff;"&gt;null&lt;/span&gt;, &lt;span style="color:#0000ff;"&gt;false&lt;/span&gt;, &lt;span style="color:#0000ff;"&gt;null&lt;/span&gt;);
        OnOpenReadCompleted(args);
    }


    &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;static&lt;/span&gt; Stream SerializeResult(FlickrResponse response)
    {
        MemoryStream stream = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; MemoryStream();
        XmlSerializer ser = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; XmlSerializer(&lt;span style="color:#0000ff;"&gt;typeof&lt;/span&gt;(FlickrResponse));
        ser.Serialize(stream, response);

        &lt;span style="color:#0000ff;"&gt;return&lt;/span&gt; stream;
    }
}&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;Basically I just return a response stating that there are 5 pages and each contains a single blank photo.&lt;/p&gt;

&lt;p&gt;Running these tests produces the following output showing both tests passed &lt;img src="http://msmvps.com/emoticons/emotion-1.gif" alt="Smile" /&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://msmvps.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/theproblemsolver/image_5F00_0C17D5DB.png"&gt;&lt;img title="image" style="border-top-width:0px;display:inline;border-left-width:0px;border-bottom-width:0px;border-right-width:0px;" height="413" alt="image" src="http://msmvps.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/theproblemsolver/image_5F00_thumb_5F00_5FB5E1FA.png" width="644" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;Am I happy with the changes I had to make to the Silverlight app to make it unit testable? Well yes and no. I didn’t like having to create a wrapper class for the WebClient and the OpenReadCompletedEventArgs. Bit now that I have done so creating using other test for code using the WebClient is a lot easier. In this case I only added the OpenReadAsync() function but doing the same with the other functions is a breeze. And the end result is I could unit test the code in PhotoSearchByUser() pretty much the way I wrote it without having to change the code a lot just to make it unit testable and that is good! So overall I am reasonably happy with the result &lt;img src="http://msmvps.com/emoticons/emotion-1.gif" alt="Smile" /&gt;&lt;/p&gt;

&lt;p&gt;I pretty much skipped all details of the actual unit testing code itself. Now there is some new stuff so in a future blog post I am going to explain what I did in the unit tests themselves.&lt;/p&gt;

&lt;p&gt;And thanks to &lt;a href="http://www.jeff.wilcox.name/"&gt;Jeff Wilcox&lt;/a&gt; for providing some useful feedback.&lt;/p&gt;

&lt;p&gt;Enjoy!&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;Update: &lt;a href="http://msmvps.com/blogs/theproblemsolver/archive/2008/12/02/unit-testing-in-silverlight-part-1.aspx"&gt;Part 1&lt;/a&gt;, &lt;a href="http://msmvps.com/blogs/theproblemsolver/archive/2008/12/07/unit-testing-in-silverlight-part-2.aspx"&gt;Part 2&lt;/a&gt;, &lt;a href="http://msmvps.com/blogs/theproblemsolver/archive/2008/12/28/unit-testing-in-silverlight-part-3.aspx"&gt;Part 3&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://www.theproblemsolver.nl/"&gt;www.TheProblemSolver.nl &lt;/a&gt; 
  &lt;br /&gt;&lt;a href="http://wiki.windowsworkflowfoundation.eu/"&gt;Wiki.WindowsWorkflowFoundation.eu&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1656093" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/.NET/default.aspx">.NET</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/NetFx3/default.aspx">NetFx3</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/VB/default.aspx">VB</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/DevCenter/default.aspx">DevCenter</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/WPF/default.aspx">WPF</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/Silverlight/default.aspx">Silverlight</category></item><item><title>Unit testing and Windows Workflow Foundation</title><link>http://msmvps.com/blogs/theproblemsolver/archive/2008/12/03/unit-testing-and-windows-workflow-foundation.aspx</link><pubDate>Wed, 03 Dec 2008 12:17:30 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1655635</guid><dc:creator>Maurice</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/theproblemsolver/rsscomments.aspx?PostID=1655635</wfw:commentRss><comments>http://msmvps.com/blogs/theproblemsolver/archive/2008/12/03/unit-testing-and-windows-workflow-foundation.aspx#comments</comments><description>&lt;p&gt;A while a go I wrote some posts about unit testing Windows Workflow foundation Activities, you can find the posts &lt;a href="http://msmvps.com/blogs/theproblemsolver/archive/2008/06/02/unit-testing-custom-workflow-activities.aspx"&gt;here&lt;/a&gt; and &lt;a href="http://msmvps.com/blogs/theproblemsolver/archive/2008/06/11/unit-testing-asynchronous-workflow-activities.aspx"&gt;here&lt;/a&gt;. Fortunately I am not the only one who thinks unit testing is important as you can find various other blog posts about it like &lt;a href="http://blogs.msdn.com/rjacobs/archive/2008/08/26/unit-testing-workflows.aspx"&gt;this&lt;/a&gt; one from Ron Jacobs.&lt;/p&gt; &lt;p&gt;But Cliff Simpkins has taken this one step further and just blogged about a new MSDN virtual lab &amp;quot;Using Test-First Development with WF&amp;quot;! Excellent work and I recommend doing the lab, I know I did! And while you are at it, there are a&amp;nbsp; number of other interesting labs you can do.&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;Read more about Cliffs announcement &lt;a href="http://blogs.msdn.com/endpoint/archive/2008/12/01/new-virtual-lab-using-test-first-development-with-wf-3-5.aspx"&gt;here&lt;/a&gt; or go straight to the lab &lt;a href="https://www.microsoft.com/resources/virtuallabs/step1-msdn.aspx?LabId=c4a993a5-d498-4d5c-9f98-476c1f496d15&amp;amp;BToken=reg"&gt;here&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;Enjoy!&lt;/p&gt; &lt;p&gt;&lt;a href="http://www.theproblemsolver.nl/"&gt;www.TheProblemSolver.nl &lt;/a&gt;&lt;br /&gt;&lt;a href="http://wiki.windowsworkflowfoundation.eu/"&gt;Wiki.WindowsWorkflowFoundation.eu&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1655635" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/.NET/default.aspx">.NET</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/NetFx3/default.aspx">NetFx3</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/Workflow/default.aspx">Workflow</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/VB/default.aspx">VB</category><category domain="http://msmvps.com/blogs/theproblemsolver/archive/tags/DevCenter/default.aspx">DevCenter</category></item></channel></rss>