<?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:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>C# Disciples</title>
	<atom:link href="http://marlongrech.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://marlongrech.wordpress.com</link>
	<description>my life in Avalon ....</description>
	<lastBuildDate>Thu, 15 Oct 2009 09:19:13 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='marlongrech.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/0c938eec94507e7222db1a9e8ad7ba9e?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>C# Disciples</title>
		<link>http://marlongrech.wordpress.com</link>
	</image>
			<item>
		<title>WPF Disciples Resources Page updated</title>
		<link>http://marlongrech.wordpress.com/2009/10/15/wpf-disicples-resources-page-updated/</link>
		<comments>http://marlongrech.wordpress.com/2009/10/15/wpf-disicples-resources-page-updated/#comments</comments>
		<pubDate>Thu, 15 Oct 2009 09:18:54 +0000</pubDate>
		<dc:creator>marlongrech</dc:creator>
				<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://marlongrech.wordpress.com/2009/10/15/wpf-disicples-resources-page-updated/</guid>
		<description><![CDATA[Hey all… I just updated the Resources Page for the WPF Disciples blog. There are loads of goodies in one place… Loads of MVVM toolkits… feel free to dig in   
http://wpfdisciples.wordpress.com/resources/
&#160;

       <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=marlongrech.wordpress.com&blog=783168&post=365&subd=marlongrech&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Hey all… I just updated the <a href="http://wpfdisciples.wordpress.com/resources/">Resources</a> Page for the WPF Disciples blog. There are loads of goodies in one place… Loads of MVVM toolkits… feel free to dig in <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  </p>
<p><a href="http://wpfdisciples.wordpress.com/resources/">http://wpfdisciples.wordpress.com/resources/</a></p>
<p>&#160;</p>
<p><a href="http://marlongrech.files.wordpress.com/2009/10/wbfbanner.png"><img style="border-bottom:0;border-left:0;display:inline;border-top:0;border-right:0;" title="WBF-banner" border="0" alt="WBF-banner" src="http://marlongrech.files.wordpress.com/2009/10/wbfbanner_thumb.png?w=178&#038;h=178" width="178" height="178" /></a></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/marlongrech.wordpress.com/365/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/marlongrech.wordpress.com/365/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/marlongrech.wordpress.com/365/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/marlongrech.wordpress.com/365/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/marlongrech.wordpress.com/365/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/marlongrech.wordpress.com/365/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/marlongrech.wordpress.com/365/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/marlongrech.wordpress.com/365/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/marlongrech.wordpress.com/365/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/marlongrech.wordpress.com/365/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=marlongrech.wordpress.com&blog=783168&post=365&subd=marlongrech&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://marlongrech.wordpress.com/2009/10/15/wpf-disicples-resources-page-updated/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4231953dc5a7ec7d7b5acb2444eeeeab?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">C# Disciple</media:title>
		</media:content>

		<media:content url="http://marlongrech.files.wordpress.com/2009/10/wbfbanner_thumb.png" medium="image">
			<media:title type="html">WBF-banner</media:title>
		</media:content>
	</item>
		<item>
		<title>MTS Poland Presentation and sample</title>
		<link>http://marlongrech.wordpress.com/2009/09/29/mts-poland-presentation-and-sample/</link>
		<comments>http://marlongrech.wordpress.com/2009/09/29/mts-poland-presentation-and-sample/#comments</comments>
		<pubDate>Tue, 29 Sep 2009 15:32:34 +0000</pubDate>
		<dc:creator>marlongrech</dc:creator>
				<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://marlongrech.wordpress.com/2009/09/29/mts-poland-presentation-and-sample/</guid>
		<description><![CDATA[As promised, here are the slides and samples for my presentation in Poland on MVVM and Friends.
DOWNLOAD FROM HERE
If you need any help or have any questions feel free to send me an email at marlongrech AT gmail DOT Com (please not I wrote the email in such a way for spam readers)
   [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=marlongrech.wordpress.com&blog=783168&post=362&subd=marlongrech&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>As promised, here are the slides and samples for my presentation in Poland on MVVM and Friends.</p>
<p><a href="http://cid-96f8d49aa44c79c1.skydrive.live.com/self.aspx/Public/MTS%20Presentation%20and%20Samples.zip">DOWNLOAD FROM HERE</a></p>
<p>If you need any help or have any questions feel free to send me an email at marlongrech AT gmail DOT Com (please not I wrote the email in such a way for spam readers)</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/marlongrech.wordpress.com/362/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/marlongrech.wordpress.com/362/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/marlongrech.wordpress.com/362/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/marlongrech.wordpress.com/362/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/marlongrech.wordpress.com/362/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/marlongrech.wordpress.com/362/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/marlongrech.wordpress.com/362/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/marlongrech.wordpress.com/362/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/marlongrech.wordpress.com/362/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/marlongrech.wordpress.com/362/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=marlongrech.wordpress.com&blog=783168&post=362&subd=marlongrech&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://marlongrech.wordpress.com/2009/09/29/mts-poland-presentation-and-sample/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4231953dc5a7ec7d7b5acb2444eeeeab?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">C# Disciple</media:title>
		</media:content>
	</item>
		<item>
		<title>How to set WPF ScrollViewer VerticalOffset and Horizontal offset</title>
		<link>http://marlongrech.wordpress.com/2009/09/14/how-to-set-wpf-scrollviewer-verticaloffset-and-horizontal-offset/</link>
		<comments>http://marlongrech.wordpress.com/2009/09/14/how-to-set-wpf-scrollviewer-verticaloffset-and-horizontal-offset/#comments</comments>
		<pubDate>Mon, 14 Sep 2009 14:34:44 +0000</pubDate>
		<dc:creator>marlongrech</dc:creator>
				<category><![CDATA[WPF]]></category>
		<category><![CDATA[tips and tricks]]></category>

		<guid isPermaLink="false">http://marlongrech.wordpress.com/2009/09/14/how-to-set-wpf-scrollviewer-verticaloffset-and-horizontal-offset/</guid>
		<description><![CDATA[Today I needed to bind to the ScrolViewer VerticalOffset and Horizontal offset to do an animation for them. Yet unfortunately you cannot do this. In order to set these properties you need to use the ScrollToVerticalOffset or ScrollToHorizontalOffset methods :S This is not very good because it means you cannot do DataBinding or animate these [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=marlongrech.wordpress.com&blog=783168&post=361&subd=marlongrech&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Today I needed to bind to the ScrolViewer VerticalOffset and Horizontal offset to do an animation for them. Yet unfortunately you cannot do this. In order to set these properties you need to use the ScrollToVerticalOffset or ScrollToHorizontalOffset methods :S This is not very good because it means you cannot do DataBinding or animate these properties….</p>
<p>Well as usual I resorted to&#160; Attached Behaviour. Basically I created 2 attached properties one for HorizontalOffset and one for VerticalOffset. These properties just call the methods ScrollToVerticalOffset or ScrollToHorizontalOffset inside the property changed handlers… yep it’s as simple as that… Here is the attached behaviour class</p>
<div style="border-bottom:silver 1px solid;text-align:left;border-left:silver 1px solid;line-height:12pt;background-color:#f4f4f4;width:97.5%;font-family:&#39;direction:ltr;max-height:200px;font-size:8pt;overflow:auto;border-top:silver 1px solid;cursor:text;border-right:silver 1px solid;margin:20px 0 10px;padding:4px;" id="codeSnippetWrapper">
<div style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;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:&#39;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> ScrollViewerUtilities</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;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:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum3">   3:</span>     <span style="color:#cc6633;">#region</span> HorizontalOffset</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum4">   4:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;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:#008000;">/// &lt;summary&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum6">   6:</span>     <span style="color:#008000;">/// HorizontalOffset Attached Dependency Property</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum7">   7:</span>     <span style="color:#008000;">/// &lt;/summary&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum8">   8:</span>     <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">static</span> <span style="color:#0000ff;">readonly</span> DependencyProperty HorizontalOffsetProperty =</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum9">   9:</span>         DependencyProperty.RegisterAttached(<span style="color:#006080;">&quot;HorizontalOffset&quot;</span>, <span style="color:#0000ff;">typeof</span>(<span style="color:#0000ff;">double</span>), <span style="color:#0000ff;">typeof</span>(ScrollViewerUtilities),</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum10">  10:</span>             <span style="color:#0000ff;">new</span> FrameworkPropertyMetadata((<span style="color:#0000ff;">double</span>)0.0,</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum11">  11:</span>                 <span style="color:#0000ff;">new</span> PropertyChangedCallback(OnHorizontalOffsetChanged)));</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum12">  12:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum13">  13:</span>     <span style="color:#008000;">/// &lt;summary&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum14">  14:</span>     <span style="color:#008000;">/// Gets the HorizontalOffset property.  This dependency property </span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum15">  15:</span>     <span style="color:#008000;">/// indicates ....</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum16">  16:</span>     <span style="color:#008000;">/// &lt;/summary&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum17">  17:</span>     <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">static</span> <span style="color:#0000ff;">double</span> GetHorizontalOffset(DependencyObject d)</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum18">  18:</span>     {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;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;">return</span> (<span style="color:#0000ff;">double</span>)d.GetValue(HorizontalOffsetProperty);</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;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:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum21">  21:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum22">  22:</span>     <span style="color:#008000;">/// &lt;summary&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;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:#008000;">/// Sets the HorizontalOffset property.  This dependency property </span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum24">  24:</span>     <span style="color:#008000;">/// indicates ....</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum25">  25:</span>     <span style="color:#008000;">/// &lt;/summary&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum26">  26:</span>     <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">static</span> <span style="color:#0000ff;">void</span> SetHorizontalOffset(DependencyObject d, <span style="color:#0000ff;">double</span> <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:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum27">  27:</span>     {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum28">  28:</span>         d.SetValue(HorizontalOffsetProperty, <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:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum29">  29:</span>     }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum30">  30:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum31">  31:</span>     <span style="color:#008000;">/// &lt;summary&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum32">  32:</span>     <span style="color:#008000;">/// Handles changes to the HorizontalOffset property.</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;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:#008000;">/// &lt;/summary&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum34">  34:</span>     <span style="color:#0000ff;">private</span> <span style="color:#0000ff;">static</span> <span style="color:#0000ff;">void</span> OnHorizontalOffsetChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum35">  35:</span>     {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum36">  36:</span>         var viewer = (ScrollViewer)d;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum37">  37:</span>         viewer.ScrollToHorizontalOffset((<span style="color:#0000ff;">double</span>)e.NewValue);</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum38">  38:</span>     }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum39">  39:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum40">  40:</span>     <span style="color:#cc6633;">#endregion</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum41">  41:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum42">  42:</span>     <span style="color:#cc6633;">#region</span> VerticalOffset</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum43">  43:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum44">  44:</span>     <span style="color:#008000;">/// &lt;summary&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum45">  45:</span>     <span style="color:#008000;">/// VerticalOffset Attached Dependency Property</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum46">  46:</span>     <span style="color:#008000;">/// &lt;/summary&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum47">  47:</span>     <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">static</span> <span style="color:#0000ff;">readonly</span> DependencyProperty VerticalOffsetProperty =</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum48">  48:</span>         DependencyProperty.RegisterAttached(<span style="color:#006080;">&quot;VerticalOffset&quot;</span>, <span style="color:#0000ff;">typeof</span>(<span style="color:#0000ff;">double</span>), <span style="color:#0000ff;">typeof</span>(ScrollViewerUtilities),</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum49">  49:</span>             <span style="color:#0000ff;">new</span> FrameworkPropertyMetadata((<span style="color:#0000ff;">double</span>)0.0,</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;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;">new</span> PropertyChangedCallback(OnVerticalOffsetChanged)));</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum51">  51:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum52">  52:</span>     <span style="color:#008000;">/// &lt;summary&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum53">  53:</span>     <span style="color:#008000;">/// Gets the VerticalOffset property.  This dependency property </span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum54">  54:</span>     <span style="color:#008000;">/// indicates ....</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum55">  55:</span>     <span style="color:#008000;">/// &lt;/summary&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;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;">static</span> <span style="color:#0000ff;">double</span> GetVerticalOffset(DependencyObject d)</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;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--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum58">  58:</span>         <span style="color:#0000ff;">return</span> (<span style="color:#0000ff;">double</span>)d.GetValue(VerticalOffsetProperty);</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum59">  59:</span>     }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum60">  60:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum61">  61:</span>     <span style="color:#008000;">/// &lt;summary&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum62">  62:</span>     <span style="color:#008000;">/// Sets the VerticalOffset property.  This dependency property </span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum63">  63:</span>     <span style="color:#008000;">/// indicates ....</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum64">  64:</span>     <span style="color:#008000;">/// &lt;/summary&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum65">  65:</span>     <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">static</span> <span style="color:#0000ff;">void</span> SetVerticalOffset(DependencyObject d, <span style="color:#0000ff;">double</span> <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:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum66">  66:</span>     {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum67">  67:</span>         d.SetValue(VerticalOffsetProperty, <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:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum68">  68:</span>     }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum69">  69:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum70">  70:</span>     <span style="color:#008000;">/// &lt;summary&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum71">  71:</span>     <span style="color:#008000;">/// Handles changes to the VerticalOffset property.</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum72">  72:</span>     <span style="color:#008000;">/// &lt;/summary&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum73">  73:</span>     <span style="color:#0000ff;">private</span> <span style="color:#0000ff;">static</span> <span style="color:#0000ff;">void</span> OnVerticalOffsetChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum74">  74:</span>     {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum75">  75:</span>         var viewer = (ScrollViewer)d;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum76">  76:</span>         viewer.ScrollToVerticalOffset((<span style="color:#0000ff;">double</span>)e.NewValue);</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum77">  77:</span>     }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum78">  78:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum79">  79:</span>     <span style="color:#cc6633;">#endregion</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum80">  80:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum81">  81:</span> }</pre>
<p><!--CRLF--></div>
</div>
<p>and here is XAMl of how I use this</p>
<div style="border-bottom:silver 1px solid;text-align:left;border-left:silver 1px solid;line-height:12pt;background-color:#f4f4f4;width:97.5%;font-family:&#39;direction:ltr;max-height:200px;font-size:8pt;overflow:auto;border-top:silver 1px solid;cursor:text;border-right:silver 1px solid;margin:20px 0 10px;padding:4px;" id="codeSnippetWrapper">
<div style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;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:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum1">   1:</span> &lt;Grid&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum2">   2:</span>     &lt;Grid.RowDefinitions&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum3">   3:</span>         &lt;RowDefinition /&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum4">   4:</span>         &lt;RowDefinition Height=<span style="color:#006080;">&quot;100&quot;</span>/&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum5">   5:</span>     &lt;/Grid.RowDefinitions&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum6">   6:</span>     &lt;ScrollViewer x:Name=<span style="color:#006080;">&quot;scrollViewer&quot;</span> HorizontalScrollBarVisibility=<span style="color:#006080;">&quot;Visible&quot;</span> VerticalScrollBarVisibility=<span style="color:#006080;">&quot;Visible&quot;</span>  &gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum7">   7:</span>         &lt;Border Width=<span style="color:#006080;">&quot;9000&quot;</span> Height=<span style="color:#006080;">&quot;9000&quot;</span>/&gt; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum8">   8:</span>     &lt;/ScrollViewer&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum9">   9:</span>     </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum10">  10:</span>     &lt;StackPanel Grid.Row=<span style="color:#006080;">&quot;1&quot;</span>&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum11">  11:</span>         &lt;WrapPanel&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum12">  12:</span>             &lt;TextBlock Text=<span style="color:#006080;">&quot;Slider for horizontal: Value:&quot;</span> Margin=<span style="color:#006080;">&quot;0,0,10,0&quot;</span>/&gt;    </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum13">  13:</span>             &lt;TextBlock Text=<span style="color:#006080;">&quot;{Binding ElementName=scrollViewer, Path=HorizontalOffset}&quot;</span>/&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum14">  14:</span>         &lt;/WrapPanel&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum15">  15:</span>         &lt;Slider Value=<span style="color:#006080;">&quot;{Binding ElementName=scrollViewer, Path=(local:ScrollViewerUtilities.HorizontalOffset)}&quot;</span> </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum16">  16:</span>                 Minimum=<span style="color:#006080;">&quot;0&quot;</span> Maximum=<span style="color:#006080;">&quot;9000&quot;</span>/&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum17">  17:</span>         &lt;WrapPanel&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum18">  18:</span>             &lt;TextBlock Text=<span style="color:#006080;">&quot;Slider for vertical: Value:&quot;</span> Margin=<span style="color:#006080;">&quot;0,0,10,0&quot;</span>/&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum19">  19:</span>             &lt;TextBlock Text=<span style="color:#006080;">&quot;{Binding ElementName=scrollViewer, Path=VerticalOffset}&quot;</span>/&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum20">  20:</span>         &lt;/WrapPanel&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum21">  21:</span>         &lt;Slider Value=<span style="color:#006080;">&quot;{Binding ElementName=scrollViewer, Path=(local:ScrollViewerUtilities.VerticalOffset)}&quot;</span> </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum22">  22:</span>                 Minimum=<span style="color:#006080;">&quot;0&quot;</span> Maximum=<span style="color:#006080;">&quot;9000&quot;</span>/&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum23">  23:</span>         </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum24">  24:</span>         &lt;WrapPanel&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum25">  25:</span>             &lt;TextBlock Text=<span style="color:#006080;">&quot;Animate scroll&quot;</span> Margin=<span style="color:#006080;">&quot;0,0,10,0&quot;</span>/&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum26">  26:</span>             &lt;Button Content=<span style="color:#006080;">&quot;Do it&quot;</span>&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum27">  27:</span>                 &lt;Button.Triggers&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum28">  28:</span>                     &lt;EventTrigger RoutedEvent=<span style="color:#006080;">&quot;Button.Click&quot;</span>&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum29">  29:</span>                         &lt;BeginStoryboard&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum30">  30:</span>                             &lt;Storyboard&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum31">  31:</span>                                 &lt;DoubleAnimation Storyboard.TargetName=<span style="color:#006080;">&quot;scrollViewer&quot;</span> </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum32">  32:</span>                                          Storyboard.TargetProperty=<span style="color:#006080;">&quot;(local:ScrollViewerUtilities.VerticalOffset)&quot;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum33">  33:</span>                                          Duration=<span style="color:#006080;">&quot;0:0:1&quot;</span> DecelerationRatio=<span style="color:#006080;">&quot;1.0&quot;</span> To=<span style="color:#006080;">&quot;8000&quot;</span>/&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum34">  34:</span>                             &lt;/Storyboard&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum35">  35:</span>                         &lt;/BeginStoryboard&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum36">  36:</span>                     &lt;/EventTrigger&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum37">  37:</span>                 &lt;/Button.Triggers&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum38">  38:</span>             &lt;/Button&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum39">  39:</span>         &lt;/WrapPanel&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum40">  40:</span>     &lt;/StackPanel&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum41">  41:</span> &lt;/Grid&gt;</pre>
<p><!--CRLF--></div>
</div>
<p><a href="http://cid-96f8d49aa44c79c1.skydrive.live.com/self.aspx/Public/AnimationScrollViewerOffset.zip" target="_blank">Download the sample app I built for this…</a></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/marlongrech.wordpress.com/361/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/marlongrech.wordpress.com/361/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/marlongrech.wordpress.com/361/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/marlongrech.wordpress.com/361/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/marlongrech.wordpress.com/361/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/marlongrech.wordpress.com/361/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/marlongrech.wordpress.com/361/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/marlongrech.wordpress.com/361/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/marlongrech.wordpress.com/361/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/marlongrech.wordpress.com/361/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=marlongrech.wordpress.com&blog=783168&post=361&subd=marlongrech&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://marlongrech.wordpress.com/2009/09/14/how-to-set-wpf-scrollviewer-verticaloffset-and-horizontal-offset/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4231953dc5a7ec7d7b5acb2444eeeeab?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">C# Disciple</media:title>
		</media:content>
	</item>
		<item>
		<title>Article revisited: MVVM + M (implementing a Fly Weight TreeView)</title>
		<link>http://marlongrech.wordpress.com/2009/09/13/article-revisited-mvvm-m-implementing-a-fly-weight-treeview/</link>
		<comments>http://marlongrech.wordpress.com/2009/09/13/article-revisited-mvvm-m-implementing-a-fly-weight-treeview/#comments</comments>
		<pubDate>Sun, 13 Sep 2009 09:27:24 +0000</pubDate>
		<dc:creator>marlongrech</dc:creator>
				<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://marlongrech.wordpress.com/2009/09/13/article-revisited-mvvm-m-implementing-a-fly-weight-treeview/</guid>
		<description><![CDATA[Ages ago I wrote an article to introduce an idea that I had for the Mediator pattern to work with MVVM (at that time MVVM was still in the being of its age so I didn’t even call it View Model I called it Controller).
Today I was preparing for a Demo that I will be [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=marlongrech.wordpress.com&blog=783168&post=359&subd=marlongrech&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Ages ago I wrote an article to introduce an idea that I had for the Mediator pattern to work with MVVM (at that time MVVM was still in the being of its age so I didn’t even call it View Model I called it Controller).</p>
<p>Today I was preparing for a Demo that <a href="http://www.mts2009.pl/agenda/prelegenci" target="_blank">I will be doing in Poland</a> and I thought to <a href="http://marlongrech.wordpress.com/2008/03/21/creating-a-file-explorer-in-wpf-using-mvcm/" target="_blank">revisit this article</a> and refactor it with the new methods that I discovered over the last year.</p>
<h3>What’s new in the new and exciting in the new version.</h3>
<p>&gt;&gt; Well for starters I am using a new and improved version of the Mediator. The new version of the Mediator API is much more user friendly. It support Generics and it also eliminates the need to have interfaces implemented for you ViewModel. Instead of implementing an interface and have a switch for the message type now you simple register a message to an Action delegate. The Action delegate can be of a generic type so that you don’t even have to cast the argument. <a href="http://marlongrech.wordpress.com/2009/04/16/mediator-v2-for-mvvm-wpf-and-silverlight-applications/" target="_blank">You can read more on this over here</a>.</p>
<p>&gt;&gt; This version also uses Service Locator and the concept of ViewModel Loaders that I <a href="http://marlongrech.wordpress.com/2009/09/02/service-locator-in-mvvm/" target="_blank">introduced in this article</a>.</p>
<p>&gt;&gt; It also uses attached behaviours for the TreeView instead of a ViewModel registering to routed events of the treeview through the EventManager. This is much better! Event Manager registration of event inside a ViewModel can be very dangerous and also makes the ViewModel dirty with references to UI elements. Yet at that time it was an approach that I thought was best, as I said those days were just when View Model concept was emerging…</p>
<p>It’s amazing what I have learnt in the last year and how much MVVM evolved!</p>
<p><a href="http://cid-96f8d49aa44c79c1.skydrive.live.com/self.aspx/Public/MediatorSample.zip" target="_blank">Download the source code and have a look for yourself…. Compare the 2 versions and see how much better we WPF developers can today use MVVM <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </a></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/marlongrech.wordpress.com/359/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/marlongrech.wordpress.com/359/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/marlongrech.wordpress.com/359/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/marlongrech.wordpress.com/359/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/marlongrech.wordpress.com/359/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/marlongrech.wordpress.com/359/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/marlongrech.wordpress.com/359/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/marlongrech.wordpress.com/359/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/marlongrech.wordpress.com/359/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/marlongrech.wordpress.com/359/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=marlongrech.wordpress.com&blog=783168&post=359&subd=marlongrech&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://marlongrech.wordpress.com/2009/09/13/article-revisited-mvvm-m-implementing-a-fly-weight-treeview/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4231953dc5a7ec7d7b5acb2444eeeeab?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">C# Disciple</media:title>
		</media:content>
	</item>
		<item>
		<title>Animating width and height when they are Double.NaN</title>
		<link>http://marlongrech.wordpress.com/2009/09/07/animating-width-and-height-when-they-are-double-nan/</link>
		<comments>http://marlongrech.wordpress.com/2009/09/07/animating-width-and-height-when-they-are-double-nan/#comments</comments>
		<pubDate>Mon, 07 Sep 2009 08:32:19 +0000</pubDate>
		<dc:creator>marlongrech</dc:creator>
				<category><![CDATA[WPF]]></category>
		<category><![CDATA[tips and tricks]]></category>

		<guid isPermaLink="false">http://marlongrech.wordpress.com/2009/09/07/animating-width-and-height-when-they-are-double-nan/</guid>
		<description><![CDATA[A common problem in WPF when doing animation to width and height is that you cannot animate these properties (or any other properties of type double) if they are by default unset. 
Here is a snippet that shows the code that would raise this kind of exception


   1: &#60;Border Background=&#34;Red&#34; HorizontalAlignment=&#34;Center&#34; VerticalAlignment=&#34;Center&#34;&#62;

  [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=marlongrech.wordpress.com&blog=783168&post=357&subd=marlongrech&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>A common problem in WPF when doing animation to width and height is that you cannot animate these properties (or any other properties of type double) if they are by default unset. </p>
<p>Here is a snippet that shows the code that would raise this kind of exception</p>
<div style="border-bottom:silver 1px solid;text-align:left;border-left:silver 1px solid;line-height:12pt;background-color:#f4f4f4;width:97.5%;font-family:&#39;direction:ltr;max-height:200px;font-size:8pt;overflow:auto;border-top:silver 1px solid;cursor:text;border-right:silver 1px solid;margin:20px 0 10px;padding:4px;" id="codeSnippetWrapper">
<div style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;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:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum1">   1:</span> &lt;Border Background=<span style="color:#006080;">&quot;Red&quot;</span> HorizontalAlignment=<span style="color:#006080;">&quot;Center&quot;</span> VerticalAlignment=<span style="color:#006080;">&quot;Center&quot;</span>&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum2">   2:</span>    &lt;TextBlock Text=<span style="color:#006080;">&quot;CLICK ME&quot;</span> VerticalAlignment=<span style="color:#006080;">&quot;Center&quot;</span> HorizontalAlignment=<span style="color:#006080;">&quot;Center&quot;</span>/&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum3">   3:</span>    &lt;Border.Triggers&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum4">   4:</span>        &lt;EventTrigger RoutedEvent=<span style="color:#006080;">&quot;UIElement.MouseDown&quot;</span>&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum5">   5:</span>            &lt;BeginStoryboard&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum6">   6:</span>                &lt;Storyboard&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum7">   7:</span>                    &lt;DoubleAnimation Storyboard.TargetProperty=<span style="color:#006080;">&quot;Height&quot;</span> To=<span style="color:#006080;">&quot;300&quot;</span>/&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum8">   8:</span>                &lt;/Storyboard&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum9">   9:</span>            &lt;/BeginStoryboard&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum10">  10:</span>        &lt;/EventTrigger&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum11">  11:</span>    &lt;/Border.Triggers&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum12">  12:</span> &lt;/Border&gt;</pre>
<p><!--CRLF--></div>
</div>
<p>When you try to do this you get an exception like this one</p>
<p>&gt;&gt; Cannot animate the &#8216;Height&#8217; property on a &#8216;System.Windows.Controls.Border&#8217; using a &#8216;System.Windows.Media.Animation.DoubleAnimation&#8217;. For details see the inner exception.</p>
<p>and same for Width.</p>
<p>What I do in order to achieve the same behaviour without the need of setting a default width and height is to use a Scale Transform instead. Here is a snippet to get the same behaviour as the XAML above to animate the height</p>
<div style="border-bottom:silver 1px solid;text-align:left;border-left:silver 1px solid;line-height:12pt;background-color:#f4f4f4;width:97.5%;font-family:&#39;direction:ltr;max-height:200px;font-size:8pt;overflow:auto;border-top:silver 1px solid;cursor:text;border-right:silver 1px solid;margin:20px 0 10px;padding:4px;" id="codeSnippetWrapper">
<div style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;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:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum1">   1:</span> &lt;Border Background=<span style="color:#006080;">&quot;Red&quot;</span> HorizontalAlignment=<span style="color:#006080;">&quot;Center&quot;</span> VerticalAlignment=<span style="color:#006080;">&quot;Center&quot;</span>&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum2">   2:</span>    &lt;TextBlock Text=<span style="color:#006080;">&quot;CLICK ME&quot;</span> VerticalAlignment=<span style="color:#006080;">&quot;Center&quot;</span> HorizontalAlignment=<span style="color:#006080;">&quot;Center&quot;</span>/&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum3">   3:</span>    &lt;Border.RenderTransform&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum4">   4:</span>        &lt;ScaleTransform ScaleX=<span style="color:#006080;">&quot;1&quot;</span> ScaleY=<span style="color:#006080;">&quot;1&quot;</span> /&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum5">   5:</span>    &lt;/Border.RenderTransform&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum6">   6:</span>    &lt;Border.Triggers&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum7">   7:</span>        &lt;EventTrigger RoutedEvent=<span style="color:#006080;">&quot;UIElement.MouseDown&quot;</span>&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum8">   8:</span>            &lt;BeginStoryboard&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum9">   9:</span>                &lt;Storyboard&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum10">  10:</span>                    &lt;DoubleAnimation Storyboard.TargetProperty=<span style="color:#006080;">&quot;(UIElement.RenderTransform).(ScaleTransform.ScaleY)&quot;</span> To=<span style="color:#006080;">&quot;2&quot;</span>/&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum11">  11:</span>                &lt;/Storyboard&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum12">  12:</span>            &lt;/BeginStoryboard&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum13">  13:</span>        &lt;/EventTrigger&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum14">  14:</span>    &lt;/Border.Triggers&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum15">  15:</span> &lt;/Border&gt;</pre>
<p><!--CRLF--></div>
</div>
<p>Please note that there is a catch here. By using scale transform everything inside the actual control will be scaled. So if that is not what you want then you have a problem. </p>
<p>Yet of course there are solutions…. One of the solutions is to have an attached property to set the Height for you when the control is loaded. This can be achieved by setting the Height/Width to the ActualHeight/ActualWidth. Here is an attached property that I use in such cases.</p>
<div style="border-bottom:silver 1px solid;text-align:left;border-left:silver 1px solid;line-height:12pt;background-color:#f4f4f4;width:97.5%;font-family:&#39;direction:ltr;max-height:200px;font-size:8pt;overflow:auto;border-top:silver 1px solid;cursor:text;border-right:silver 1px solid;margin:20px 0 10px;padding:4px;" id="codeSnippetWrapper">
<div style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;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:&#39;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:#cc6633;">#region</span> SetHeightToActual</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum2">   2:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum3">   3:</span> <span style="color:#008000;">/// &lt;summary&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;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:#008000;">/// SetHeightToActual Attached Dependency Property</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;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:#008000;">/// &lt;/summary&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum6">   6:</span> <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">static</span> <span style="color:#0000ff;">readonly</span> DependencyProperty SetHeightToActualProperty =</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum7">   7:</span>     DependencyProperty.RegisterAttached(<span style="color:#006080;">&quot;SetHeightToActual&quot;</span>, <span style="color:#0000ff;">typeof</span>(<span style="color:#0000ff;">bool</span>), <span style="color:#0000ff;">typeof</span>(WidthHeightBehaviour),</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum8">   8:</span>         <span style="color:#0000ff;">new</span> FrameworkPropertyMetadata((<span style="color:#0000ff;">bool</span>)<span style="color:#0000ff;">false</span>,</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;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;">new</span> PropertyChangedCallback(OnSetHeightToActualChanged)));</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum10">  10:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum11">  11:</span> <span style="color:#008000;">/// &lt;summary&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum12">  12:</span> <span style="color:#008000;">/// Gets the SetHeightToActual property.  This dependency property </span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum13">  13:</span> <span style="color:#008000;">/// indicates ....</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum14">  14:</span> <span style="color:#008000;">/// &lt;/summary&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum15">  15:</span> <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">static</span> <span style="color:#0000ff;">bool</span> GetSetHeightToActual(DependencyObject d)</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;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:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum17">  17:</span>     <span style="color:#0000ff;">return</span> (<span style="color:#0000ff;">bool</span>)d.GetValue(SetHeightToActualProperty);</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum18">  18:</span> }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum19">  19:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum20">  20:</span> <span style="color:#008000;">/// &lt;summary&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum21">  21:</span> <span style="color:#008000;">/// Sets the SetHeightToActual property.  This dependency property </span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum22">  22:</span> <span style="color:#008000;">/// indicates ....</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;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:#008000;">/// &lt;/summary&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum24">  24:</span> <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">static</span> <span style="color:#0000ff;">void</span> SetSetHeightToActual(DependencyObject d, <span style="color:#0000ff;">bool</span> <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:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum25">  25:</span> {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum26">  26:</span>     d.SetValue(SetHeightToActualProperty, <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:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum27">  27:</span> }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum28">  28:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum29">  29:</span> <span style="color:#008000;">/// &lt;summary&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum30">  30:</span> <span style="color:#008000;">/// Handles changes to the SetHeightToActual property.</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum31">  31:</span> <span style="color:#008000;">/// &lt;/summary&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum32">  32:</span> <span style="color:#0000ff;">private</span> <span style="color:#0000ff;">static</span> <span style="color:#0000ff;">void</span> OnSetHeightToActualChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum33">  33:</span> {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum34">  34:</span>     <span style="color:#0000ff;">if</span> ((<span style="color:#0000ff;">bool</span>)e.NewValue)</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum35">  35:</span>     {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum36">  36:</span>         var element = (FrameworkElement)d;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum37">  37:</span>         RoutedEventHandler handler = <span style="color:#0000ff;">null</span>;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum38">  38:</span>         handler = <span style="color:#0000ff;">delegate</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum39">  39:</span>         {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum40">  40:</span>             element.Height = element.ActualHeight;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum41">  41:</span>             element.Loaded -= handler;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum42">  42:</span>         };</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum43">  43:</span>         element.Loaded += handler;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;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:&#39;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:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum46">  46:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum47">  47:</span> <span style="color:#cc6633;">#endregion</span></pre>
<p><!--CRLF--></div>
</div>
<p>And here is the XAML where I am using the attached behaviour. It is nearly seamless</p>
<div style="border-bottom:silver 1px solid;text-align:left;border-left:silver 1px solid;line-height:12pt;background-color:#f4f4f4;width:97.5%;font-family:&#39;direction:ltr;max-height:200px;font-size:8pt;overflow:auto;border-top:silver 1px solid;cursor:text;border-right:silver 1px solid;margin:20px 0 10px;padding:4px;" id="codeSnippetWrapper">
<div style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;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:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum1">   1:</span> &lt;Border Background=<span style="color:#006080;">&quot;Red&quot;</span> HorizontalAlignment=<span style="color:#006080;">&quot;Center&quot;</span> VerticalAlignment=<span style="color:#006080;">&quot;Center&quot;</span> local:WidthHeightBehaviour.SetHeightToActual=<span style="color:#006080;">&quot;True&quot;</span>&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum2">   2:</span>    &lt;TextBlock Text=<span style="color:#006080;">&quot;CLICK ME&quot;</span> VerticalAlignment=<span style="color:#006080;">&quot;Center&quot;</span> HorizontalAlignment=<span style="color:#006080;">&quot;Center&quot;</span>/&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum3">   3:</span>    &lt;Border.Triggers&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum4">   4:</span>        &lt;EventTrigger RoutedEvent=<span style="color:#006080;">&quot;UIElement.MouseDown&quot;</span>&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum5">   5:</span>            &lt;BeginStoryboard&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum6">   6:</span>                &lt;Storyboard&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum7">   7:</span>                    &lt;DoubleAnimation Storyboard.TargetProperty=<span style="color:#006080;">&quot;Height&quot;</span> To=<span style="color:#006080;">&quot;300&quot;</span>/&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum8">   8:</span>                &lt;/Storyboard&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum9">   9:</span>            &lt;/BeginStoryboard&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum10">  10:</span>        &lt;/EventTrigger&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum11">  11:</span>    &lt;/Border.Triggers&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum12">  12:</span> &lt;/Border&gt;</pre>
<p><!--CRLF--></div>
</div>
<p>You can do the same thing for the Width or any other property of this kind (for example I use this technique also for Center property of ScatterViewItems in Surface development).</p>
<p>Hope this tip/trick helps <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Happy coding</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/marlongrech.wordpress.com/357/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/marlongrech.wordpress.com/357/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/marlongrech.wordpress.com/357/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/marlongrech.wordpress.com/357/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/marlongrech.wordpress.com/357/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/marlongrech.wordpress.com/357/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/marlongrech.wordpress.com/357/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/marlongrech.wordpress.com/357/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/marlongrech.wordpress.com/357/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/marlongrech.wordpress.com/357/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=marlongrech.wordpress.com&blog=783168&post=357&subd=marlongrech&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://marlongrech.wordpress.com/2009/09/07/animating-width-and-height-when-they-are-double-nan/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4231953dc5a7ec7d7b5acb2444eeeeab?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">C# Disciple</media:title>
		</media:content>
	</item>
		<item>
		<title>Service Locator in MVVM</title>
		<link>http://marlongrech.wordpress.com/2009/09/02/service-locator-in-mvvm/</link>
		<comments>http://marlongrech.wordpress.com/2009/09/02/service-locator-in-mvvm/#comments</comments>
		<pubDate>Wed, 02 Sep 2009 21:50:27 +0000</pubDate>
		<dc:creator>marlongrech</dc:creator>
				<category><![CDATA[WPF]]></category>
		<category><![CDATA[mvvm]]></category>
		<category><![CDATA[tips and tricks]]></category>

		<guid isPermaLink="false">http://marlongrech.wordpress.com/2009/09/02/service-locator-in-mvvm/</guid>
		<description><![CDATA[While doing MVVM one of the common problems to solve is to have the ViewModel consume entities that are “replaceable”. Let me give you an example so that you can better understand what I mean by “replaceable“. Let’s say you have a ViewModel that is using a DataAccess entity to get some data from a [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=marlongrech.wordpress.com&blog=783168&post=356&subd=marlongrech&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>While doing MVVM one of the common problems to solve is to have the ViewModel consume entities that are “replaceable”. Let me give you an example so that you can better understand what I mean by “replaceable“. Let’s say you have a ViewModel that is using a DataAccess entity to get some data from a data store. You want to be able replace the DataAccess entity so that you can mock this entity for unit testing. Besides this you want to also be able to have some sample data while at design time. And not to forget, when at runtime you want the data access to connects to the database or whatever data store you are using.</p>
<p>In order to do solve this problem I use the ServiceLocator pattern. The Service Locator pattern is very simple. You have a RegisterService method where you register the instance of the service you want to provide and a GetService method which you would use to get the service you want.</p>
<p>Here is the signature of both methods</p>
<div style="border-bottom:silver 1px solid;text-align:left;border-left:silver 1px solid;line-height:12pt;background-color:#f4f4f4;width:97.5%;font-family:&#39;direction:ltr;max-height:200px;font-size:8pt;overflow:auto;border-top:silver 1px solid;cursor:text;border-right:silver 1px solid;margin:20px 0 10px;padding:4px;" id="codeSnippetWrapper">
<div style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;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:&#39;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> T GetService&lt;T&gt;()</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum2">   2:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum3">   3:</span> <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">bool</span> RegisterService&lt;T&gt;(T service)</pre>
<p><!--CRLF--></div>
</div>
<p>And here is how to use them in code</p>
<div style="border-bottom:silver 1px solid;text-align:left;border-left:silver 1px solid;line-height:12pt;background-color:#f4f4f4;width:97.5%;font-family:&#39;direction:ltr;max-height:200px;font-size:8pt;overflow:auto;border-top:silver 1px solid;cursor:text;border-right:silver 1px solid;margin:20px 0 10px;padding:4px;" id="codeSnippetWrapper">
<div style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;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:&#39;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:#008000;">//get the data access service</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum2">   2:</span> var dataAccess = GetService&lt;IPeopleDataAccess&gt;();</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;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:&#39;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:#008000;">//Register the data access service</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum5">   5:</span> vm.ServiceLocator.RegisterService&lt;IPeopleDataAccess&gt;(<span style="color:#0000ff;">new</span> PeopleDataAccess());</pre>
<p><!--CRLF--></div>
</div>
<p>So for example to test the the ViewModel I can write a unit test like this</p>
<div style="border-bottom:silver 1px solid;text-align:left;border-left:silver 1px solid;line-height:12pt;background-color:#f4f4f4;width:97.5%;font-family:&#39;direction:ltr;max-height:200px;font-size:8pt;overflow:auto;border-top:silver 1px solid;cursor:text;border-right:silver 1px solid;margin:20px 0 10px;padding:4px;" id="codeSnippetWrapper">
<div style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;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:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum1">   1:</span> MainViewModel viewModel = <span style="color:#0000ff;">new</span> MainViewModel();</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum2">   2:</span> viewModel.ServiceLocator.RegisterService&lt;IPeopleDataAccess&gt;(<span style="color:#0000ff;">new</span> PeopleDataAccessMock());</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;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:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum4">   4:</span> Assert.AreEqual(viewModel.People.Count, PeopleDataAccessMock.PeopleCount,</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;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:#006080;">&quot;Invalid number of People returned&quot;</span>);</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum6">   6:</span> Assert.AreEqual(viewModel.People[0].Name, PeopleDataAccessMock.FirstPersonName,</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum7">   7:</span>    <span style="color:#006080;">&quot;Invalid item in people list&quot;</span>);</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum8">   8:</span> Assert.AreEqual(viewModel.People[0].Surname, PeopleDataAccessMock.FirstPersonSurname,</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;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:#006080;">&quot;Invalid item in people list&quot;</span>);</pre>
<p><!--CRLF--></div>
</div>
<p>So basically in this unit test I am just creating a mock object and testing that my ViewModel is exposing the data from the data access (which is mocked so the data returned by this data access is known in the test context)</p>
<p>This is all cool but now how can I use this in WPF and MVVM. So the first question that people ask is how do I create the ViewModel and set it as the DataContext. And also who is responsible of assigning the services that the ViewModel will consume. In order to do this I use AttachedBehaviour and the Factory design pattern.</p>
<p>I created a simple attached property that accepts a type of a Factory that is responsible for creating the ViewModel and register whatever services it needs. The attached property is very simple, here is the code for it</p>
<div style="border-bottom:silver 1px solid;text-align:left;border-left:silver 1px solid;line-height:12pt;background-color:#f4f4f4;width:97.5%;font-family:&#39;direction:ltr;max-height:200px;font-size:8pt;overflow:auto;border-top:silver 1px solid;cursor:text;border-right:silver 1px solid;margin:20px 0 10px;padding:4px;" id="codeSnippetWrapper">
<div style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;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:&#39;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> ViewModelLoader</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;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:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum3">   3:</span>     <span style="color:#cc6633;">#region</span> FactoryType</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum4">   4:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;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:#008000;">/// &lt;summary&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum6">   6:</span>     <span style="color:#008000;">/// FactoryType Attached Dependency Property</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum7">   7:</span>     <span style="color:#008000;">/// &lt;/summary&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum8">   8:</span>     <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">static</span> <span style="color:#0000ff;">readonly</span> DependencyProperty FactoryTypeProperty =</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum9">   9:</span>         DependencyProperty.RegisterAttached(<span style="color:#006080;">&quot;FactoryType&quot;</span>, <span style="color:#0000ff;">typeof</span>(Type), <span style="color:#0000ff;">typeof</span>(ViewModelLoader),</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum10">  10:</span>             <span style="color:#0000ff;">new</span> FrameworkPropertyMetadata((Type)<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:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum11">  11:</span>                 <span style="color:#0000ff;">new</span> PropertyChangedCallback(OnFactoryTypeChanged)));</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum12">  12:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum13">  13:</span>     <span style="color:#008000;">/// &lt;summary&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum14">  14:</span>     <span style="color:#008000;">/// Gets the FactoryType property.  This dependency property </span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum15">  15:</span>     <span style="color:#008000;">/// indicates ....</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum16">  16:</span>     <span style="color:#008000;">/// &lt;/summary&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum17">  17:</span>     <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">static</span> Type GetFactoryType(DependencyObject d)</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum18">  18:</span>     {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;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;">return</span> (Type)d.GetValue(FactoryTypeProperty);</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;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:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum21">  21:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum22">  22:</span>     <span style="color:#008000;">/// &lt;summary&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;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:#008000;">/// Sets the FactoryType property.  This dependency property </span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum24">  24:</span>     <span style="color:#008000;">/// indicates ....</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum25">  25:</span>     <span style="color:#008000;">/// &lt;/summary&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum26">  26:</span>     <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">static</span> <span style="color:#0000ff;">void</span> SetFactoryType(DependencyObject d, Type <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:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum27">  27:</span>     {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum28">  28:</span>         d.SetValue(FactoryTypeProperty, <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:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum29">  29:</span>     }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum30">  30:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum31">  31:</span>     <span style="color:#008000;">/// &lt;summary&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum32">  32:</span>     <span style="color:#008000;">/// Handles changes to the FactoryType property.</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;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:#008000;">/// &lt;/summary&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum34">  34:</span>     <span style="color:#0000ff;">private</span> <span style="color:#0000ff;">static</span> <span style="color:#0000ff;">void</span> OnFactoryTypeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum35">  35:</span>     {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum36">  36:</span>         FrameworkElement element = (FrameworkElement)d;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum37">  37:</span>         IFactory factory = Activator.CreateInstance( GetFactoryType(d) ) <span style="color:#0000ff;">as</span> IFactory;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum38">  38:</span>         <span style="color:#0000ff;">if</span> (factory == <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:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum39">  39:</span>             <span style="color:#0000ff;">throw</span> <span style="color:#0000ff;">new</span> InvalidOperationException(<span style="color:#006080;">&quot;You have to specify a type that inherits from IFactory&quot;</span>);</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum40">  40:</span>         element.DataContext = factory.CreateViewModel(d);</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;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:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum42">  42:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum43">  43:</span>     <span style="color:#cc6633;">#endregion</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum44">  44:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;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--></div>
</div>
<p>and you can use this in XAML like so</p>
<div style="border-bottom:silver 1px solid;text-align:left;border-left:silver 1px solid;line-height:12pt;background-color:#f4f4f4;width:97.5%;font-family:&#39;direction:ltr;max-height:200px;font-size:8pt;overflow:auto;border-top:silver 1px solid;cursor:text;border-right:silver 1px solid;margin:20px 0 10px;padding:4px;" id="codeSnippetWrapper">
<div style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;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:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum1">   1:</span> &lt;Window x:Class=<span style="color:#006080;">&quot;ServiceLocatorSample.Main&quot;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum2">   2:</span>     xmlns=<span style="color:#006080;">&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum3">   3:</span>     xmlns:x=<span style="color:#006080;">&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum4">   4:</span>     xmlns:vm=<span style="color:#006080;">&quot;clr-namespace:MVVMHelper.Factory;assembly=MVVMHelper&quot;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum5">   5:</span>     xmlns:fac=<span style="color:#006080;">&quot;clr-namespace:ServiceLocatorSample.ViewModels.Factories&quot;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum6">   6:</span>     Title=<span style="color:#006080;">&quot;Main&quot;</span> Height=<span style="color:#006080;">&quot;300&quot;</span> Width=<span style="color:#006080;">&quot;300&quot;</span> vm:ViewModelLoader.FactoryType=<span style="color:#006080;">&quot;{x:Type fac:MainViewModelFactory}&quot;</span>&gt;</pre>
<p><!--CRLF--></div>
</div>
<p>Usually in the implementation of the factory I would check if the current state is at design time or runtime and accordingly register different services. Something like this</p>
<div style="border-bottom:silver 1px solid;text-align:left;border-left:silver 1px solid;line-height:12pt;background-color:#f4f4f4;width:97.5%;font-family:&#39;direction:ltr;max-height:200px;font-size:8pt;overflow:auto;border-top:silver 1px solid;cursor:text;border-right:silver 1px solid;margin:20px 0 10px;padding:4px;" id="codeSnippetWrapper">
<div style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;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:&#39;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> MainViewModelFactory : IFactory</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;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:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum3">   3:</span>    <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">object</span> CreateViewModel(DependencyObject sender)</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum4">   4:</span>    {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum5">   5:</span>        var vm = <span style="color:#0000ff;">new</span> MainViewModel();</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum6">   6:</span>        <span style="color:#0000ff;">if</span> (Designer.IsDesignMode)</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum7">   7:</span>            vm.ServiceLocator.RegisterService&lt;IPeopleDataAccess&gt;(<span style="color:#0000ff;">new</span> DesignTimeData.DesignTimePeopleDataAccess());</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum8">   8:</span>        <span style="color:#0000ff;">else</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum9">   9:</span>            vm.ServiceLocator.RegisterService&lt;IPeopleDataAccess&gt;(<span style="color:#0000ff;">new</span> PeopleDataAccess());</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum10">  10:</span>        <span style="color:#0000ff;">return</span> vm;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum11">  11:</span>    }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;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--></div>
</div>
<p>So with this factory at design time I would get Design time data showing in my designer but as soon as I run the app the actual data access (the real one that connects to the database) gets injected.</p>
<p>That’s it for today. Download the sample project and you will have a better idea of how all this works. Any questions or comments please let me know, I will be more than happy to answer <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  </p>
<p>P.S In the sample I have the full MVVMHelper assembly that I use in my everyday work with MVVM so you will also have stuff like Mediator and other things that I will be blogging about very soon <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><a href="http://cid-96f8d49aa44c79c1.skydrive.live.com/self.aspx/Public/ServiceLocator.zip" target="_blank">Download the sample project</a></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/marlongrech.wordpress.com/356/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/marlongrech.wordpress.com/356/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/marlongrech.wordpress.com/356/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/marlongrech.wordpress.com/356/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/marlongrech.wordpress.com/356/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/marlongrech.wordpress.com/356/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/marlongrech.wordpress.com/356/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/marlongrech.wordpress.com/356/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/marlongrech.wordpress.com/356/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/marlongrech.wordpress.com/356/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=marlongrech.wordpress.com&blog=783168&post=356&subd=marlongrech&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://marlongrech.wordpress.com/2009/09/02/service-locator-in-mvvm/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4231953dc5a7ec7d7b5acb2444eeeeab?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">C# Disciple</media:title>
		</media:content>
	</item>
		<item>
		<title>Playing with Shaders: Creating a water effect</title>
		<link>http://marlongrech.wordpress.com/2009/08/27/playing-with-shaders-creating-a-water-effect/</link>
		<comments>http://marlongrech.wordpress.com/2009/08/27/playing-with-shaders-creating-a-water-effect/#comments</comments>
		<pubDate>Thu, 27 Aug 2009 15:06:03 +0000</pubDate>
		<dc:creator>marlongrech</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[pixel shaders]]></category>
		<category><![CDATA[tips and tricks]]></category>

		<guid isPermaLink="false">http://marlongrech.wordpress.com/2009/08/27/playing-with-shaders-creating-a-water-effect/</guid>
		<description><![CDATA[Lately I’ve been looking at a really cool project on Codeplex for Pixel Shaders. The set of shaders in this library is awsome and really easy to use in you application….
All you need to do to consume any Shader is add a reference to the WPFShaderEffectLibrary class library and you can start using the shaders [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=marlongrech.wordpress.com&blog=783168&post=355&subd=marlongrech&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Lately I’ve been looking at a really cool project on <a href="http://www.codeplex.com/wpffx" target="_blank">Codeplex for Pixel Shaders</a>. The set of shaders in this library is awsome and really easy to use in you application….</p>
<p>All you need to do to consume any Shader is add a reference to the WPFShaderEffectLibrary class library and you can start using the shaders in XAML.What is really important is that you install the <a href="http://wpf.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=14962#DownloadId=40167" target="_blank">Shaders Build Task</a> before trying to build the shader library (if you just add a reference to the ready build dlls you don’t even need to do this).</p>
<p>&#160;</p>
<p><a href="http://marlongrech.files.wordpress.com/2009/08/water.png"><img style="display:inline;border-width:0;" title="Water" border="0" alt="Water" src="http://marlongrech.files.wordpress.com/2009/08/water_thumb.png?w=644&#038;h=389" width="644" height="389" /></a> </p>
<p>So let’s have a look at how we can use shaders to simulate water on screen.</p>
<p>This is very easy all we need is a ripple shader effect. so something like this </p>
<div style="border-bottom:silver 1px solid;text-align:left;border-left:silver 1px solid;line-height:12pt;background-color:#f4f4f4;width:97.5%;font-family:&#39;direction:ltr;max-height:200px;font-size:8pt;overflow:auto;border-top:silver 1px solid;cursor:text;border-right:silver 1px solid;margin:20px 0 10px;padding:4px;" id="codeSnippetWrapper">
<div style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;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:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum1">   1:</span> &lt;Window.Resources&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum2">   2:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum3">   3:</span>    &lt;Storyboard x:Key=<span style="color:#006080;">&quot;waterAnimMain&quot;</span>&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum4">   4:</span>        &lt;DoubleAnimation Storyboard.TargetName=<span style="color:#006080;">&quot;rippleMain&quot;</span> Storyboard.TargetProperty=<span style="color:#006080;">&quot;Phase&quot;</span> To=<span style="color:#006080;">&quot;0&quot;</span> From=<span style="color:#006080;">&quot;10&quot;</span> Duration=<span style="color:#006080;">&quot;0:0:2.0&quot;</span>  FillBehavior=<span style="color:#006080;">&quot;Stop&quot;</span> /&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum5">   5:</span>        &lt;DoubleAnimation Storyboard.TargetName=<span style="color:#006080;">&quot;rippleMain&quot;</span> Storyboard.TargetProperty=<span style="color:#006080;">&quot;Amplitude&quot;</span> To=<span style="color:#006080;">&quot;0&quot;</span> From=<span style="color:#006080;">&quot;0.6&quot;</span> Duration=<span style="color:#006080;">&quot;0:0:2.0&quot;</span>  FillBehavior=<span style="color:#006080;">&quot;HoldEnd&quot;</span> /&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum6">   6:</span>        &lt;DoubleAnimation Storyboard.TargetName=<span style="color:#006080;">&quot;rippleMain&quot;</span> Storyboard.TargetProperty=<span style="color:#006080;">&quot;Frequency&quot;</span> To=<span style="color:#006080;">&quot;0&quot;</span> From=<span style="color:#006080;">&quot;30&quot;</span> Duration=<span style="color:#006080;">&quot;0:0:2.5&quot;</span> FillBehavior=<span style="color:#006080;">&quot;HoldEnd&quot;</span> /&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum7">   7:</span>    &lt;/Storyboard&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum8">   8:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum9">   9:</span> &lt;/Window.Resources&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum10">  10:</span> &lt;Grid Background=<span style="color:#006080;">&quot;Transparent&quot;</span> &gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum11">  11:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum12">  12:</span>    &lt;Border&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum13">  13:</span>        &lt;Border.Background&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum14">  14:</span>            &lt;LinearGradientBrush EndPoint=<span style="color:#006080;">&quot;0.93,0.925&quot;</span> StartPoint=<span style="color:#006080;">&quot;0.094,0.125&quot;</span>&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum15">  15:</span>                &lt;GradientStop Color=<span style="color:#006080;">&quot;#FF272788&quot;</span> Offset=<span style="color:#006080;">&quot;0.112&quot;</span>/&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum16">  16:</span>                &lt;GradientStop Color=<span style="color:#006080;">&quot;#FF090916&quot;</span> Offset=<span style="color:#006080;">&quot;0.721&quot;</span>/&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum17">  17:</span>                &lt;GradientStop Color=<span style="color:#006080;">&quot;#FE222267&quot;</span> Offset=<span style="color:#006080;">&quot;0.28&quot;</span>/&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum18">  18:</span>                &lt;GradientStop Color=<span style="color:#006080;">&quot;#FE131339&quot;</span> Offset=<span style="color:#006080;">&quot;0.453&quot;</span>/&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum19">  19:</span>                &lt;GradientStop Color=<span style="color:#006080;">&quot;#FF04040A&quot;</span> Offset=<span style="color:#006080;">&quot;0.974&quot;</span>/&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum20">  20:</span>            &lt;/LinearGradientBrush&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum21">  21:</span>        &lt;/Border.Background&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;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:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum23">  23:</span>    &lt;/Border&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum24">  24:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum25">  25:</span> &lt;/Grid&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum26">  26:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum27">  27:</span> &lt;Window.Effect&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum28">  28:</span>    &lt;shader:RippleEffect Amplitude=<span style="color:#006080;">&quot;0&quot;</span> Frequency=<span style="color:#006080;">&quot;0&quot;</span> Phase=<span style="color:#006080;">&quot;0&quot;</span> x:Name=<span style="color:#006080;">&quot;rippleMain&quot;</span>  /&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum29">  29:</span> &lt;/Window.Effect&gt;</pre>
<p><!--CRLF--></div>
</div>
<p>This is our Shader</p>
<div style="border-bottom:silver 1px solid;text-align:left;border-left:silver 1px solid;line-height:12pt;background-color:#f4f4f4;width:97.5%;font-family:&#39;direction:ltr;max-height:200px;font-size:8pt;overflow:auto;border-top:silver 1px solid;cursor:text;border-right:silver 1px solid;margin:20px 0 10px;padding:4px;" id="codeSnippetWrapper">
<div style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;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:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum1">   1:</span> &lt;shader:RippleEffect Amplitude=<span style="color:#006080;">&quot;0&quot;</span> Frequency=<span style="color:#006080;">&quot;0&quot;</span> Phase=<span style="color:#006080;">&quot;0&quot;</span> x:Name=<span style="color:#006080;">&quot;rippleMain&quot;</span>  /&gt;</pre>
<p><!--CRLF--></div>
</div>
<p>And we animate this shader like so to make the effect of water</p>
<div style="border-bottom:silver 1px solid;text-align:left;border-left:silver 1px solid;line-height:12pt;background-color:#f4f4f4;width:97.5%;font-family:&#39;direction:ltr;max-height:200px;font-size:8pt;overflow:auto;border-top:silver 1px solid;cursor:text;border-right:silver 1px solid;margin:20px 0 10px;padding:4px;" id="codeSnippetWrapper">
<div style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;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:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum1">   1:</span> &lt;Storyboard x:Key=<span style="color:#006080;">&quot;waterAnimMain&quot;</span>&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum2">   2:</span>      &lt;DoubleAnimation Storyboard.TargetName=<span style="color:#006080;">&quot;rippleMain&quot;</span> Storyboard.TargetProperty=<span style="color:#006080;">&quot;Phase&quot;</span> To=<span style="color:#006080;">&quot;0&quot;</span> From=<span style="color:#006080;">&quot;10&quot;</span> Duration=<span style="color:#006080;">&quot;0:0:2.0&quot;</span>  FillBehavior=<span style="color:#006080;">&quot;Stop&quot;</span> /&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum3">   3:</span>      &lt;DoubleAnimation Storyboard.TargetName=<span style="color:#006080;">&quot;rippleMain&quot;</span> Storyboard.TargetProperty=<span style="color:#006080;">&quot;Amplitude&quot;</span> To=<span style="color:#006080;">&quot;0&quot;</span> From=<span style="color:#006080;">&quot;0.6&quot;</span> Duration=<span style="color:#006080;">&quot;0:0:2.0&quot;</span>  FillBehavior=<span style="color:#006080;">&quot;HoldEnd&quot;</span> /&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum4">   4:</span>      &lt;DoubleAnimation Storyboard.TargetName=<span style="color:#006080;">&quot;rippleMain&quot;</span> Storyboard.TargetProperty=<span style="color:#006080;">&quot;Frequency&quot;</span> To=<span style="color:#006080;">&quot;0&quot;</span> From=<span style="color:#006080;">&quot;30&quot;</span> Duration=<span style="color:#006080;">&quot;0:0:2.5&quot;</span> FillBehavior=<span style="color:#006080;">&quot;HoldEnd&quot;</span> /&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum5">   5:</span>  &lt;/Storyboard&gt;</pre>
<p><!--CRLF--></div>
</div>
<p>We invoke this animation by having a DispatcherTimer trigger the animation every now and then and changing the Center property of the Shader to a random point from 0 to 1.</p>
<p>This already gets us very close but it still does not feel like real water. The trick is to animate to ripple effects at the same time. This will make the ripple effects expand together and thus making the control which has the shader applied look like water. Yet the problem is that you can only apply ONE shader per control. BUT you can have another shader on the parent control and that would still apply the shader on all children (<a href="http://marlongrech.wordpress.com/2008/05/15/effects-in-net-sp1-for-wpf/" target="_blank">I explain this in this article</a>).</p>
<div style="border-bottom:silver 1px solid;text-align:left;border-left:silver 1px solid;line-height:12pt;background-color:#f4f4f4;width:97.5%;font-family:&#39;direction:ltr;max-height:200px;font-size:8pt;overflow:auto;border-top:silver 1px solid;cursor:text;border-right:silver 1px solid;margin:20px 0 10px;padding:4px;" id="codeSnippetWrapper">
<div style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;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:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum1">   1:</span> &lt;Window.Resources&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum2">   2:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum3">   3:</span>     &lt;Storyboard x:Key=<span style="color:#006080;">&quot;waterAnimMain&quot;</span>&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum4">   4:</span>         &lt;DoubleAnimation Storyboard.TargetName=<span style="color:#006080;">&quot;rippleMain&quot;</span> Storyboard.TargetProperty=<span style="color:#006080;">&quot;Phase&quot;</span> To=<span style="color:#006080;">&quot;0&quot;</span> From=<span style="color:#006080;">&quot;10&quot;</span> Duration=<span style="color:#006080;">&quot;0:0:2.0&quot;</span>  FillBehavior=<span style="color:#006080;">&quot;Stop&quot;</span> /&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum5">   5:</span>         &lt;DoubleAnimation Storyboard.TargetName=<span style="color:#006080;">&quot;rippleMain&quot;</span> Storyboard.TargetProperty=<span style="color:#006080;">&quot;Amplitude&quot;</span> To=<span style="color:#006080;">&quot;0&quot;</span> From=<span style="color:#006080;">&quot;0.6&quot;</span> Duration=<span style="color:#006080;">&quot;0:0:2.0&quot;</span>  FillBehavior=<span style="color:#006080;">&quot;HoldEnd&quot;</span> /&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum6">   6:</span>         &lt;DoubleAnimation Storyboard.TargetName=<span style="color:#006080;">&quot;rippleMain&quot;</span> Storyboard.TargetProperty=<span style="color:#006080;">&quot;Frequency&quot;</span> To=<span style="color:#006080;">&quot;0&quot;</span> From=<span style="color:#006080;">&quot;30&quot;</span> Duration=<span style="color:#006080;">&quot;0:0:2.5&quot;</span> FillBehavior=<span style="color:#006080;">&quot;HoldEnd&quot;</span> /&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum7">   7:</span>     &lt;/Storyboard&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum8">   8:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum9">   9:</span>     &lt;Storyboard x:Key=<span style="color:#006080;">&quot;waterAnimSub&quot;</span>&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum10">  10:</span>         &lt;DoubleAnimation Storyboard.TargetName=<span style="color:#006080;">&quot;rippleSub&quot;</span> Storyboard.TargetProperty=<span style="color:#006080;">&quot;Phase&quot;</span> To=<span style="color:#006080;">&quot;0&quot;</span> From=<span style="color:#006080;">&quot;10&quot;</span> Duration=<span style="color:#006080;">&quot;0:0:2.0&quot;</span>  FillBehavior=<span style="color:#006080;">&quot;Stop&quot;</span> /&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum11">  11:</span>         &lt;DoubleAnimation Storyboard.TargetName=<span style="color:#006080;">&quot;rippleSub&quot;</span> Storyboard.TargetProperty=<span style="color:#006080;">&quot;Amplitude&quot;</span> To=<span style="color:#006080;">&quot;0&quot;</span> From=<span style="color:#006080;">&quot;0.6&quot;</span> Duration=<span style="color:#006080;">&quot;0:0:2.0&quot;</span>  FillBehavior=<span style="color:#006080;">&quot;HoldEnd&quot;</span> /&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum12">  12:</span>         &lt;DoubleAnimation Storyboard.TargetName=<span style="color:#006080;">&quot;rippleSub&quot;</span> Storyboard.TargetProperty=<span style="color:#006080;">&quot;Frequency&quot;</span> To=<span style="color:#006080;">&quot;0&quot;</span> From=<span style="color:#006080;">&quot;30&quot;</span> Duration=<span style="color:#006080;">&quot;0:0:2.5&quot;</span> FillBehavior=<span style="color:#006080;">&quot;HoldEnd&quot;</span> /&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum13">  13:</span>     &lt;/Storyboard&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum14">  14:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum15">  15:</span> &lt;/Window.Resources&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum16">  16:</span> &lt;Grid Background=<span style="color:#006080;">&quot;Transparent&quot;</span> &gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;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:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum18">  18:</span>     &lt;Border&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum19">  19:</span>         &lt;Border.Background&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum20">  20:</span>             &lt;LinearGradientBrush EndPoint=<span style="color:#006080;">&quot;0.93,0.925&quot;</span> StartPoint=<span style="color:#006080;">&quot;0.094,0.125&quot;</span>&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum21">  21:</span>                 &lt;GradientStop Color=<span style="color:#006080;">&quot;#FF272788&quot;</span> Offset=<span style="color:#006080;">&quot;0.112&quot;</span>/&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum22">  22:</span>                 &lt;GradientStop Color=<span style="color:#006080;">&quot;#FF090916&quot;</span> Offset=<span style="color:#006080;">&quot;0.721&quot;</span>/&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum23">  23:</span>                 &lt;GradientStop Color=<span style="color:#006080;">&quot;#FE222267&quot;</span> Offset=<span style="color:#006080;">&quot;0.28&quot;</span>/&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum24">  24:</span>                 &lt;GradientStop Color=<span style="color:#006080;">&quot;#FE131339&quot;</span> Offset=<span style="color:#006080;">&quot;0.453&quot;</span>/&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum25">  25:</span>                 &lt;GradientStop Color=<span style="color:#006080;">&quot;#FF04040A&quot;</span> Offset=<span style="color:#006080;">&quot;0.974&quot;</span>/&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum26">  26:</span>             &lt;/LinearGradientBrush&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum27">  27:</span>         &lt;/Border.Background&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum28">  28:</span>         &lt;Border.Effect&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum29">  29:</span>             &lt;shader:RippleEffect Amplitude=<span style="color:#006080;">&quot;0&quot;</span> Frequency=<span style="color:#006080;">&quot;0&quot;</span> Phase=<span style="color:#006080;">&quot;0&quot;</span> x:Name=<span style="color:#006080;">&quot;ripple&quot;</span> Center=<span style="color:#006080;">&quot;{Binding ElementName=main, Path=(local:MouseBehaviour.LastMouseUp)}&quot;</span> /&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum30">  30:</span>         &lt;/Border.Effect&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum31">  31:</span>     &lt;/Border&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;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:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum33">  33:</span>     &lt;Grid.Triggers&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum34">  34:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum35">  35:</span>         &lt;EventTrigger RoutedEvent=<span style="color:#006080;">&quot;UIElement.MouseUp&quot;</span>&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum36">  36:</span>             &lt;BeginStoryboard Storyboard=<span style="color:#006080;">&quot;{StaticResource waterAnim}&quot;</span>/&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum37">  37:</span>             &lt;BeginStoryboard Storyboard=<span style="color:#006080;">&quot;{StaticResource waterAnimMain}&quot;</span>/&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum38">  38:</span>         &lt;/EventTrigger&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum39">  39:</span>     &lt;/Grid.Triggers&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum40">  40:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum41">  41:</span>     &lt;Grid.Effect&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum42">  42:</span>         &lt;shader:RippleEffect Amplitude=<span style="color:#006080;">&quot;0&quot;</span> Frequency=<span style="color:#006080;">&quot;0&quot;</span> Phase=<span style="color:#006080;">&quot;0&quot;</span> x:Name=<span style="color:#006080;">&quot;rippleSub&quot;</span>  /&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum43">  43:</span>     &lt;/Grid.Effect&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum44">  44:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum45">  45:</span> &lt;/Grid&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum46">  46:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum47">  47:</span> &lt;Window.Effect&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum48">  48:</span>     &lt;shader:RippleEffect Amplitude=<span style="color:#006080;">&quot;0&quot;</span> Frequency=<span style="color:#006080;">&quot;0&quot;</span> Phase=<span style="color:#006080;">&quot;0&quot;</span> x:Name=<span style="color:#006080;">&quot;rippleMain&quot;</span>  /&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum49">  49:</span> &lt;/Window.Effect&gt;</pre>
<p><!--CRLF--></div>
</div>
<p>And that’s it. Now we have a perfect water look thanks to the Codeplex Pixel Shader library <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>I created a sample app that shows all this. The app also has another feature so that you can touch the water by using the mouse and the water would ripple from the point you touch (of course this is with Behaviours so that you can even reuse it <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' />  )</p>
<p>Happy coding <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p><a href="http://cid-96f8d49aa44c79c1.skydrive.live.com/self.aspx/Public/WaterDemo.zip" target="_blank">DOWNLOAD SOURCE CODE</a></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/marlongrech.wordpress.com/355/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/marlongrech.wordpress.com/355/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/marlongrech.wordpress.com/355/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/marlongrech.wordpress.com/355/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/marlongrech.wordpress.com/355/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/marlongrech.wordpress.com/355/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/marlongrech.wordpress.com/355/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/marlongrech.wordpress.com/355/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/marlongrech.wordpress.com/355/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/marlongrech.wordpress.com/355/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=marlongrech.wordpress.com&blog=783168&post=355&subd=marlongrech&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://marlongrech.wordpress.com/2009/08/27/playing-with-shaders-creating-a-water-effect/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4231953dc5a7ec7d7b5acb2444eeeeab?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">C# Disciple</media:title>
		</media:content>

		<media:content url="http://marlongrech.files.wordpress.com/2009/08/water_thumb.png" medium="image">
			<media:title type="html">Water</media:title>
		</media:content>
	</item>
		<item>
		<title>Installing Surface SDK on Win 7 64 bit</title>
		<link>http://marlongrech.wordpress.com/2009/08/19/installing-surface-sdk-on-win-7-64-bit/</link>
		<comments>http://marlongrech.wordpress.com/2009/08/19/installing-surface-sdk-on-win-7-64-bit/#comments</comments>
		<pubDate>Wed, 19 Aug 2009 15:46:04 +0000</pubDate>
		<dc:creator>marlongrech</dc:creator>
				<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://marlongrech.wordpress.com/2009/08/19/installing-surface-sdk-on-win-7-64-bit/</guid>
		<description><![CDATA[If you like me installed Win7 64 bit you’ll find out that there is a problem with the Surface SDK installer. In order to do this you have to change the installer using ORCA so that it does not do the OS Checks. You also have to do some other black magic… Have a look [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=marlongrech.wordpress.com&blog=783168&post=352&subd=marlongrech&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>If you like me installed Win7 64 bit you’ll find out that there is a problem with the Surface SDK installer. In order to do this you have to change the installer using ORCA so that it does not do the OS Checks. You also have to do some other black magic… Have a look at this here</p>
<p><a href="http://dotnet.dzone.com/news/install-surface-sdk-sp1">http://dotnet.dzone.com/news/install-surface-sdk-sp1</a></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/marlongrech.wordpress.com/352/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/marlongrech.wordpress.com/352/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/marlongrech.wordpress.com/352/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/marlongrech.wordpress.com/352/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/marlongrech.wordpress.com/352/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/marlongrech.wordpress.com/352/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/marlongrech.wordpress.com/352/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/marlongrech.wordpress.com/352/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/marlongrech.wordpress.com/352/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/marlongrech.wordpress.com/352/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=marlongrech.wordpress.com&blog=783168&post=352&subd=marlongrech&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://marlongrech.wordpress.com/2009/08/19/installing-surface-sdk-on-win-7-64-bit/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4231953dc5a7ec7d7b5acb2444eeeeab?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">C# Disciple</media:title>
		</media:content>
	</item>
		<item>
		<title>Blend 3 and Sketchflow</title>
		<link>http://marlongrech.wordpress.com/2009/08/04/blend-3-and-sketchflow/</link>
		<comments>http://marlongrech.wordpress.com/2009/08/04/blend-3-and-sketchflow/#comments</comments>
		<pubDate>Tue, 04 Aug 2009 23:17:06 +0000</pubDate>
		<dc:creator>marlongrech</dc:creator>
				<category><![CDATA[Blend]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">http://marlongrech.wordpress.com/2009/08/04/blend-3-and-sketchflow/</guid>
		<description><![CDATA[Blend 3 and SketchFlow are out and let me tell you they ROCK…. here are some good links on this subject
Behaviors   http://electricbeach.org/?p=171
List of Behaviors from the Expression Blend website   http://gallery.expression.microsoft.com/en-us/site/search?f[0].Type=RootCategory&#38;f[0].Value=behaviors
Demo of Blend 3 and SketchFlow   http://msdn.microsoft.com/en-gb/ee341352.aspx
Videos on Sketchflow   http://www.microsoft.com/belux/MSDN/nl/chopsticks/default.aspx?id=1325
Blend 3 list of new features   http://blogs.msdn.com/expression/archive/2009/07/12/overview-of-new-features-in-expression-blend-3-sketchflow-part-iii.aspx [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=marlongrech.wordpress.com&blog=783168&post=348&subd=marlongrech&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Blend 3 and SketchFlow are out and let me tell you they ROCK…. here are some good links on this subject</p>
<p>Behaviors   <br /><a href="http://electricbeach.org/?p=171">http://electricbeach.org/?p=171</a></p>
<p>List of Behaviors from the Expression Blend website   <br /><a href="http://gallery.expression.microsoft.com/en-us/site/search?f[0].Type=RootCategory&amp;f[0].Value=behaviors">http://gallery.expression.microsoft.com/en-us/site/search?f[0].Type=RootCategory&amp;f[0].Value=behaviors</a></p>
<p>Demo of Blend 3 and SketchFlow   <br /><a href="http://msdn.microsoft.com/en-gb/ee341352.aspx">http://msdn.microsoft.com/en-gb/ee341352.aspx</a></p>
<p>Videos on Sketchflow   <br /><a href="http://www.microsoft.com/belux/MSDN/nl/chopsticks/default.aspx?id=1325">http://www.microsoft.com/belux/MSDN/nl/chopsticks/default.aspx?id=1325</a></p>
<p>Blend 3 list of new features   <br /><a href="http://blogs.msdn.com/expression/archive/2009/07/12/overview-of-new-features-in-expression-blend-3-sketchflow-part-iii.aspx">http://blogs.msdn.com/expression/archive/2009/07/12/overview-of-new-features-in-expression-blend-3-sketchflow-part-iii.aspx</a>    <br /><a href="http://geekswithblogs.net/tkokke/archive/2009/07/10/9-little-new-things-in-expression-blend-3.aspx">http://geekswithblogs.net/tkokke/archive/2009/07/10/9-little-new-things-in-expression-blend-3.aspx</a></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/marlongrech.wordpress.com/348/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/marlongrech.wordpress.com/348/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/marlongrech.wordpress.com/348/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/marlongrech.wordpress.com/348/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/marlongrech.wordpress.com/348/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/marlongrech.wordpress.com/348/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/marlongrech.wordpress.com/348/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/marlongrech.wordpress.com/348/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/marlongrech.wordpress.com/348/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/marlongrech.wordpress.com/348/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=marlongrech.wordpress.com&blog=783168&post=348&subd=marlongrech&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://marlongrech.wordpress.com/2009/08/04/blend-3-and-sketchflow/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4231953dc5a7ec7d7b5acb2444eeeeab?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">C# Disciple</media:title>
		</media:content>
	</item>
		<item>
		<title>Looking for a WPF job??</title>
		<link>http://marlongrech.wordpress.com/2009/07/28/looking-for-a-wpf-job/</link>
		<comments>http://marlongrech.wordpress.com/2009/07/28/looking-for-a-wpf-job/#comments</comments>
		<pubDate>Tue, 28 Jul 2009 17:35:14 +0000</pubDate>
		<dc:creator>marlongrech</dc:creator>
				<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://marlongrech.wordpress.com/2009/07/28/looking-for-a-wpf-job/</guid>
		<description><![CDATA[Hey there you WPF junkies…
Infusion Development (the company I work for) are looking for people strong in WPF. If you are looking for such a position you can contact smenezes@infusion.com .
P.S Ignore this post if you are not interested   Had to write this post to please my HR manager and make her approve [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=marlongrech.wordpress.com&blog=783168&post=347&subd=marlongrech&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Hey there you WPF junkies…</p>
<p><a href="http://www.infusiondev.com/index.aspx">Infusion Development</a> (the company I work for) are looking for people strong in WPF. If you are looking for such a position you can contact smenezes@infusion.com .</p>
<p>P.S Ignore this post if you are not interested <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Had to write this post to please my HR manager and make her approve my vacation leave <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' />  haha</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/marlongrech.wordpress.com/347/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/marlongrech.wordpress.com/347/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/marlongrech.wordpress.com/347/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/marlongrech.wordpress.com/347/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/marlongrech.wordpress.com/347/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/marlongrech.wordpress.com/347/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/marlongrech.wordpress.com/347/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/marlongrech.wordpress.com/347/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/marlongrech.wordpress.com/347/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/marlongrech.wordpress.com/347/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=marlongrech.wordpress.com&blog=783168&post=347&subd=marlongrech&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://marlongrech.wordpress.com/2009/07/28/looking-for-a-wpf-job/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4231953dc5a7ec7d7b5acb2444eeeeab?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">C# Disciple</media:title>
		</media:content>
	</item>
	</channel>
</rss>