<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>davidpoll.com &#187; Activity Control</title>
	<atom:link href="http://www.davidpoll.com/tag/activity-control/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.davidpoll.com</link>
	<description>Silverlight, RIA development, and other goofy geeky goodness.</description>
	<lastBuildDate>Wed, 03 Feb 2010 08:04:39 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Silverlight Toolkit November 2009: Activity Control &#8211;&gt; BusyIndicator (a.k.a. Update 3: Displaying background activity in a Silverlight RIA application)</title>
		<link>http://www.davidpoll.com/2009/11/19/silverlight-toolkit-november-2009-activity-control-busyindicator-a-k-a-update-3-displaying-background-activity-in-a-silverlight-ria-application/</link>
		<comments>http://www.davidpoll.com/2009/11/19/silverlight-toolkit-november-2009-activity-control-busyindicator-a-k-a-update-3-displaying-background-activity-in-a-silverlight-ria-application/#comments</comments>
		<pubDate>Fri, 20 Nov 2009 06:14:45 +0000</pubDate>
		<dc:creator>david.poll</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Activity Control]]></category>
		<category><![CDATA[BusyIndicator]]></category>
		<category><![CDATA[Silverlight 3]]></category>
		<category><![CDATA[Silverlight 4 Beta]]></category>
		<category><![CDATA[Silverlight Toolkit]]></category>

		<guid isPermaLink="false">http://www.davidpoll.com/2009/11/19/silverlight-toolkit-november-2009-activity-control-busyindicator-a-k-a-update-3-displaying-background-activity-in-a-silverlight-ria-application/</guid>
		<description><![CDATA[




Wow!&#160; What a week!&#160; PDC, the Silverlight 4 Beta, and now the November 2009 release of the Silverlight Toolkit!&#160; There’s been a ton of great news and exciting announcements, and now I can share with you that the Activity control, first blogged here, is now a part of the Silverlight Toolkit!
Awesome!&#160; What does that mean [...]]]></description>
			<content:encoded><![CDATA[<!-- Advanced AdSense by Jim Gaudet --><!-- google_ad_section_start --><!-- AdSense Now! V1.80 -->
<!-- Post[count: 3] -->
<div class="adsense adsense-leadin" style="float:right;margin: 12px;"><script type="text/javascript"><!--
google_ad_client = "pub-0397559301561409";
/* 234x60, created 9/21/09 */
google_ad_slot = "7066877373";
google_ad_width = 234;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div><p>Wow!&#160; What a week!&#160; <a href="http://www.microsoftpdc.com" target="_blank">PDC</a>, the <a href="http://www.silverlight.net/getstarted/silverlight-4-beta" target="_blank">Silverlight 4 Beta</a>, and now the November 2009 release of the <a href="http://silverlight.codeplex.com/" target="_blank">Silverlight Toolkit</a>!&#160; There’s been a ton of great news and exciting announcements, and now I can share with you that the Activity control, <a href="http://www.davidpoll.com/tag/activity-control/" target="_blank">first blogged here</a>, is now a part of the Silverlight Toolkit!</p>
<h3>Awesome!&#160; What does that mean for the Activity control?</h3>
<p>During this transition, the Activity control underwent a few changes (thanks to my colleagues working on the Toolkit – <a href="http://blogs.msdn.com/delay/" target="_blank">David Anson</a> and <a href="http://www.jeff.wilcox.name" target="_blank">Jeff Wilcox</a>) to make it more generally palatable:</p>
<ul>
<li>The control has been renamed from “Activity” to “BusyIndicator” in order to avoid confusion with the concept of an Activity (sounds a lot like “Task”)</li>
<ul>
<li>Similarly, “IsActive” is now “IsBusy”, and the visual states have been renamed appropriately as well.</li>
</ul>
<li>AutoBind and related properties have been removed once and for all.&#160; They were a performance hog in the original versions, and they really only hit a very, very narrow scenario.&#160; Instead, bind to a property that represents your busyness.</li>
<li>MinDisplayTime has gone away.&#160; If you’re looking to change the minimum display time, you can re-template the control and add a duration to the transition from visible back to hidden.</li>
<li>OverlayBrush and OverlayOpacity have been replaced with a single OverlayStyle property where you can set the color/opacity of the overlay easily.</li>
<li>DisplayAfter now defaults to 0.1s instead of 0.05s</li>
</ul>
<p>Otherwise, the control is basically the same!&#160; Give it a shot!</p>
<p>With this transition, the BusyIndicator control truly becomes accessible to anyone who’s using the Silverlight Toolkit.&#160; You can <a href="http://silverlight.codeplex.com/WorkItem/List.aspx" target="_blank">report bugs through that project on codeplex</a>, and we’ll make sure to keep an eye on any feedback we get from you on the control.</p>
<h3>Great… So where can I find it?</h3>
<p>It’s simple!&#160; Just download the November 2009 Silverlight Toolkit for either Silverlight 3 or Silverlight 4.&#160; There are a few ways to get it:</p>
<ul>
<li><a href="http://silverlight.codeplex.com" target="_blank">Silverlight Toolkit Codeplex Page</a></li>
<li><a href="http://www.jeff.wilcox.name/2009/11/toolkit-webpi/" target="_blank">Web Platform Installer</a></li>
</ul>
<p>The BusyIndicatorControl can be found in the <strong>System.Windows.Controls</strong> namespace in the <strong>System.Windows.Controls.Toolkit.dll</strong> assembly in the toolkit.</p>
<h3></h3>
<h3>And… can I see it in action?</h3>
<p>Yep!&#160; David Anson created some awesome samples in the Toolkit Sample Browser for the BusyIndicator.&#160; I’m a big fan of his work! <img src='http://www.davidpoll.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><a href="http://silverlight.net/content/samples/sl3/toolkitcontrolsamples/run/default.html" target="_blank"><img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="BusyIndicator is now in the Silverlight Toolkit sample browser!" border="0" alt="BusyIndicator is now in the Silverlight Toolkit sample browser!" src="http://www.davidpoll.com/Images/Sil.Update3Displayingbackgroundactivityi_138BA/image.png" width="644" height="435" /></a> </p>
<p>I hope you all enjoy using the BusyIndicator control in your applications!&#160; Let me know what you think!</p>
<p>P.S. Thanks to Jeff Wilcox, who <a href="http://www.jeff.wilcox.name/2009/11/busy-indicator-control/" target="_blank">beat me to explaining this change</a> <img src='http://www.davidpoll.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> &#160; I’ve been super-busy with PDC, so it was good to have someone start getting the word out early.&#160; Jeff gives a great overview of what the control is meant to do and has lots of resources regarding the Silverlight Toolkit.&#160; Check out his <a href="http://www.jeff.wilcox.name" target="_blank">blog</a>!</p>
<!-- Advanced AdSense by Jim Gaudet --><!-- google_ad_section_end -->]]></content:encoded>
			<wfw:commentRss>http://www.davidpoll.com/2009/11/19/silverlight-toolkit-november-2009-activity-control-busyindicator-a-k-a-update-3-displaying-background-activity-in-a-silverlight-ria-application/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Update 2: Displaying background activity in a Silverlight RIA application</title>
		<link>http://www.davidpoll.com/2009/09/14/update-2-displaying-background-activity-in-a-silverlight-ria-application/</link>
		<comments>http://www.davidpoll.com/2009/09/14/update-2-displaying-background-activity-in-a-silverlight-ria-application/#comments</comments>
		<pubDate>Mon, 14 Sep 2009 07:45:50 +0000</pubDate>
		<dc:creator>david.poll</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[.NET RIA Services]]></category>
		<category><![CDATA[Activity Control]]></category>
		<category><![CDATA[BusyIndicator]]></category>
		<category><![CDATA[Silverlight 3]]></category>
		<category><![CDATA[WCF RIA Services]]></category>

		<guid isPermaLink="false">http://www.davidpoll.com/2009/09/14/update-2-displaying-background-activity-in-a-silverlight-ria-application/</guid>
		<description><![CDATA[Hi folks!&#160; It’s been a little while since I’ve blogged, but fear not, I’m still watching and hoping to blog more in the coming weeks.
In the meantime, it’s been brought to my attention by a few people now that there are a few issues with the Activity control, and I wanted to address them.

Performance – [...]]]></description>
			<content:encoded><![CDATA[<!-- Advanced AdSense by Jim Gaudet --><!-- google_ad_section_start --><p>Hi folks!&#160; It’s been a little while since I’ve blogged, but fear not, I’m still watching and hoping to blog more in the coming weeks.</p>
<p>In the meantime, it’s been brought to my attention by a few people now that there are a few issues with the Activity control, and I wanted to address them.</p>
<ol>
<li>Performance – A bit of a mea culpa on my part.&#160; I included a feature for the control that I’ve called “AutoBind”, whereby it would watch for changes to the visual tree of its contents and subscribe to any control that has a property whose name matches “ActivityPropertyName”.&#160; By default, this is great when working with .NET RIA Service’s DomainDataSource, since ActivityPropertyName is “IsBusy” by default, but it also turns out to be a hefty amount of work, constantly searching the visual tree and registering/unregistering event handlers.&#160; This wouldn’t be so bad, except that AutoBind defaults to true, meaning even if you’re not using this functionality, the Activity control is doing the work.&#160; Below, you’ll find a new version of the Activity control that amends the situation, making AutoBind default to false.&#160; This is the only change to the control since my last post on the matter, but I’d love to hear if you have thoughts about the control, this feature, or other requests!</li>
<li>.NET RIA Services’ Business Application Template – So, the .NET RIA Services guys included with their <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=76bb3a07-3846-4564-b0c3-27972bcaabce&amp;displaylang=en">July Preview</a> a project template to help you get started with a RIA Services application.&#160; In this template, they included a dll with the Activity control in it.&#160; A few people have noted that it has a slightly different API than they’re used to seeing with the control, which is due to their use of the original version of the control that I posted (its API has changed a bit since then, and a number of bugs were fixed, including some layout issues).&#160; Anyhoo, feel free to pick up the latest version below!</li>
</ol>
<p>So there you have it – just a few changes and things to note.&#160; You can find the control here:</p>
<ul>
<li><a href="http://www.davidpoll.com/Download/ActivityControl9-14.zip">Activity Control</a></li>
<li><a href="http://www.davidpoll.com/Download/ActivityControlDemo9-14.zip">Activity control demo project</a></li>
</ul>
<p>Thanks for all the great feedback since I first posted this control.&#160; As usual, let me know if you have questions or issues!</p>
<!-- Advanced AdSense by Jim Gaudet --><!-- google_ad_section_end -->]]></content:encoded>
			<wfw:commentRss>http://www.davidpoll.com/2009/09/14/update-2-displaying-background-activity-in-a-silverlight-ria-application/feed/</wfw:commentRss>
		<slash:comments>31</slash:comments>
		</item>
		<item>
		<title>Update: Displaying background activity in a Silverlight RIA application</title>
		<link>http://www.davidpoll.com/2009/06/11/update-displaying-background-activity-in-a-silverlight-ria-application/</link>
		<comments>http://www.davidpoll.com/2009/06/11/update-displaying-background-activity-in-a-silverlight-ria-application/#comments</comments>
		<pubDate>Thu, 11 Jun 2009 19:59:10 +0000</pubDate>
		<dc:creator>david.poll</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[.NET RIA Services]]></category>
		<category><![CDATA[Activity Control]]></category>
		<category><![CDATA[BusyIndicator]]></category>
		<category><![CDATA[Navigation]]></category>
		<category><![CDATA[Silverlight 3 Beta]]></category>
		<category><![CDATA[WCF RIA Services]]></category>

		<guid isPermaLink="false">http://www.davidpoll.com/?p=73</guid>
		<description><![CDATA[Well, it’s been a while since I first posted on this, but the feedback was incredible, and I got some great suggestions.&#160; As a result, I’ve updated the Activity control and (finally) have a running sample on the web!&#160; The fundamental idea of the control has remained the same, as well as the mechanisms by [...]]]></description>
			<content:encoded><![CDATA[<!-- Advanced AdSense by Jim Gaudet --><!-- google_ad_section_start --><p>Well, it’s been a while since I <a href="http://www.davidpoll.com/?p=4" target="_blank">first posted</a> on this, but the feedback was incredible, and I got some great suggestions.&#160; As a result, I’ve updated the Activity control and (finally) have a running sample on the web!&#160; The fundamental idea of the control has remained the same, as well as the mechanisms by which it can work.&#160; It’s still a prototype, but a very useful one at that!</p>
<p>To see the Activity control in action, take a look here: <a href="http://www.davidpoll.com/Samples/ActivityControlDemo/ActivitySampleTestPage.aspx" target="_blank">Activity Control Demo</a></p>
<p>The demo requires the Silverlight 3 beta to be installed on your machine, which can be found here: <a title="http://silverlight.net/getstarted/silverlight3/default.aspx" href="http://silverlight.net/getstarted/silverlight3/default.aspx">http://silverlight.net/getstarted/silverlight3/default.aspx</a></p>
<p>The demo application shows two examples of using the Activity control to display async/background activity (click the images for deep-links into the Silverlight application):</p>
<ul>
<li>With <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=76bb3a07-3846-4564-b0c3-27972bcaabce&amp;displaylang=en" target="_blank">.NET RIA Services</a> and the DomainDataSource, the Activity control uses element-to-element binding to indicate to the user that data is being loaded or submitted.&#160; The demo page is running live on my server using the <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=06616212-0356-46A0-8DA2-EEBC53A68034&amp;displaylang=en" target="_blank">Northwind sample database</a>.&#160; Those of you who think you can play some dirty tricks by overwriting the data on my server (yes, I provided insert/update/delete functionality) – any attempts to do so will be quickly foiled, since the server will accept the requests, but ignore them! <img src='http://www.davidpoll.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  </li>
</ul>
<p><a href="http://www.davidpoll.com/Samples/ActivityControlDemo/ActivitySampleTestPage.aspx#/RiaServicesActivity" target="_blank"><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title=".NET RIA Services with the Activity Control" border="0" alt=".NET RIA Services with the Activity Control" src="http://www.davidpoll.com/wp-content/uploads/2009/06/image.png" width="604" height="329" /></a></p>
<ul>
<li>Any background activity might warrant using the activity control.&#160; The second example I’ve provided uses the activity control while I use a simple statistical method of approximating PI (yes, very geeky).&#160; It takes millions of iterations to get a mediocre approximation of PI (I know, I’m not using an efficient method, but it does do a lot of work!).&#160; Here, I’ve augmented the Activity control to allow the work to be stopped/cancelled: </li>
</ul>
<p><a href="http://www.davidpoll.com/Samples/ActivityControlDemo/ActivitySampleTestPage.aspx#/HeavyAsyncWork" target="_blank"><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="Calculating PI with background activity" border="0" alt="Calculating PI with background activity" src="http://www.davidpoll.com/wp-content/uploads/2009/06/image1.png" width="604" height="329" /></a></p>
<p>&#160;</p>
<p>So by now I’m sure you’re asking: “What’s changed?”&#160; Well, let me tell you!</p>
<ul>
<li>Thanks to feedback from a variety of folks, I’ve removed the all-encompassing template that included the pop-up window.&#160; That’s now baked into the control template.&#160; If you’d like to change it, you can use the <a href="http://www.microsoft.com/expression/try-it/blendpreview.aspx">Blend 3 Preview</a> to re-template the control.&#160; In its place, I’ve added:
<ul>
<li>A style for the progress bar.&#160; If you’d like to hide it, use a style to collapse the progress bar. </li>
<li>A means for setting “ActiveContent”.&#160; The Activity control works sort of like a HeaderedContentControl.&#160; You now have ActiveContent and ActiveContentTemplate, which allow you to define in XAML what should appear above the progress bar.&#160; You can put any content you like here, and it’s how I added the cancel button in my PI calculation example.&#160; This is also great because it allows you to easily change the text from “Loading…” to whatever you prefer simply be setting the ActiveContent property to the string of your choice! </li>
</ul>
</li>
<li>The default template for the ActivityControl now sets IsHitTestVisible and IsEnabled to false on its content immediately when IsActive becomes true.&#160; In my old prototype, this only happened when the Activity UI became visible, which meant users could continue to interact with the content while it was busy – a potentially dangerous combination if the user’s interactions can be overriden by the asynchronous work (such as editing values in a DataGrid when the data is being reloaded).&#160; This was from a suggestion by Luke Tigaris in the comments on my last post.&#160; Let me know what you think! </li>
<li>You can now call ResetActivity() on the control to force it to honor the visibility of the control immediately rather than enforcing the display delay and minimum display time.&#160; This way, if a user cancels the background work, you can force the Activity UI to be hidden immediately. </li>
</ul>
<p>&#160;</p>
<p>Anyhoo, let me know what you think of the changes!&#160; I’ve gotten lots of great feedback on the control so far, and I’m sure folks will come up with more as time goes on.</p>
<ul>
<li>You can download the source for the control here: <a href="http://www.davidpoll.com/Download/ActivityControl6-11.zip">Activity Control Source</a> </li>
<li>You can also download the source for the demo here: <a href="http://www.davidpoll.com/Download/ActivityControlDemo.zip">Activity Control Demo</a> </li>
</ul>
<p>For both of these, you’ll need the <a href="http://silverlight.net/getstarted/silverlight3/default.aspx">Silverlight 3 Beta</a>.&#160; The Demo application is built using <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=76bb3a07-3846-4564-b0c3-27972bcaabce&amp;displaylang=en" target="_blank">.NET RIA Services</a>.</p>
<p>P.S.&#160; Big thanks again to <a href="http://blogs.msdn.com/corrinab/">Corrina</a> for providing the <a href="http://blogs.msdn.com/brada/archive/2009/03/31/silverlight-3-navigation-application-template-extra-themes-posted.aspx">beautiful theme</a> I used in my application.</p>
<p>P.P.S.&#160; Isn’t navigation and deep-linking in the Silverlight 3 Beta cool?&#160; That’s how I made those images link directly to the corresponding pages of my demo application.&#160; I may post more on this in the future.&#160; In the meantime, take a look at the code to see just how little it took to accomplish that! (hint: MainPage.xaml in the Silverlight Navigation Application project template that’s included with the <a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=11dc7151-dbd6-4e39-878f-5081863cbb5d&amp;displaylang=en">Silverlight 3 Beta Tools for Visual Studio</a> has pretty much everything that’s required)</p>
<p><strong><em>Update 9/14/2009 – </em></strong>I’ve made a small update to the Activity control to fix a performance issue.&#160; You can find it <a href="http://www.davidpoll.com/2009/09/14/update-2-displaying-background-activity-in-a-silverlight-ria-application/">here</a>.</p>
<!-- Advanced AdSense by Jim Gaudet --><!-- google_ad_section_end -->]]></content:encoded>
			<wfw:commentRss>http://www.davidpoll.com/2009/06/11/update-displaying-background-activity-in-a-silverlight-ria-application/feed/</wfw:commentRss>
		<slash:comments>39</slash:comments>
		</item>
		<item>
		<title>Displaying background activity in a Silverlight RIA application</title>
		<link>http://www.davidpoll.com/2009/03/19/displaying-background-activity-in-a-silverlight-ria-application/</link>
		<comments>http://www.davidpoll.com/2009/03/19/displaying-background-activity-in-a-silverlight-ria-application/#comments</comments>
		<pubDate>Thu, 19 Mar 2009 21:32:08 +0000</pubDate>
		<dc:creator>david.poll</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[.NET RIA Services]]></category>
		<category><![CDATA[Activity Control]]></category>
		<category><![CDATA[BusyIndicator]]></category>
		<category><![CDATA[WCF RIA Services]]></category>

		<guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9491183</guid>
		<description><![CDATA[Well, I told you there would be exciting news at MIX!&#160; After months of working on Silverlight 3 Beta 1, it’s finally available for you to try!&#160; Also coming live for MIX is the “.NET RIA Services” March 2009 Preview, which will assist in building multi-tiered applications and provides end-to-end support for things like data [...]]]></description>
			<content:encoded><![CDATA[<!-- Advanced AdSense by Jim Gaudet --><!-- google_ad_section_start --><p>Well, I told you there would be exciting news at MIX!&#160; After months of working on <a href="http://silverlight.net/getstarted/silverlight3/default.aspx">Silverlight 3 Beta 1</a>, it’s finally available for you to try!&#160; Also coming live for MIX is the <a href="http://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;FamilyID=76bb3a07-3846-4564-b0c3-27972bcaabce">“.NET RIA Services” March 2009 Preview,</a> which will assist in building multi-tiered applications and provides end-to-end support for things like data validation, authentication, and roles, as well as data access.</p>
<p>With the Silverlight 3 beta, you can build really rich user experiences for the web.&#160; For the beta, we’ve added a number of controls and features to enable rich experiences when working with data (e.g. an DataForm, DataPager, ErrorSummary, an updated DataGrid, etc.), and the .NET RIA Services preview makes it much easier to bring the data on your servers down to your Silverlight client.</p>
<p>All of this presents a fairly common problem: what should you do with your UI while data is being loaded or work is being done in the background?&#160; If the amount of work done or data to load is small and completes quickly, it would probably make sense to leave the experience uninterrupted for the user.&#160; For larger amounts of work, however, leaving the user with an unresponsive UI or worse with a responsive UI that doesn’t work properly because data is in the midst of being reloaded is less than ideal.</p>
<p>Imagine, for example, that you’re using a DataGrid whose data takes 3 seconds to load (without taking any explicit steps to show activity).&#160; When your user first loads his application, he sees this:</p>
<img class="size-full wp-image-26  " title="Startup loading without any indicators" alt="image_21" src="http://www.davidpoll.com/wp-content/uploads/2009/03/image_21.png" width="576" height="401" />
<p>Not a terribly appealing user experience.&#160; Is the data loading?&#160; What is the user allowed to do with the app right now?&#160; One could show a progress bar somewhere on the screen, but how do you tell the user not to touch the DataGrid until the data is fully loaded?</p>
<p>In the above application, the data is paginated in order to keep the load sizes small and thus speed up the browsing experience.&#160; As a result, moving from page to page may cause load operations to happen as well.&#160; At this point, it is clear that something is strange with the user experience during a page change.&#160; The user would see something like this:</p>
<img class="size-full wp-image-27  " title="Pages changing without activity UI" alt="image_41" src="http://www.davidpoll.com/wp-content/uploads/2009/03/image_41.png" width="576" height="401" />
<p>Even though the data in the DataGrid is the previous page’s data, everything is still interactive.&#160; I can navigate from item to item and attempt to make changes, but in a few seconds everything will be wiped out when the data finishes loading.</p>
<p>There are a number of options for dealing with this:</p>
<ul>
<li>Progress bar </li>
<li>Enable/disable controls </li>
<li>Show/hide controls </li>
<li>Combinations of these </li>
</ul>
<p>I’ve been playing around with a slightly different idea: an “Activity” control.&#160; This is a control that displays activity (when appropriate) over its content.&#160; During active periods, it adds an overlay to its wrapped controls, graying them out, disabling them, and displaying a progress indicator, like so:</p>
<img class="size-full wp-image-28   " title="Using the Activity control" alt="image_61" src="http://www.davidpoll.com/wp-content/uploads/2009/03/image_61.png" width="576" height="397" />
<p>This way, the user knows which controls he can interact with, and he is also given some additional information (“Loading…” in this case) about why the application is busy.</p>
<p>The control I’m experimenting with itself is pretty straightforward.&#160; Some of its more important features:</p>
<ul>
<li>IsActive property – this can be bound to a boolean value that represents activity.&#160; With .NET RIA Services’ DomainDataSource, this is the “IsBusy” property. </li>
<li>DisplayAfter property – this allows you to set a minimum amount of “active” time before the activity UI appears.&#160; This way, tiny bouts of activity don’t interrupt your user’s workflow. </li>
<li>MinDisplayTime property – this allows you to set a minimum amount of time to display the activity UI.&#160; This way, users have enough time to digest why their screen changed, and the activity UI won’t just flash on and off the screen. </li>
<li>AutoBind/ActivityPropertyName – if AutoBind is set to true (which is the default), the control will search its content for controls that have a property with the name specified (“IsBusy” by default), and will automatically hook itself up to display activity whenever any of its children are busy.&#160; If no such children are found, the control will just use its IsActive property. </li>
<li>ActiveContentTemplate property – allows you to set what is actually displayed (and defaults to what you see above!) </li>
</ul>
<p>With this combination of features, the control makes it easy to add activity UI to your application.&#160; In particular, it works pretty well with the DomainDataSource for .NET RIA Services, since it’s really easy to use ElementName binding to bind IsActive to the IsBusy property on the DDS.&#160; Furthermore, if the DDS is actually inside of the activity control, it will automatically pick up the DDS’s activity:</p>
<pre class="code"><span style="color: blue">&lt;</span><span style="color: #a31515">activity</span><span style="color: blue">:</span><span style="color: #a31515">Activity</span><span style="color: blue">&gt;
    &lt;</span><span style="color: #a31515">Grid</span><span style="color: blue">&gt;
        &lt;</span><span style="color: #a31515">Grid.ColumnDefinitions</span><span style="color: blue">&gt;
            &lt;</span><span style="color: #a31515">ColumnDefinition </span><span style="color: red">Width</span><span style="color: blue">=&quot;2*&quot; /&gt;
            &lt;</span><span style="color: #a31515">ColumnDefinition </span><span style="color: red">Width</span><span style="color: blue">=&quot;*&quot; /&gt;
        &lt;/</span><span style="color: #a31515">Grid.ColumnDefinitions</span><span style="color: blue">&gt;
        &lt;</span><span style="color: #a31515">riaControls</span><span style="color: blue">:</span><span style="color: #a31515">DomainDataSource </span><span style="color: red">x</span><span style="color: blue">:</span><span style="color: red">Name</span><span style="color: blue">=&quot;northwindData&quot;
                              </span><span style="color: red">LoadMethodName</span><span style="color: blue">=&quot;LoadProducts&quot;
                              </span><span style="color: red">LoadSize</span><span style="color: blue">=&quot;20&quot;
                              </span><span style="color: red">AutoLoad</span><span style="color: blue">=&quot;True&quot;&gt;
            &lt;</span><span style="color: #a31515">riaControls</span><span style="color: blue">:</span><span style="color: #a31515">DomainDataSource.DomainContext</span><span style="color: blue">&gt;
                &lt;</span><span style="color: #a31515">northwind</span><span style="color: blue">:</span><span style="color: #a31515">NorthwindDomainContext </span><span style="color: blue">/&gt;
            &lt;/</span><span style="color: #a31515">riaControls</span><span style="color: blue">:</span><span style="color: #a31515">DomainDataSource.DomainContext</span><span style="color: blue">&gt;
        &lt;/</span><span style="color: #a31515">riaControls</span><span style="color: blue">:</span><span style="color: #a31515">DomainDataSource</span><span style="color: blue">&gt;
        &lt;</span><span style="color: #a31515">data</span><span style="color: blue">:</span><span style="color: #a31515">DataGrid </span><span style="color: red">ItemsSource</span><span style="color: blue">=&quot;{</span><span style="color: #a31515">Binding </span><span style="color: red">Data</span><span style="color: blue">, </span><span style="color: red">ElementName</span><span style="color: blue">=northwindData}&quot;
                       </span><span style="color: red">CanUserSortColumns</span><span style="color: blue">=&quot;{</span><span style="color: #a31515">Binding </span><span style="color: red">HasChanges</span><span style="color: blue">, </span><span style="color: red">ElementName</span><span style="color: blue">=northwindData, </span><span style="color: red">Converter</span><span style="color: blue">={</span><span style="color: #a31515">StaticResource </span><span style="color: red">boolConverter</span><span style="color: blue">}}&quot;&gt;
        &lt;/</span><span style="color: #a31515">data</span><span style="color: blue">:</span><span style="color: #a31515">DataGrid</span><span style="color: blue">&gt;
        &lt;</span><span style="color: #a31515">dataControls</span><span style="color: blue">:</span><span style="color: #a31515">DataForm </span><span style="color: red">Grid.Column</span><span style="color: blue">=&quot;1&quot;
                               </span><span style="color: red">ItemsSource</span><span style="color: blue">=&quot;{</span><span style="color: #a31515">Binding </span><span style="color: red">Data</span><span style="color: blue">, </span><span style="color: red">ElementName</span><span style="color: blue">=northwindData}&quot;&gt;
        &lt;/</span><span style="color: #a31515">dataControls</span><span style="color: blue">:</span><span style="color: #a31515">DataForm</span><span style="color: blue">&gt;
    &lt;/</span><span style="color: #a31515">Grid</span><span style="color: blue">&gt;
&lt;/</span><span style="color: #a31515">activity</span><span style="color: blue">:</span><span style="color: #a31515">Activity</span><span style="color: blue">&gt;</span></pre>
<p>Otherwise, it’s a simple matter of using ElementName binding to wire up your activity UI:</p>
<pre class="code"><span style="color: blue">&lt;</span><span style="color: #a31515">activity</span><span style="color: blue">:</span><span style="color: #a31515">Activity </span><span style="color: red">IsActive</span><span style="color: blue">=&quot;{</span><span style="color: #a31515">Binding </span><span style="color: red">IsBusy</span><span style="color: blue">, </span><span style="color: red">ElementName</span><span style="color: blue">=northwindData}&quot;&gt;
    &lt;</span><span style="color: #a31515">Grid</span><span style="color: blue">&gt;
        &lt;</span><span style="color: #a31515">Grid.ColumnDefinitions</span><span style="color: blue">&gt;
            &lt;</span><span style="color: #a31515">ColumnDefinition </span><span style="color: red">Width</span><span style="color: blue">=&quot;2*&quot; /&gt;
            &lt;</span><span style="color: #a31515">ColumnDefinition </span><span style="color: red">Width</span><span style="color: blue">=&quot;*&quot; /&gt;
        &lt;/</span><span style="color: #a31515">Grid.ColumnDefinitions</span><span style="color: blue">&gt;
        &lt;</span><span style="color: #a31515">data</span><span style="color: blue">:</span><span style="color: #a31515">DataGrid </span><span style="color: red">ItemsSource</span><span style="color: blue">=&quot;{</span><span style="color: #a31515">Binding </span><span style="color: red">Data</span><span style="color: blue">, </span><span style="color: red">ElementName</span><span style="color: blue">=northwindData}&quot;
                       </span><span style="color: red">CanUserSortColumns</span><span style="color: blue">=&quot;{</span><span style="color: #a31515">Binding </span><span style="color: red">HasChanges</span><span style="color: blue">, </span><span style="color: red">ElementName</span><span style="color: blue">=northwindData, </span><span style="color: red">Converter</span><span style="color: blue">={</span><span style="color: #a31515">StaticResource </span><span style="color: red">boolConverter</span><span style="color: blue">}}&quot;&gt;
        &lt;/</span><span style="color: #a31515">data</span><span style="color: blue">:</span><span style="color: #a31515">DataGrid</span><span style="color: blue">&gt;
        &lt;</span><span style="color: #a31515">dataControls</span><span style="color: blue">:</span><span style="color: #a31515">DataForm </span><span style="color: red">Grid.Column</span><span style="color: blue">=&quot;1&quot;
                               </span><span style="color: red">ItemsSource</span><span style="color: blue">=&quot;{</span><span style="color: #a31515">Binding </span><span style="color: red">Data</span><span style="color: blue">, </span><span style="color: red">ElementName</span><span style="color: blue">=northwindData}&quot;&gt;
        &lt;/</span><span style="color: #a31515">dataControls</span><span style="color: blue">:</span><span style="color: #a31515">DataForm</span><span style="color: blue">&gt;
    &lt;/</span><span style="color: #a31515">Grid</span><span style="color: blue">&gt;
&lt;/</span><span style="color: #a31515">activity</span><span style="color: blue">:</span><span style="color: #a31515">Activity</span><span style="color: blue">&gt;</span></pre>
<p>With this control, it’s easy to have multiple controls all show activity at the same time (either by wrapping them all with the Activity control or by binding activity controls to the same value), and the “busy” experience can be consistent across the app.</p>
<p>This is just a simple prototype control, but I’d love to hear what you think!&#160; Is there something important that’s missing?&#160; Are there other user experience deficiencies you see (either when using SL3 for RIA applications generally or with the .NET RIA Services preview)?</p>
<p>In the meantime, if you’d like to play with my prototype/source, you can find it below.&#160; This code is provided under the <a href="http://www.microsoft.com/opensource/licenses.mspx#Ms-PL">Microsoft Public License</a> and is also provided &quot;as is&quot;, without warranty of any kind.</p>
<ul>
<li><a href="http://www.davidpoll.com/samples/download/ActivityControl.zip">Activity Control</a> (built on SL3 beta 1) </li>
<li><a href="http://www.davidpoll.com/samples/download/ActivitySample.zip">Activity control demo project, shown above</a> (requires SL3 beta 1 and .NET RIA Services) </li>
</ul>
<p>Enjoy!</p>
<p>&#160;</p>
<p><strong><em>Update 6/11/2009 – </em></strong>A new version of the control is available <a href="http://www.davidpoll.com/?p=73" target="_blank">here</a>.</p>
<p><strong><em>Update 7/11/2009 – </em></strong>Samples updated for Silverlight 3!</p>
<p><strong><em>Update 9/14/2009 – </em></strong>I’ve made a small update to the Activity control to fix a performance issue.&#160; You can find it <a href="http://www.davidpoll.com/2009/09/14/update-2-displaying-background-activity-in-a-silverlight-ria-application/">here</a>.</p>
<p>P.S. Thanks to <a href="http://blogs.msdn.com/corrinab/">CorrinaB</a> for helping me snazz up the UI!</p>
<p><img alt="" src="http://blogs.msdn.com/aggbug.aspx?PostID=9491183" width="1" height="1" /></p>
<!-- Advanced AdSense by Jim Gaudet --><!-- google_ad_section_end -->]]></content:encoded>
			<wfw:commentRss>http://www.davidpoll.com/2009/03/19/displaying-background-activity-in-a-silverlight-ria-application/feed/</wfw:commentRss>
		<slash:comments>44</slash:comments>
		</item>
	</channel>
</rss>
