<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Silverlight for Business &#187; Developers</title>
	<atom:link href="http://silverlightforbusiness.net/category/developers/feed/" rel="self" type="application/rss+xml" />
	<link>http://silverlightforbusiness.net</link>
	<description></description>
	<lastBuildDate>Thu, 05 Jan 2012 07:41:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='silverlightforbusiness.net' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://1.gravatar.com/blavatar/98e6239e13bc89023c26c53413ea95ab?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>Silverlight for Business &#187; Developers</title>
		<link>http://silverlightforbusiness.net</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://silverlightforbusiness.net/osd.xml" title="Silverlight for Business" />
	<atom:link rel='hub' href='http://silverlightforbusiness.net/?pushpress=hub'/>
		<item>
		<title>Bloggers: Win a free place to the Silverlight Masterclass (worth £1095!)</title>
		<link>http://silverlightforbusiness.net/2010/04/27/bloggers-win-a-free-place-to-the-silverlight-masterclass-worth/</link>
		<comments>http://silverlightforbusiness.net/2010/04/27/bloggers-win-a-free-place-to-the-silverlight-masterclass-worth/#comments</comments>
		<pubDate>Tue, 27 Apr 2010 16:32:23 +0000</pubDate>
		<dc:creator>ianblackburn</dc:creator>
				<category><![CDATA[Blend 4]]></category>
		<category><![CDATA[Designers]]></category>
		<category><![CDATA[Developers]]></category>
		<category><![CDATA[M-V-VM]]></category>
		<category><![CDATA[PRISM]]></category>
		<category><![CDATA[RIA Services]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Blend]]></category>
		<category><![CDATA[Masterclass]]></category>
		<category><![CDATA[MVVM]]></category>
		<category><![CDATA[Prism]]></category>

		<guid isPermaLink="false">https://silverlightforbusiness.wordpress.com/2010/04/27/bloggers-win-a-free-place-to-the-silverlight-masterclass-worth/</guid>
		<description><![CDATA[bbits are giving away a free ticket for the Silverlight Masterclasses in June To enter the raffle all you need to do is use the exact text between these lines in your blog post, including all the links, then email &#8230; <a href="http://silverlightforbusiness.net/2010/04/27/bloggers-win-a-free-place-to-the-silverlight-masterclass-worth/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=silverlightforbusiness.net&amp;blog=7274361&amp;post=87&amp;subd=silverlightforbusiness&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.bbits.co.uk">bbits</a> are giving away a free ticket for the <a href="http://silverlightmasterclass.net" target="_blank">Silverlight Masterclasses</a> in June</p>
<p>To enter the raffle all you need to do is use the exact text between these lines in your blog post, including all the links, then email <a href="mailto:Ian@bbits.co.uk">Ian@bbits.co.uk</a> with the url to the blog entry.&#160; You can chose any of the events listed on the site.</p>
<p>The draw will be made on June 1st and the winner notified by email and via this blog.</p>
<p>Good Luck!</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8211; TEXT STARTS HERE</p>
<p>The Silverlight Tour comes to the UK – and it’s called the Masterclass!</p>
<p>This 3 day hands-on training with both designer and developer tracks looks awesome and (uniquely) has <strong>two </strong>expert trainers per course.&#160; </p>
<p>Currently scheduled in London, Manchester, and the Midlands for June, all courses also come with the chance to win an xbox 360, and Silverlight Spy licences!</p>
<p>Early bird discount of £100 if you book in May, and if you are a member of #SLUGUK or #<a href="http://www.nxtgenug.net/" target="_blank">nxtgenug</a> there are additional discounts to be had.</p>
<p>Full Details are here: <a href="http://silverlightmasterclass.net">http://silverlightmasterclass.net</a> </p>
<p>In addition bbits are holding a raffle for a free ticket for the masterclass. To be eligible to win the ticket (worth £1095!) you MUST paste this text, including all links, into your blog and email <a href="mailto:Ian@bbits.co.uk">Ian@bbits.co.uk</a> with the url to the blog entry.&#160; The draw will be made on June 1st and the winner informed by email and on <a href="http://silverlightmasterclass.net">http://silverlightmasterclass.net</a></p>
<p>&#8212;&#8212;&#8212;&#8212;- TEXT ENDS</p>
<p>Cheers</p>
<p>Ian</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/silverlightforbusiness.wordpress.com/87/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/silverlightforbusiness.wordpress.com/87/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/silverlightforbusiness.wordpress.com/87/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/silverlightforbusiness.wordpress.com/87/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/silverlightforbusiness.wordpress.com/87/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/silverlightforbusiness.wordpress.com/87/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/silverlightforbusiness.wordpress.com/87/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/silverlightforbusiness.wordpress.com/87/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/silverlightforbusiness.wordpress.com/87/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/silverlightforbusiness.wordpress.com/87/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/silverlightforbusiness.wordpress.com/87/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/silverlightforbusiness.wordpress.com/87/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/silverlightforbusiness.wordpress.com/87/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/silverlightforbusiness.wordpress.com/87/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=silverlightforbusiness.net&amp;blog=7274361&amp;post=87&amp;subd=silverlightforbusiness&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://silverlightforbusiness.net/2010/04/27/bloggers-win-a-free-place-to-the-silverlight-masterclass-worth/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e2b17c2fe571c44c0f3c00b3610b692f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ianblackburn</media:title>
		</media:content>
	</item>
		<item>
		<title>Using the DataStateBehavior for &#8220;Loading animations&#8221; in MVVM</title>
		<link>http://silverlightforbusiness.net/2010/04/26/using-the-datastatebehavior-for-loading-animations-in-mvvm/</link>
		<comments>http://silverlightforbusiness.net/2010/04/26/using-the-datastatebehavior-for-loading-animations-in-mvvm/#comments</comments>
		<pubDate>Mon, 26 Apr 2010 20:45:14 +0000</pubDate>
		<dc:creator>ianblackburn</dc:creator>
				<category><![CDATA[Blend 4]]></category>
		<category><![CDATA[Designers]]></category>
		<category><![CDATA[Developers]]></category>
		<category><![CDATA[M-V-VM]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Behaviors]]></category>
		<category><![CDATA[Blend]]></category>
		<category><![CDATA[MVVM]]></category>

		<guid isPermaLink="false">https://silverlightforbusiness.wordpress.com/2010/04/26/using-the-datastatebehavior-for-loading-animations-in-mvvm/</guid>
		<description><![CDATA[Behaviours are growing in importance within Blend – especially for developing Silverlight and WPF apps using the MVVM pattern.&#160; In fact they are becoming so useful we have to wonder when they will be made available in the editor of &#8230; <a href="http://silverlightforbusiness.net/2010/04/26/using-the-datastatebehavior-for-loading-animations-in-mvvm/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=silverlightforbusiness.net&amp;blog=7274361&amp;post=86&amp;subd=silverlightforbusiness&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Behaviours are growing in importance within Blend – especially for developing Silverlight and WPF apps using the MVVM pattern.&#160; In fact they are becoming so useful we have to wonder when they will be made available in the editor of VS 2010.</p>
<p>A couple you should definitely look at, if you haven’t already done so when using MVVM, are the CallMethodAction and InvokeCommandAction that make it easy to wire up a Method or Command in your ViewModel using the Blend editor.</p>
<p>However a new one that now ships in box with Blend 4 offers something a little more interesting and perhaps less obvious.&#160; This is the DataStateBehavior which allows you to change to a Control State depending on a property of your ViewModel.&#160; This struck me as an easy way to provide an animation when your ViewModel is doing some async work.</p>
<p>Lets take a simple example.&#160; First the ViewModel.&#160; This has a single method called DoWork that simulates a few seconds of work (e.g. calling an async service) and a property called IsWorking that can be set to true whenever the ViewModel is doing some prolonged work.&#160; One way to handle this in a more complex scenarios when you could possible have multiple async calls happening is to have a counter that you increment whenever you start some work and the decrement when you stop work.&#160; Whenever the counter is positive then you should display your “loading animation” which we’ll achieve through the DataStateBehavior.&#160; Here it is:</p>
</p>
<div id="codeSnippetWrapper">
<div style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0;" id="codeSnippet">
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum1">   1:</span> <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">class</span> MainPageViewModel : INotifyPropertyChanged</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum2">   2:</span> {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum3">   3:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum4">   4:</span>     <span style="color:#0000ff;">private</span> <span style="color:#0000ff;">bool</span> _isWorking;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum5">   5:</span>     <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">bool</span> IsWorking</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum6">   6:</span>     {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum7">   7:</span>         get</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum8">   8:</span>         {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum9">   9:</span>             <span style="color:#0000ff;">return</span> _isWorking;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum10">  10:</span>         }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum11">  11:</span>         set</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum12">  12:</span>         {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum13">  13:</span>             _isWorking = <span style="color:#0000ff;">value</span>;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum14">  14:</span>             RaisePropertyChanged(<span style="color:#006080;">&quot;IsWorking&quot;</span>);</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum15">  15:</span>         }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum16">  16:</span>     }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum17">  17:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum18">  18:</span>     <span style="color:#0000ff;">private</span> <span style="color:#0000ff;">int</span> _workCount;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum19">  19:</span>     <span style="color:#0000ff;">private</span> <span style="color:#0000ff;">int</span> WorkCount</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum20">  20:</span>     {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum21">  21:</span>         get</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum22">  22:</span>         {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum23">  23:</span>             <span style="color:#0000ff;">return</span> _workCount;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum24">  24:</span>         }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum25">  25:</span>         set</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum26">  26:</span>         {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum27">  27:</span>             <span style="color:#0000ff;">if</span> (<span style="color:#0000ff;">value</span> &lt; 0) <span style="color:#0000ff;">value</span> = 0;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum28">  28:</span>             _workCount = <span style="color:#0000ff;">value</span>;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum29">  29:</span>             IsWorking = _workCount &gt; 0;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum30">  30:</span>         }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum31">  31:</span>     }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum32">  32:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum33">  33:</span>     <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">void</span> DoWork()</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum34">  34:</span>     {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum35">  35:</span>         <span style="color:#008000;">//simulate some work</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum36">  36:</span>         WorkCount++;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum37">  37:</span>         DispatcherTimer timer = <span style="color:#0000ff;">new</span> DispatcherTimer();</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum38">  38:</span>         timer.Interval = TimeSpan.FromSeconds(3);</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum39">  39:</span>         timer.Start();</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum40">  40:</span>         timer.Tick += (sender, args) =&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum41">  41:</span>         {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum42">  42:</span>             WorkCount--;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum43">  43:</span>             timer.Stop();</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum44">  44:</span>         };</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum45">  45:</span>         </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum46">  46:</span>     }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum47">  47:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum48">  48:</span>     <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">void</span> RaisePropertyChanged(<span style="color:#0000ff;">string</span> propertyName)</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum49">  49:</span>     {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum50">  50:</span>         <span style="color:#0000ff;">if</span> (PropertyChanged != <span style="color:#0000ff;">null</span>)</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum51">  51:</span>         {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum52">  52:</span>             PropertyChanged(<span style="color:#0000ff;">this</span>, <span style="color:#0000ff;">new</span> PropertyChangedEventArgs(propertyName));</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum53">  53:</span>         }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum54">  54:</span>     }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum55">  55:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum56">  56:</span>     <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">event</span> PropertyChangedEventHandler PropertyChanged;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum57">  57:</span> }</pre>
<p><!--CRLF--></div>
</div>
<p>&#160;</p>
<p>In Blend I first set the DataContext for the User Control to this ViewModel</p>
<p><a href="http://silverlightforbusiness.files.wordpress.com/2010/04/image.png"><img style="display:inline;border-width:0;" title="image" border="0" alt="image" src="http://silverlightforbusiness.files.wordpress.com/2010/04/image_thumb.png?w=572&#038;h=484" width="572" height="484" /></a> </p>
<p>Which looks like this in Xaml and will instantiate the ViewModel and set it as the DataContext for this View (UserControl)</p>
<p><a href="http://silverlightforbusiness.files.wordpress.com/2010/04/image1.png"><img style="display:inline;border-width:0;" title="image" border="0" alt="image" src="http://silverlightforbusiness.files.wordpress.com/2010/04/image_thumb1.png?w=644&#038;h=97" width="644" height="97" /></a> </p>
</p>
<p>I drew a big button on the artboard and then created a couple of states called “Working” and “NotWorking”.&#160; I had a bit of fun setting some effects and animations for the state transitions.&#160; In particular I made sure the animation for the Working state was set to auto-reverse and repeat forever.</p>
<p><a href="http://silverlightforbusiness.files.wordpress.com/2010/04/image2.png"><img style="display:inline;border-width:0;" title="image" border="0" alt="image" src="http://silverlightforbusiness.files.wordpress.com/2010/04/image_thumb2.png?w=644&#038;h=409" width="644" height="409" /></a> </p>
<p>Now comes the fun bit by using Blend behaviours to wire up the click event on the button to the DoWork method in the ViewModel and then to use the DataStateBehavior to change between the Working and NoWorking states based on the IsWorking property on the ViewModel.</p>
<p>First to wire up the Do Work Method (Note there is also an InvokeCommandAction you can use if you have a command on your ViewModel rather than a simple method I have created here).&#160; To do this you simple drag the CallMethodAction from the Behaviors section in the assets panel and set the properties as shown below:</p>
<p><a href="http://silverlightforbusiness.files.wordpress.com/2010/04/image3.png"><img style="display:inline;border-width:0;" title="image" border="0" alt="image" src="http://silverlightforbusiness.files.wordpress.com/2010/04/image_thumb3.png?w=644&#038;h=272" width="644" height="272" /></a> </p>
<p>To wire up the DataStateBehavior the process is similar – drag it from the behaviour from the assets panel and set the properties as shown:</p>
<p><a href="http://silverlightforbusiness.files.wordpress.com/2010/04/image4.png"><img style="display:inline;border-width:0;" title="image" border="0" alt="image" src="http://silverlightforbusiness.files.wordpress.com/2010/04/image_thumb4.png?w=644&#038;h=354" width="644" height="354" /></a> </p>
<p>This looks like this in XAML:</p>
<p><a href="http://silverlightforbusiness.files.wordpress.com/2010/04/image5.png"><img style="display:inline;border-width:0;" title="image" border="0" alt="image" src="http://silverlightforbusiness.files.wordpress.com/2010/04/image_thumb5.png?w=644&#038;h=130" width="644" height="130" /></a> </p>
<p>And that’s it!&#160; Running the app and clicking the button will run your method in your ViewModel and dispay your Working state.&#160; Once the work is complete in the ViewModel the control returns to the NotWorking state.&#160; </p>
<p>This is nice because:</p>
<ul>
<li>The ViewModel knows nothing of the View and so is more easily testable. </li>
<li>Everything can be wired up in Blend – no code to write for a designer. </li>
<li>The Xaml is actually nice and straight forward to, and easy to understand. </li>
</ul>
<p>I would like to see Behaviours in the VS2010 too, because I think there is definitely a case for developers taking advantage of this sort of thing, though it wouldn’t take much for them to type in the Xaml directly.</p>
<p>Example project is available from here: <a title="http://cid-fb8b852ef1ab0b35.skydrive.live.com/self.aspx/SampleCode/SimpleMVVMLoadingAnimation.zip" href="http://cid-fb8b852ef1ab0b35.skydrive.live.com/self.aspx/SampleCode/SimpleMVVMLoadingAnimation.zip">http://cid-fb8b852ef1ab0b35.skydrive.live.com/self.aspx/SampleCode/SimpleMVVMLoadingAnimation.zip</a>&#160;</p>
<p>Cheers</p>
<p>Ian</p>
<p>P.S. Don’t forget our Silverlight Masterclass is now touring the UK:&#160; <a href="http://silverlightmasterclass.net">Http://silverlightmasterclass.net</a> – book early!</p>
<div style="display:inline;float:none;margin:0;padding:0;" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:07407d9f-abe2-4662-b7a2-adb97661d165" class="wlWriterEditableSmartContent">Technorati Tags: <a href="http://technorati.com/tags/Silverlightpulse" rel="tag">Silverlightpulse</a>,<a href="http://technorati.com/tags/Blend" rel="tag">Blend</a>,<a href="http://technorati.com/tags/MVVM" rel="tag">MVVM</a>,<a href="http://technorati.com/tags/Behaviors" rel="tag">Behaviors</a></div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/silverlightforbusiness.wordpress.com/86/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/silverlightforbusiness.wordpress.com/86/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/silverlightforbusiness.wordpress.com/86/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/silverlightforbusiness.wordpress.com/86/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/silverlightforbusiness.wordpress.com/86/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/silverlightforbusiness.wordpress.com/86/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/silverlightforbusiness.wordpress.com/86/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/silverlightforbusiness.wordpress.com/86/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/silverlightforbusiness.wordpress.com/86/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/silverlightforbusiness.wordpress.com/86/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/silverlightforbusiness.wordpress.com/86/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/silverlightforbusiness.wordpress.com/86/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/silverlightforbusiness.wordpress.com/86/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/silverlightforbusiness.wordpress.com/86/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=silverlightforbusiness.net&amp;blog=7274361&amp;post=86&amp;subd=silverlightforbusiness&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://silverlightforbusiness.net/2010/04/26/using-the-datastatebehavior-for-loading-animations-in-mvvm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e2b17c2fe571c44c0f3c00b3610b692f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ianblackburn</media:title>
		</media:content>

		<media:content url="http://silverlightforbusiness.files.wordpress.com/2010/04/image_thumb.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://silverlightforbusiness.files.wordpress.com/2010/04/image_thumb1.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://silverlightforbusiness.files.wordpress.com/2010/04/image_thumb2.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://silverlightforbusiness.files.wordpress.com/2010/04/image_thumb3.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://silverlightforbusiness.files.wordpress.com/2010/04/image_thumb4.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://silverlightforbusiness.files.wordpress.com/2010/04/image_thumb5.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>New Silverlight 3 Training in the UK</title>
		<link>http://silverlightforbusiness.net/2009/08/15/new-silverlight-3-training-in-the-uk/</link>
		<comments>http://silverlightforbusiness.net/2009/08/15/new-silverlight-3-training-in-the-uk/#comments</comments>
		<pubDate>Sat, 15 Aug 2009 16:07:33 +0000</pubDate>
		<dc:creator>ianblackburn</dc:creator>
				<category><![CDATA[Sketchflow]]></category>
		<category><![CDATA[Blend 3]]></category>
		<category><![CDATA[Designers]]></category>
		<category><![CDATA[Developers]]></category>
		<category><![CDATA[M-V-VM]]></category>
		<category><![CDATA[PRISM]]></category>
		<category><![CDATA[RIA Services]]></category>
		<category><![CDATA[Training]]></category>

		<guid isPermaLink="false">http://silverlightforbusiness.wordpress.com/2009/08/15/new-silverlight-3-training-in-the-uk/</guid>
		<description><![CDATA[bbits have produced 2 new Silverlight 3 courses; one targeted at designers, the other at developers building line of business applications. Both are bang up to date, including Sketchflow and Blend 3 for designers and RIA Services, PRISM and M-V-VM &#8230; <a href="http://silverlightforbusiness.net/2009/08/15/new-silverlight-3-training-in-the-uk/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=silverlightforbusiness.net&amp;blog=7274361&amp;post=62&amp;subd=silverlightforbusiness&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://bbits.co.uk">bbits</a> have produced 2 new Silverlight 3 courses; one targeted at designers, the other at developers building line of business applications.</p>
<p>Both are bang up to date, including Sketchflow and Blend 3 for designers and RIA Services, PRISM and M-V-VM for developers.</p>
<p>Take a look:</p>
<ul>
<li><a href="http://bbits.co.uk/services/training/?57">Silverlight for Designers with Blend 3</a></li>
<li><a href="http://bbits.co.uk/services/training/?47">Silverlight for Developers (inc Ria Services, M-V-VM and PRISM)</a></li>
</ul>
<p>bbits courses can be customised at no extra cost, so if you can’t take the 5 days for the full developers course, you can cherry pick the bits you want and just do them!</p>
<p>Cheers</p>
<p>Ian</p>
<div id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:ff1f0722-7076-4f11-aa09-bc570fb21266" class="wlWriterEditableSmartContent" style="display:inline;float:none;margin:0;padding:0;">Technorati Tags: <a rel="tag" href="http://technorati.com/tags/Silverlight">Silverlight</a>,<a rel="tag" href="http://technorati.com/tags/Training">Training</a>,<a rel="tag" href="http://technorati.com/tags/uk">uk</a></div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/silverlightforbusiness.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/silverlightforbusiness.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/silverlightforbusiness.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/silverlightforbusiness.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/silverlightforbusiness.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/silverlightforbusiness.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/silverlightforbusiness.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/silverlightforbusiness.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/silverlightforbusiness.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/silverlightforbusiness.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/silverlightforbusiness.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/silverlightforbusiness.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/silverlightforbusiness.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/silverlightforbusiness.wordpress.com/62/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=silverlightforbusiness.net&amp;blog=7274361&amp;post=62&amp;subd=silverlightforbusiness&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://silverlightforbusiness.net/2009/08/15/new-silverlight-3-training-in-the-uk/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e2b17c2fe571c44c0f3c00b3610b692f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ianblackburn</media:title>
		</media:content>
	</item>
	</channel>
</rss>
