<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>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>Sat, 28 Jan 2012 01:18:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='marlongrech.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>C# Disciples</title>
		<link>http://marlongrech.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://marlongrech.wordpress.com/osd.xml" title="C# Disciples" />
	<atom:link rel='hub' href='http://marlongrech.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Thinking in boxes</title>
		<link>http://marlongrech.wordpress.com/2012/01/23/thinking-in-boxes/</link>
		<comments>http://marlongrech.wordpress.com/2012/01/23/thinking-in-boxes/#comments</comments>
		<pubDate>Mon, 23 Jan 2012 22:38:29 +0000</pubDate>
		<dc:creator>marlongrech</dc:creator>
				<category><![CDATA[css3]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[HTML5 for XAML guys]]></category>

		<guid isPermaLink="false">https://marlongrech.wordpress.com/?p=620</guid>
		<description><![CDATA[So if you have been following my blog lately you would have noticed I am doing some adventures in HTML lately… No I am not leaving my XAML love behind I just feel that I should look at other stuff and get ideas from different technology stacks. Introduction In todays article I want to show [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=marlongrech.wordpress.com&amp;blog=783168&amp;post=620&amp;subd=marlongrech&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>So if you have been following my blog lately you would have noticed I am doing some <a href="http://marlongrech.wordpress.com/2012/01/22/html5-css3-javascript-vs-xaml-net-and-silverlight/">adventures in HTML lately</a>… No I am not leaving my XAML love behind I just feel that I should look at other stuff and get ideas from different technology stacks. </p>
<h4>Introduction</h4>
<p>In todays article I want to show how layout specifically one nicknamed as the “Traditional Box Model” comes in handy to know for those that like me come form a XAML background, a background which has a rich layout system, a background where panels are the kings of the realm. We’ll see how in HTML, yes this is a bit harder, but very achievable. We will also see how HTML5 and CSS3 introduces some really cool concepts and how layout becomes comparable to XAML layout and panels.</p>
<p>I remember back in the days when I used to do web (around 6 years ago) many would layout the page by using a &lt;table /&gt;. Yes a table believe it or not! You might ask yourself “but a table is really for displaying lists of data no??”. Well layout is not really the most intuitive thing to figure out in HTML and devs love shortcuts thus yes; tables were (and in some cases still are) a tool to do layout. But is it the best way to do layout?? No, its not really… A more flexible way to do layout is by using divs. Enter the “Box Model”.</p>
<h4>Box Model</h4>
<p>Lets say we wanted to do something like this</p>
<p><a href="http://marlongrech.files.wordpress.com/2012/01/image5.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;float:left;border-top:0;border-right:0;padding-top:0;margin:0 10px 10px 0;" title="image" border="0" alt="image" align="left" src="http://marlongrech.files.wordpress.com/2012/01/image_thumb5.png?w=244&#038;h=174" width="244" height="174" /></a></p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>One way of picturing this layout is that every box is a div (some might argue it doesn’t really need to be a div but really any element that has display: block, but for simplicity, let’s say divs for now). A div by default will occupy all the width available, so if we had the following HTML the output would not really resemble the layout we have in the image here.</p>
<p>&#160;</p>
<p><a href="http://marlongrech.files.wordpress.com/2012/01/image6.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;float:left;border-top:0;border-right:0;padding-top:0;margin:0 10px 0 0;" title="image" border="0" alt="image" align="left" src="http://marlongrech.files.wordpress.com/2012/01/image_thumb6.png?w=244&#038;h=208" width="244" height="208" /></a></p>
<p>This would actually render into something like this</p>
<p><a href="http://marlongrech.files.wordpress.com/2012/01/image7.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="image" border="0" alt="image" src="http://marlongrech.files.wordpress.com/2012/01/image_thumb7.png?w=319&#038;h=92" width="319" height="92" /></a></p>
<p>Blue div == ‘mainSection’; Red div == ‘sideSection’;</p>
<p>In order to get these 2 divs side by side, <strong>we need to specify a CSS property called </strong><a href="http://www.w3schools.com/cssref/pr_class_float.asp">float</a>. You can specify left, right, none or inherit. In our case we will want to set the mainSection to float: left and the sideSection to float: left. The piece that many forget to add, which then results in chaos is to set to the next element (in our case the footer) the css property <a href="http://www.w3schools.com/css/pr_class_clear.asp">clear: bot</a>h. This will restore the flow of the document and basically in our case it will prevent the footer from going up on the side of the sideSection div.</p>
<p>So here is the CSS styling we have done so far</p>
<p><a href="http://marlongrech.files.wordpress.com/2012/01/image8.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;float:left;border-top:0;border-right:0;padding-top:0;margin:0 10px 0 0;" title="image" border="0" alt="image" align="left" src="http://marlongrech.files.wordpress.com/2012/01/image_thumb8.png?w=206&#038;h=244" width="206" height="244" /></a></p>
<p>And here is the result we got</p>
<p><a href="http://marlongrech.files.wordpress.com/2012/01/image9.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;margin:0;" title="image" border="0" alt="image" src="http://marlongrech.files.wordpress.com/2012/01/image_thumb9.png?w=319&#038;h=92" width="319" height="92" /></a></p>
<p>&#160;</p>
<p>Nothing really changed did it?? Nope it did not. And the reason for that is that as I was saying before a div will occupy the full width available by default. What we can do here to make the mainSection and sideSection layout side by side is to set a width for the divs. And we finally get a result that looks like this</p>
<p>&#160;</p>
<p><a href="http://marlongrech.files.wordpress.com/2012/01/image10.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:block;float:none;border-top:0;border-right:0;padding-top:0;margin:10px auto;" title="image" border="0" alt="image" src="http://marlongrech.files.wordpress.com/2012/01/image_thumb10.png?w=644&#038;h=148" width="644" height="148" /></a></p>
<p>What is annoying here is that we had to specify a width to both divs… In all fairness the sideSection can stay without a width and this would make it occupy the reminder width inside the page. That’s cool BUT we want our mainSection to take the dynamic width and not really the sideSection, right? Yes you can do it with the Traditional Box Model BUT instead lets have a look at how we can do this and much more using the new hot stuff from HTML5 and CSS3.</p>
<h4>Enter “Flexible Box Model”</h4>
<p>The flexible box model is still something that browsers are experimenting with in fact you’ll find that you will need to annotate the properties for this with –webkit and –moz- and –ms . don’t you love experimental things <img style="border-style:none;" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://marlongrech.files.wordpress.com/2012/01/wlemoticon-smile1.png" /> Anyways, the idea with this is to be able to be more dynamic, to have a proper way how to specify layout. With this model you’ll be able to specify if you want the flow to be horizontal or vertical (just like orientation in StackPanel for those XAML guys reading) you’ll be able to specify how much “percentage” of the space available vertically/horizontal should a box take up (just like ColumnDefenitions and RowDefinitions in Grid for those XAML guys reading). You will also be able to specify the alignment and yes also the index you want each box to be in… </p>
<p>Does this feel more like panels in the XAML world. WUHUU now we are talking …. so let’s pimp up our screen with some hot and spicy HTML 5 / CSS3.</p>
<p>Let’s start fresh… here is some new HTML … Basically a parent div with 4 divs and lets start rocking!</p>
<p><a href="http://marlongrech.files.wordpress.com/2012/01/image11.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;float:left;border-top:0;border-right:0;padding-top:0;margin:0 10px 0 0;" title="image" border="0" alt="image" align="left" src="http://marlongrech.files.wordpress.com/2012/01/image_thumb11.png?w=244&#038;h=119" width="244" height="119" /></a>The first thing we want to do is tell the container div that we want to use the new box model. To do so we set <strong>display: box</strong>. Since this is experimental still we need to specify <strong>display:-webkit-box;</strong></p>
<p>As I was saying the new flexible box model supports orientation, you do this by specifying <strong>box-orient</strong>. As expected this takes horizontal and vertical . <strong>P.S do not forget to add the –webkit- and all the rest.</strong></p>
<p>&#160;</p>
<p><a href="http://marlongrech.files.wordpress.com/2012/01/image12.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;float:left;border-top:0;border-right:0;padding-top:0;margin:0 10px 0 0;" title="image" border="0" alt="image" align="left" src="http://marlongrech.files.wordpress.com/2012/01/image_thumb12.png?w=244&#038;h=131" width="244" height="131" /></a></p>
<p>And this gives us</p>
<p><a href="http://marlongrech.files.wordpress.com/2012/01/image13.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;margin:0;" title="image" border="0" alt="image" src="http://marlongrech.files.wordpress.com/2012/01/image_thumb13.png?w=167&#038;h=44" width="167" height="44" /></a></p>
<p>This might look like its nothing but hey we just started… Ok seems like these boxes are only using the width that the inside text measures, lets make them use all space available evenly (just like we would do with a XAML Grid)</p>
<p>To do so we use another cool CSS3 feature. The magic property is called box-flex. </p>
<p><a href="http://marlongrech.files.wordpress.com/2012/01/image14.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;float:left;border-top:0;border-right:0;padding-top:0;margin:0 10px 0 0;" title="image" border="0" alt="image" align="left" src="http://marlongrech.files.wordpress.com/2012/01/image_thumb14.png?w=244&#038;h=87" width="244" height="87" /></a></p>
<p>And this gives us </p>
<p><a href="http://marlongrech.files.wordpress.com/2012/01/image15.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="image" border="0" alt="image" src="http://marlongrech.files.wordpress.com/2012/01/image_thumb15.png?w=443&#038;h=40" width="443" height="40" /></a></p>
<p>Already very exciting isn’t it?! What was that 1 we set to box-flex. The 1 is basically being used in the following formula &gt;&gt; widthOfParent * 1/numberOfElements = widthForElement (ex: 600 * 1/4 = 150). For example if I set 3 for one of the boxes, I get this result which is Box3 is as big as the other 3 boxes all together. (doesn’t it sound like a * measure for ColumnDefinitions in XAML <img style="border-style:none;" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://marlongrech.files.wordpress.com/2012/01/wlemoticon-smile1.png" /> )</p>
<p><a href="http://marlongrech.files.wordpress.com/2012/01/image16.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="image" border="0" alt="image" src="http://marlongrech.files.wordpress.com/2012/01/image_thumb16.png?w=644&#038;h=53" width="644" height="53" /></a></p>
<p>Yes resizing the browser window will nicely resize these boxes just like one would expect. AWESOMENESS on a stick!!!!! </p>
<p>What if I want that all boxes are 100px BUT (since I am a crazy evil designer that likes to bully developers) I want them to be all centred in the middle of the screen. Well to give each box a size we know what we have to do, set the width css property. To specify how to layout them there is a new CSS3 property called box-pack. This property will tell the Browser how to distribute the free space. You can set this to start, end, center and justify. Lets go for center (<strong>-webkit-box-pack:center;</strong>) and we get something like this </p>
<p><a href="http://marlongrech.files.wordpress.com/2012/01/image17.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="image" border="0" alt="image" src="http://marlongrech.files.wordpress.com/2012/01/image_thumb17.png?w=644&#038;h=72" width="644" height="72" /></a></p>
<p>if I specify <strong>–webkit-box-pack: justify</strong> I get this</p>
<p><a href="http://marlongrech.files.wordpress.com/2012/01/image18.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="image" border="0" alt="image" src="http://marlongrech.files.wordpress.com/2012/01/image_thumb18.png?w=644&#038;h=76" width="644" height="76" /></a></p>
<p>What if we want to change the rendering order of the boxes? CSS3 to the rescue <img style="border-style:none;" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://marlongrech.files.wordpress.com/2012/01/wlemoticon-smile1.png" /> box-direction a new CSS property will do the trick by setting it to reverse. <strong>–webkit-box-direction:reverse</strong></p>
<p><a href="http://marlongrech.files.wordpress.com/2012/01/image19.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;float:left;border-top:0;border-right:0;padding-top:0;" title="image" border="0" alt="image" align="left" src="http://marlongrech.files.wordpress.com/2012/01/image_thumb19.png?w=244&#038;h=103" width="244" height="103" /></a></p>
<p><a href="http://marlongrech.files.wordpress.com/2012/01/image20.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="image" border="0" alt="image" src="http://marlongrech.files.wordpress.com/2012/01/image_thumb20.png?w=530&#038;h=59" width="530" height="59" /></a></p>
<p>&#160;</p>
<p>&#160;</p>
<p>And yes you can even change the order of the boxes (just like a XAML Panel) by specifying the box-ordinal-group</p>
<p><a href="http://marlongrech.files.wordpress.com/2012/01/image21.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;float:left;border-top:0;border-right:0;padding-top:0;margin:0 10px 10px 0;" title="image" border="0" alt="image" align="left" src="http://marlongrech.files.wordpress.com/2012/01/image_thumb21.png?w=244&#038;h=196" width="244" height="196" /></a></p>
<p><a href="http://marlongrech.files.wordpress.com/2012/01/image22.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="image" border="0" alt="image" src="http://marlongrech.files.wordpress.com/2012/01/image_thumb22.png?w=437&#038;h=80" width="437" height="80" /></a></p>
<p>&#160;</p>
<p>&#160;</p>
<p>Last but not least is <strong>box-align</strong> which can be center, left, right and also stretch. </p>
<p>&#160;</p>
<h4>&#160;</h4>
<h4>Conclusion</h4>
<p>Check out more details on this over <a href="http://www.html5rocks.com/en/tutorials/flexbox/quick/">here</a>. I hope that this article really shows you that HTML5 and CSS3 are really making some very cool and exciting things for us devs. If like me you come from a background where layout is something really rich (which in any XAML technology, layout is super easy to work with) HTML5 and CSS3 are building mechanisms to be leveraged and easily build awesome web applications.</p>
<p>I am very excited about this, layout sometimes is taken for granted but what is a good UI platform without a good and flexible layout system. Thankfully HTML5 and CSS3 are here to rescue us from the evil designer requests <img style="border-style:none;" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://marlongrech.files.wordpress.com/2012/01/wlemoticon-smile1.png" /></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/marlongrech.wordpress.com/620/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/marlongrech.wordpress.com/620/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/marlongrech.wordpress.com/620/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/marlongrech.wordpress.com/620/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/marlongrech.wordpress.com/620/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/marlongrech.wordpress.com/620/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/marlongrech.wordpress.com/620/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/marlongrech.wordpress.com/620/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/marlongrech.wordpress.com/620/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/marlongrech.wordpress.com/620/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/marlongrech.wordpress.com/620/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/marlongrech.wordpress.com/620/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/marlongrech.wordpress.com/620/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/marlongrech.wordpress.com/620/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=marlongrech.wordpress.com&amp;blog=783168&amp;post=620&amp;subd=marlongrech&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://marlongrech.wordpress.com/2012/01/23/thinking-in-boxes/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>

		<media:content url="http://marlongrech.files.wordpress.com/2012/01/image_thumb5.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://marlongrech.files.wordpress.com/2012/01/image_thumb6.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://marlongrech.files.wordpress.com/2012/01/image_thumb7.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://marlongrech.files.wordpress.com/2012/01/image_thumb8.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://marlongrech.files.wordpress.com/2012/01/image_thumb9.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://marlongrech.files.wordpress.com/2012/01/image_thumb10.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://marlongrech.files.wordpress.com/2012/01/wlemoticon-smile1.png" medium="image">
			<media:title type="html">Smile</media:title>
		</media:content>

		<media:content url="http://marlongrech.files.wordpress.com/2012/01/image_thumb11.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://marlongrech.files.wordpress.com/2012/01/image_thumb12.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://marlongrech.files.wordpress.com/2012/01/image_thumb13.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://marlongrech.files.wordpress.com/2012/01/image_thumb14.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://marlongrech.files.wordpress.com/2012/01/image_thumb15.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://marlongrech.files.wordpress.com/2012/01/wlemoticon-smile1.png" medium="image">
			<media:title type="html">Smile</media:title>
		</media:content>

		<media:content url="http://marlongrech.files.wordpress.com/2012/01/image_thumb16.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://marlongrech.files.wordpress.com/2012/01/image_thumb17.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://marlongrech.files.wordpress.com/2012/01/image_thumb18.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://marlongrech.files.wordpress.com/2012/01/wlemoticon-smile1.png" medium="image">
			<media:title type="html">Smile</media:title>
		</media:content>

		<media:content url="http://marlongrech.files.wordpress.com/2012/01/image_thumb19.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://marlongrech.files.wordpress.com/2012/01/image_thumb20.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://marlongrech.files.wordpress.com/2012/01/image_thumb21.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://marlongrech.files.wordpress.com/2012/01/image_thumb22.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://marlongrech.files.wordpress.com/2012/01/wlemoticon-smile1.png" medium="image">
			<media:title type="html">Smile</media:title>
		</media:content>
	</item>
		<item>
		<title>HTML5 CSS3 Javascript vs XAML .net and Silverlight</title>
		<link>http://marlongrech.wordpress.com/2012/01/22/html5-css3-javascript-vs-xaml-net-and-silverlight/</link>
		<comments>http://marlongrech.wordpress.com/2012/01/22/html5-css3-javascript-vs-xaml-net-and-silverlight/#comments</comments>
		<pubDate>Sun, 22 Jan 2012 18:21:51 +0000</pubDate>
		<dc:creator>marlongrech</dc:creator>
				<category><![CDATA[WPF]]></category>
		<category><![CDATA[silverlight]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[css3]]></category>

		<guid isPermaLink="false">https://marlongrech.wordpress.com/?p=578</guid>
		<description><![CDATA[Introduction &#62;&#62; The clash of the Titans is on Developers right this second are at some bar / restaurant / lounge / god knows where else being “social” i.e. having geeky discussions about technology, what language/platform is best to use or even better “what’s coolest right now” I am one of those developers and I [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=marlongrech.wordpress.com&amp;blog=783168&amp;post=578&amp;subd=marlongrech&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h4>Introduction &gt;&gt; The clash of the Titans is on</h4>
<p><img style="display:inline;float:left;margin:10px 10px 10px 0;" src="http://t0.gstatic.com/images?q=tbn:ANd9GcS4-S9r8ogqXVspXBE4Q-2hwKiLCHIJM0A1_MVLOoXfpHUOFzXk" alt="" align="left" /></p>
<p>Developers right this second are at some bar / restaurant / lounge / god knows where else being “social” i.e. having geeky discussions about technology, what language/platform is best to use or even better “what’s coolest right now” <img class="wlEmoticon wlEmoticon-smile" style="border-style:none;" src="http://marlongrech.files.wordpress.com/2012/01/wlemoticon-smile.png" alt="Smile" /></p>
<p>I am one of those developers and I must say, when it comes to such discussions I am always biased towards XAML technologies. Yet recently I started diving in what I used to call the “darker side” i.e. HTML5, JS and CSS3 (the “dark side” is reserved for things like Java <img class="wlEmoticon wlEmoticon-smile" style="border-style:none;" src="http://marlongrech.files.wordpress.com/2012/01/wlemoticon-smile.png" alt="Smile" /> ). It’s been years (6 to be exact) since I was doing some HTML and Co and I must say; I am really impressed. HTML5 just takes everything to a whole new level BUT what impresses me most is JS and CSS3.</p>
<p>JS because the browsers are natively exposing APIs such as GeoLocation, Canvas drawing, local storage and also indexed DB (and more APIs). BESIDES THAT, what sells JS for me, is the new libraries developers are building such as JQuery and Knockout.js. Working with javascript today is just loads and loads of fun !!</p>
<p>CSS3 because WOW its frekin cool!! The new box modelling with the Flexible box model, the gardients, the transforms, the transitions and I can go on and on…</p>
<p>So yea I must admit, web development (presentation layer) of today is becoming loads of fun! Backend for Web with MVC its also frekin cool! so I guess the questions that readers of my blog / people who know me would ask “Is Marlon turning his back on XAML?” The answer is simple and its NO, my car number plate still says WPF so I guess I cannot change everything now <img class="wlEmoticon wlEmoticon-smile" style="border-style:none;" src="http://marlongrech.files.wordpress.com/2012/01/wlemoticon-smile.png" alt="Smile" /> Joking aside, I see both technologies as super awesome and both of them have a different realms (to a certain extend). “to a certain extend” for the reason that WinRT will also support HTML5 JS and CSS3 as a first class citizen just like it will for XAML and C# / C++.</p>
<h4>Does this mean we should say bye bye to XAML and just focus on HTML5 and Co?? If it can do web + desktop why bother looking at XAML??</h4>
<p>Ok so lets be a bit metaphoric about this and let’s compare technologies with cars. There are many different brands, there is Audi, there is Honda and you can go on and on… They all take you from place A – B. How they take you is a bit different, some are super confortable, some are fast. Some are perfect for one thing some are perfect for another! You buy a car that fits your needs and the same can be said to technology you decide to use. There are those scenarios, for example when you are moving house, where you do not have the luxury to use your “preferred car” because hey; if its a sports car, it will be no good when you are moving, so in such a case you are coerced to use a specific type. Such an example for developers is the web / mobile phones &#8230; Yet again just like in real life there are many different trucks for moving <img class="wlEmoticon wlEmoticon-smile" style="border-style:none;" src="http://marlongrech.files.wordpress.com/2012/01/wlemoticon-smile.png" alt="Smile" /> there is HTML5, and then there are the plugins (Flash, Silverlight) …</p>
<h5>Which one should you go for? HTML5 or Plugins?</h5>
<p>Looking at web tech today I would say go for HTML5. It will work on devices such as phones, if done properly it will be super fast. On the other hand I would strongly suggest you consider SL / Flash if your users cannot install/already have a browser that supports HTML5. In that case then yea I would not go for the HTML &lt; 5 because you’re in for nightmares! Maybe mix and match! Some things are better done with plugins some other with HTML. Do not be afraid to try both worlds, it will not hurt.</p>
<h5>What about WPF??</h5>
<p>WPF will still have a place but I guess we will slowly see it being used lesser and lesser, reason being with WinRT you are not using WPF you are using WinRT, yes its XAML but NO it is not WPF. There are cases such as VS and similar heavy weight products that would require something like WPF. Trading applications and internal banking applications is another example for WPF apps. But yea if you are building a simple app, going forward one would be better off with something Metro style i.e. WinRT based. So should WPF developers say “cr*p I wasted a lot of time learning something I will not use anymore”?? Whoever says that is really talking bull***t! WPF thought us a lot, WPF gave us so many concepts and ideas… WPF will always continue living in other technologies… Its concepts that really are hard to learn not how to use a framework, example DataTemplates, ControlTemplates, Binding and many other concepts … For me WPF showed me what an awesome API should look like! Besides that you learnt XAML that is something that is not a waste of time since XAML is here to stay !</p>
<h4>Final verdict &#8211; Who will be the last technology standing?</h4>
<p>None probably <img class="wlEmoticon wlEmoticon-smile" style="border-style:none;" src="http://marlongrech.files.wordpress.com/2012/01/wlemoticon-smile.png" alt="Smile" /> technology evolves … sorry my fellow geeks, I like you used to treat a technology stack (and must admit still do sometimes) as my one and true love and I could not use another technology without feeling that I am being <strong>MARLONCHANGE</strong>… well its not the case, when it comes to technology you can mix and match as much as you want and no you will not be called a “Cheater” <img class="wlEmoticon wlEmoticon-smile" style="border-style:none;" src="http://marlongrech.files.wordpress.com/2012/01/wlemoticon-smile.png" alt="Smile" /></p>
<p>Take it from me, if you did not have a look at HTML5 and co, maybe its time for you to do so. Maybe you will not use it but I am sure you’ll get something out of it. I am learning so much, getting so many new ideas (that yea I can even apply for WPF) from doing some HTML5 and Co.</p>
<p>Hope I did not bore you to death with this post but I felt I needed to share this with you guys! I’ll be posting more on HTML5 and Co this year but yea of course I will also do the same for XAML and Co.</p>
<p>Long live XAML</p>
<p>Long live HTML5 <span style="font-size:xx-small;">(and co)</span></p>
<p><a href="#">&gt;&gt; No source code to download just thoughts …</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/marlongrech.wordpress.com/578/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/marlongrech.wordpress.com/578/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/marlongrech.wordpress.com/578/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/marlongrech.wordpress.com/578/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/marlongrech.wordpress.com/578/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/marlongrech.wordpress.com/578/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/marlongrech.wordpress.com/578/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/marlongrech.wordpress.com/578/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/marlongrech.wordpress.com/578/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/marlongrech.wordpress.com/578/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/marlongrech.wordpress.com/578/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/marlongrech.wordpress.com/578/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/marlongrech.wordpress.com/578/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/marlongrech.wordpress.com/578/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=marlongrech.wordpress.com&amp;blog=783168&amp;post=578&amp;subd=marlongrech&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://marlongrech.wordpress.com/2012/01/22/html5-css3-javascript-vs-xaml-net-and-silverlight/feed/</wfw:commentRss>
		<slash:comments>5</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://t0.gstatic.com/images?q=tbn:ANd9GcS4-S9r8ogqXVspXBE4Q-2hwKiLCHIJM0A1_MVLOoXfpHUOFzXk" medium="image" />

		<media:content url="http://marlongrech.files.wordpress.com/2012/01/wlemoticon-smile.png" medium="image">
			<media:title type="html">Smile</media:title>
		</media:content>

		<media:content url="http://marlongrech.files.wordpress.com/2012/01/wlemoticon-smile.png" medium="image">
			<media:title type="html">Smile</media:title>
		</media:content>

		<media:content url="http://marlongrech.files.wordpress.com/2012/01/wlemoticon-smile.png" medium="image">
			<media:title type="html">Smile</media:title>
		</media:content>

		<media:content url="http://marlongrech.files.wordpress.com/2012/01/wlemoticon-smile.png" medium="image">
			<media:title type="html">Smile</media:title>
		</media:content>

		<media:content url="http://marlongrech.files.wordpress.com/2012/01/wlemoticon-smile.png" medium="image">
			<media:title type="html">Smile</media:title>
		</media:content>

		<media:content url="http://marlongrech.files.wordpress.com/2012/01/wlemoticon-smile.png" medium="image">
			<media:title type="html">Smile</media:title>
		</media:content>
	</item>
		<item>
		<title>Timeouts for long running operations&#8230;</title>
		<link>http://marlongrech.wordpress.com/2012/01/19/timeouts-for-long-running-operations/</link>
		<comments>http://marlongrech.wordpress.com/2012/01/19/timeouts-for-long-running-operations/#comments</comments>
		<pubDate>Thu, 19 Jan 2012 16:13:53 +0000</pubDate>
		<dc:creator>marlongrech</dc:creator>
				<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">https://marlongrech.wordpress.com/?p=574</guid>
		<description><![CDATA[Today I stumbled upon a timeout issue while building a web application and felt like I need to share this for those that like me wasted/are wasting hours trying to figure out why you are getting a timeout. Here is a diagram that show the structure of the request response stack I have. The reason [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=marlongrech.wordpress.com&amp;blog=783168&amp;post=574&amp;subd=marlongrech&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Today I stumbled upon a timeout issue while building a web application and felt like I need to share this for those that like me wasted/are wasting hours trying to figure out why you are getting a timeout.</p>
<p>Here is a diagram that show the structure of the request response stack I have.</p>
<p><a href="http://marlongrech.files.wordpress.com/2012/01/image2.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="image" border="0" alt="image" src="http://marlongrech.files.wordpress.com/2012/01/image_thumb2.png?w=644&#038;h=348" width="644" height="348" /></a></p>
<p>The reason why I went for an <a href="http://msdn.microsoft.com/en-us/library/ee728598.aspx">AsyncController</a> is that the long running operation is not CPU-bound processing thus the thread that would be waiting for the response would be wasting its time waiting. More info on why and how to use Async Controllers in MVC3 can be <a href="http://msdn.microsoft.com/en-us/library/ee728598.aspx">found here</a>. </p>
<p>All is fine and good until my I hit a request that took more than 1 minute, and then the nightmare of timeouts begun… So first thing I did is make sure I make the timeout for the WCF service longer. You can do this by setting the sendTimeout and the receiveTimeout of the binding in the binding configuration. </p>
<p><a href="http://marlongrech.files.wordpress.com/2012/01/image3.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="image" border="0" alt="image" src="http://marlongrech.files.wordpress.com/2012/01/image_thumb3.png?w=644&#038;h=92" width="644" height="92" /></a></p>
<p>Don’t forget to do the same thing on the client side otherwise you’ll get in trouble (the config is the same as the server, and if you are using VS to generate the config then this will be done for you when you refresh the ServiceReference).</p>
<p>At this stage I said, wuhooo, it’s all done… but nope… it was still timing out … I was confused and puzzled… WHY WHY WHY!!!!! </p>
<p>Well AsyncController also have a timeout (or 90seconds as per MSDN doc), you also need to set the timeout to the async controller action in order for this to work. You do this by setting the <a href="http://msdn.microsoft.com/en-us/library/system.web.mvc.asynctimeoutattribute%28VS.100%29.aspx">AsyncTimeout</a> attribute on the action that you want to extend its timeout.</p>
<p><a href="http://marlongrech.files.wordpress.com/2012/01/image4.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="image" border="0" alt="image" src="http://marlongrech.files.wordpress.com/2012/01/image_thumb4.png?w=302&#038;h=58" width="302" height="58" /></a></p>
<p>With this in place all started working… but yea the errors don’t really help !</p>
<p>Hope this helps… </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/marlongrech.wordpress.com/574/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/marlongrech.wordpress.com/574/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/marlongrech.wordpress.com/574/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/marlongrech.wordpress.com/574/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/marlongrech.wordpress.com/574/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/marlongrech.wordpress.com/574/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/marlongrech.wordpress.com/574/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/marlongrech.wordpress.com/574/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/marlongrech.wordpress.com/574/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/marlongrech.wordpress.com/574/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/marlongrech.wordpress.com/574/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/marlongrech.wordpress.com/574/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/marlongrech.wordpress.com/574/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/marlongrech.wordpress.com/574/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=marlongrech.wordpress.com&amp;blog=783168&amp;post=574&amp;subd=marlongrech&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://marlongrech.wordpress.com/2012/01/19/timeouts-for-long-running-operations/feed/</wfw:commentRss>
		<slash:comments>3</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/2012/01/image_thumb2.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://marlongrech.files.wordpress.com/2012/01/image_thumb3.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://marlongrech.files.wordpress.com/2012/01/image_thumb4.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>Parsing HTML in C#</title>
		<link>http://marlongrech.wordpress.com/2012/01/05/parsing-html-in-c-2/</link>
		<comments>http://marlongrech.wordpress.com/2012/01/05/parsing-html-in-c-2/#comments</comments>
		<pubDate>Thu, 05 Jan 2012 20:30:41 +0000</pubDate>
		<dc:creator>marlongrech</dc:creator>
				<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">https://marlongrech.wordpress.com/?p=563</guid>
		<description><![CDATA[Today I stumbled upon a bizarre problem, I wanted to parse an HTML for a site to find out if the site contains any RSS feeds. After some research I found out that finding the RSS feed for a site is not that hard, you have to look for an element that looks like this [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=marlongrech.wordpress.com&amp;blog=783168&amp;post=563&amp;subd=marlongrech&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Today I stumbled upon a bizarre problem, I wanted to parse an HTML for a site to find out if the site contains any RSS feeds. After some research I found out that finding the RSS feed for a site is not that hard, you have to look for an element that looks like this</p>
<p><a href="http://marlongrech.files.wordpress.com/2012/01/image.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="http://marlongrech.files.wordpress.com/2012/01/image_thumb.png?w=644&#038;h=26" width="644" height="26" /></a></p>
<p>“Easy task”, I said, me Mr.Optimistic; “I will just load it up in XElement and using Linq to XML to get the data I want”. BUT guess what the web is filled with crazy HTML that a standard .NET parser such as XElement just gives up on and blows up in flames. </p>
<p>After some heavy head banging to walls and ceilings, I found the solution, <a href="http://htmlagilitypack.codeplex.com/">HtmlAgilityPack</a>. This open source project lets you load HTML even if it is not in a good shape. With some options HTMLAgilityPack will fix these errors and then you can query the HTML to get elements and their attributes as you please. </p>
<p>Here is the code I used to load the HTML and find the data I need</p>
<p><a href="http://marlongrech.files.wordpress.com/2012/01/image1.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="http://marlongrech.files.wordpress.com/2012/01/image_thumb1.png?w=644&#038;h=375" width="644" height="375" /></a></p>
<p>Kudos to the guys from <a href="http://htmlagilitypack.codeplex.com/">HTMLAgilityPack</a>!!!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/marlongrech.wordpress.com/563/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/marlongrech.wordpress.com/563/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/marlongrech.wordpress.com/563/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/marlongrech.wordpress.com/563/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/marlongrech.wordpress.com/563/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/marlongrech.wordpress.com/563/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/marlongrech.wordpress.com/563/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/marlongrech.wordpress.com/563/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/marlongrech.wordpress.com/563/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/marlongrech.wordpress.com/563/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/marlongrech.wordpress.com/563/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/marlongrech.wordpress.com/563/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/marlongrech.wordpress.com/563/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/marlongrech.wordpress.com/563/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=marlongrech.wordpress.com&amp;blog=783168&amp;post=563&amp;subd=marlongrech&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://marlongrech.wordpress.com/2012/01/05/parsing-html-in-c-2/feed/</wfw:commentRss>
		<slash:comments>3</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/2012/01/image_thumb.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://marlongrech.files.wordpress.com/2012/01/image_thumb1.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>2011 in review</title>
		<link>http://marlongrech.wordpress.com/2012/01/01/2011-in-review/</link>
		<comments>http://marlongrech.wordpress.com/2012/01/01/2011-in-review/#comments</comments>
		<pubDate>Sun, 01 Jan 2012 08:29:05 +0000</pubDate>
		<dc:creator>marlongrech</dc:creator>
				<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://marlongrech.wordpress.com/?p=554</guid>
		<description><![CDATA[The WordPress.com stats helper monkeys prepared a 2011 annual report for this blog. Here&#8217;s an excerpt: London Olympic Stadium holds 80,000 people. This blog was viewed about 350,000 times in 2011. If it were competing at London Olympic Stadium, it would take about 4 sold-out events for that many people to see it. Click here [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=marlongrech.wordpress.com&amp;blog=783168&amp;post=554&amp;subd=marlongrech&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The WordPress.com stats helper monkeys prepared a 2011 annual report for this blog.</p>
<div style="background:url('/wp-content/mu-plugins/annual-reports/img/emailteaser.jpg') no-repeat center center;height:300px;"></div>
<p>Here&#8217;s an excerpt:</p>
<blockquote><p>London Olympic Stadium holds 80,000 people. This blog was viewed about <strong>350,000</strong> times in 2011. If it were competing at London Olympic Stadium, it would take about 4 sold-out events for that many people to see it.</p></blockquote>
<p><a href="/2011/annual-report/">Click here to see the complete report.</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/marlongrech.wordpress.com/554/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/marlongrech.wordpress.com/554/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/marlongrech.wordpress.com/554/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/marlongrech.wordpress.com/554/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/marlongrech.wordpress.com/554/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/marlongrech.wordpress.com/554/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/marlongrech.wordpress.com/554/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/marlongrech.wordpress.com/554/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/marlongrech.wordpress.com/554/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/marlongrech.wordpress.com/554/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/marlongrech.wordpress.com/554/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/marlongrech.wordpress.com/554/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/marlongrech.wordpress.com/554/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/marlongrech.wordpress.com/554/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=marlongrech.wordpress.com&amp;blog=783168&amp;post=554&amp;subd=marlongrech&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://marlongrech.wordpress.com/2012/01/01/2011-in-review/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>More MEFedMVVM NavigationExtensions love</title>
		<link>http://marlongrech.wordpress.com/2011/10/15/more-mefedmvvm-navigationextensions-love/</link>
		<comments>http://marlongrech.wordpress.com/2011/10/15/more-mefedmvvm-navigationextensions-love/#comments</comments>
		<pubDate>Sat, 15 Oct 2011 21:03:17 +0000</pubDate>
		<dc:creator>marlongrech</dc:creator>
				<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">https://marlongrech.wordpress.com/2011/10/15/more-mefedmvvm-navigationextensions-love/</guid>
		<description><![CDATA[One of my colleagues (he is Danish and he is stinky) who has been using MEFedMVVM NavigationExtensions asked to add functionality so that you can Navigate to a View from code. I wanted to be careful adding this feature to make sure the ViewModel stays clean. So lets see what we need to do this [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=marlongrech.wordpress.com&amp;blog=783168&amp;post=553&amp;subd=marlongrech&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>One of my colleagues (he is Danish and he is stinky) who has been using MEFedMVVM NavigationExtensions asked to add functionality so that you can Navigate to a View from code. </p>
<p>I wanted to be careful adding this feature to make sure the ViewModel stays clean. So lets see what we need to do this</p>
<p>Lets first rewind and look at the current <a href="http://marlongrech.wordpress.com/2011/08/27/mefedmvvm-navigationextension/">MEFedMVVM NavigationExtensions</a>… It has 3 Attached properties </p>
<p><img src="http://marlongrech.files.wordpress.com/2011/08/image.png" /></p>
<p>The properties are</p>
<p>- NavigateTo – which is the uri for the view   <br />- NavigationHost – which is the UI element to host the view rendering    <br />- NavigationParameter – which is a parameter to be passed </p>
<p>There is a lot of UI specific stuff in the above so we need to be careful not to make the ViewModel dirty. The ViewModel needs some kind of “UI service “ so that it can ask this service to navigate to a view and pass a parameter (something like the IVisualStateManager of MEFedMVVM); something like this &gt;&gt; <strong><em>Navigate(string viewName, object parameter) . </em></strong>It also need to pass the host so that the NavigationExtensions know where to render this view.</p>
<p>Here is what we came up with .. </p>
<p>As you know (or maybe not, in that case <a href="http://marlongrech.wordpress.com/2010/05/23/mefedmvvm-v1-0-explained/">please read this</a>) MEFedMVVM has support for UI Services, if your service implement IContextAware, MEFedMVVM will inject your service with the View instance that asked for the ViewModel to be injected. We leverage this and have an <strong><em>INavigationInvokerFactory</em></strong>. The INavigationInvokerFactory exposes a method that takes a string which should be the name of the host element. Internally the INavigationInvokerFactory will call the FindName(“[your parameter]”) on the element that was sent by MEFedMVVM IContextAware. The CreateNavigationInvoker method will return an <strong><em>INavigationInvoker </em></strong>which can be used to Navigate to a view.</p>
<p><a href="http://marlongrech.files.wordpress.com/2011/10/image.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="image" border="0" alt="image" src="http://marlongrech.files.wordpress.com/2011/10/image_thumb.png?w=644&#038;h=170" width="644" height="170" /></a></p>
<p>From here you now have an INavigationInvoker and all you have to do is call the Navigate method passing the uri for the View you want to render and the parameter you want to pass</p>
<p><a href="http://marlongrech.files.wordpress.com/2011/10/image1.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="image" border="0" alt="image" src="http://marlongrech.files.wordpress.com/2011/10/image_thumb1.png?w=644&#038;h=133" width="644" height="133" /></a></p>
<p>And that’s all folks… Enjoy <img style="border-style:none;" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://marlongrech.files.wordpress.com/2011/10/wlemoticon-smile.png" /></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/marlongrech.wordpress.com/553/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/marlongrech.wordpress.com/553/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/marlongrech.wordpress.com/553/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/marlongrech.wordpress.com/553/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/marlongrech.wordpress.com/553/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/marlongrech.wordpress.com/553/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/marlongrech.wordpress.com/553/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/marlongrech.wordpress.com/553/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/marlongrech.wordpress.com/553/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/marlongrech.wordpress.com/553/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/marlongrech.wordpress.com/553/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/marlongrech.wordpress.com/553/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/marlongrech.wordpress.com/553/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/marlongrech.wordpress.com/553/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=marlongrech.wordpress.com&amp;blog=783168&amp;post=553&amp;subd=marlongrech&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://marlongrech.wordpress.com/2011/10/15/more-mefedmvvm-navigationextensions-love/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/2011/08/image.png" medium="image" />

		<media:content url="http://marlongrech.files.wordpress.com/2011/10/image_thumb.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://marlongrech.files.wordpress.com/2011/10/image_thumb1.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://marlongrech.files.wordpress.com/2011/10/wlemoticon-smile.png" medium="image">
			<media:title type="html">Smile</media:title>
		</media:content>
	</item>
		<item>
		<title>Windows 8 thoughts after a day at BUILD 2011</title>
		<link>http://marlongrech.wordpress.com/2011/09/15/windows-8-thoughts-after-a-day-at-build-2011/</link>
		<comments>http://marlongrech.wordpress.com/2011/09/15/windows-8-thoughts-after-a-day-at-build-2011/#comments</comments>
		<pubDate>Thu, 15 Sep 2011 02:23:53 +0000</pubDate>
		<dc:creator>marlongrech</dc:creator>
				<category><![CDATA[Windows 8]]></category>
		<category><![CDATA[WinRT]]></category>

		<guid isPermaLink="false">https://marlongrech.wordpress.com/2011/09/15/windows-8-thoughts-after-a-day-at-build-2011/</guid>
		<description><![CDATA[First impression can only be described with one “word”; WOW!!! So Microsoft unveiled how they are planning to change the world. Why such a big statement? Am I exaggerating? I believe I am not. We live in a world of desktops and laptops today; yea we see some tablets that introduce touch but is it [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=marlongrech.wordpress.com&amp;blog=783168&amp;post=543&amp;subd=marlongrech&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>First impression can only be described with one “word”; WOW!!!</p>
<p>So Microsoft unveiled how they are planning to change the world. Why such a big statement? Am I exaggerating? I believe I am not. We live in a world of desktops and laptops today; yea we see some tablets that introduce touch but is it mainstream? are there a replacement to your desktop/laptop? I guess the answer is, No it is not, in order to do such a radical change you need to “push” hardware manufactures into producing these devices mainstream. mmm I wonder who could be that company that can have such an influence? By committing to touch and in fact <strong><em>developing Windows as a touch-first operating system</em></strong>, Microsoft will drive hardware manufactures to give us the touch devices and change how we interact with software today. And yes this is what has been announced at BUILD.</p>
<p>What does touch mean to us? We need to change our way of looking at software, it will not be OK to just have buttons and textboxes; it will not be ok to press a button and your app stalls. Touch is a much more direct way for a user to interact with your application and if one disregards this then that application is destined for failure. I really enjoyed the keynote session from Jensen Harris. He talked about the user experience and how us developers have to embrace the new ideas and concepts coming with Metro style apps. He talked about how <strong><em>Windows 8 is alive, how Windows 8 is personal</em></strong>. These 2 factors create (and yes you might think I am crazy but still I will say it) an intimate relation between you and your device. Windows 8 gives you that “home” \ “friend” sort of feel.</p>
<p>Jensen also made a very good point about apps. Without apps what is Windows 8? without apps there would be no tiles, no tiles empty OS. Even when you look at Metro style apps, you can see how Windows is all about apps… Apps are now chrome-less, your app uses the stage that Windows 8 provides; your app is now the centre of attraction. Windows 8 will also introduce an App Store, this will make your application easier to be discovered and installed by users. App store is probably one of the biggest opportunities for us developers because it gives us a reach of millions of people that will be running Windows 8.</p>
<p>Ok so lets see at what we have till now… We have | 1. a new OS | 2. which is touch first | 3. and will bring new hardware | 4. and amazing new apps</p>
<p>This is all awesome, but let’s not miss the number 1. Its a new OS and with Windows 8 besides many new features (and yes there are many), new concepts are born. Features are very important but concepts are what really change how Windows 8 differentiate itself from other OSs.</p>
<p>One of the concepts Windows 8 brings is Contracts. These are different ways how you application can contribute to Windows; its a way how Windows opens up and let third party applications interact with each other. Some examples of contracts are the Picker contract, Search contract and Share contract.</p>
<p><strong>Picker Contract</strong> is a way how you can register your app with Windows and start exposing your data to other applications to consume.</p>
<p><img src="http://betanews.com/wp-content/uploads/2011/09/picker1.jpg" alt="" /></p>
<p>If your application implements the Picker contract whenever an open file dialog is started the user can choose files from your application just like it can choose a file from the hard disk. So for example facebook could have an app that implements the Picker contract and any other application / the user can pick a file from facebook just like it can pick a file from the file system.</p>
<p><strong>Search Contract</strong> is a way how you can expose your data via the Search charm (charms are the right hand menu items in windows). If you implement the Search Contract then whenever the user executes a search from the search charm your app will be invoked to contribute to the search results. Think of this as 1 standard way how the user can search.</p>
<p><img src="http://cdn1.afterdawn.fi/storage/pictures/1024/16-Windows_BUILD_conference_Search_Apps.jpg" alt="" width="600" height="375" /></p>
<p><strong>Share Contract </strong>is a way how you can share a piece of information from your application to another application. The application exposing the info would be the source and the application consuming the info would be the target. Imagine the share contract (which is a charm just like search contract) as a sophisticated clipboard. So for example let’s say you are in Paint and you draw something, if paint implements the source share contract it can expose the image you drew. The user can then click the Share charm and all apps that implement the target Share contract can use that data. Just like the screen shot below.</p>
<p><img src="http://images.scribblelive.com/2011/9/13/7333b9df-cbea-40d7-9c3d-9cca7824fdd1.jpg" alt="" /></p>
<p>My personal favourites are the share and the picker because those 2 just add so much to Windows applications…. With these charms we can have applications that reuse each other and that can efficiently interact which each other seamlessly.</p>
<p>Besides these there are tons and tones of other features, not to mention tiles, notifications, surprisingly enough keyboard shortcuts, and many more…</p>
<p>Last but not least what about us developers? What is this <strong>new Windows Runtime</strong> everyone is talking about?<br />
Well in this blog post I will not do a deep dive but here is a summary. Windows Runtime (or as they call it WinRT). WinRT is the API for Windows Metro Style application (aka Immersive apps). WinRT will support</p>
<p>XAML UI definition<br />
- with C# / VB.Net<br />
- with C++</p>
<p>OR</p>
<p>HTML (with some custom attributes) UI definition<br />
- with Javascript</p>
<p><a href="http://marlongrech.files.wordpress.com/2011/09/winrt.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border:0;" title="WinRT" src="http://marlongrech.files.wordpress.com/2011/09/winrt_thumb.png?w=454&#038;h=261" alt="WinRT" width="454" height="261" border="0" /></a></p>
<p>WinRT is written in native code but it exposes the API with metadata files (under C:\windows\system32\WinMetadata) which is very similar to MSIL (in fact you can open these files in ILDASM) so that it can project the APIs to the other languages i.e. JS, C# and C++. Each language has a different runtime so C# still has a CLR running and JS has a runtime that I forgot its name, I think its WinJS  <img class="wlEmoticon wlEmoticon-smile" style="border-style:none;" src="http://marlongrech.files.wordpress.com/2011/09/wlemoticon-smile.png" alt="Smile" /> You can also expose libraries to WinRT so that they can be consumed by another language (there is a new output type just like Class library but called MD library). For example you write a library in C++ and it can be consumed by C# or vice versa (or even JS). There are some rules for doing this such as collections must be of type IList&lt;T&gt; (in C#) etc…</p>
<p>WinRT is all about performance and making apps “fast and fluid”. In fact most of the WinRT API are expose Async. WinRT does not use GDI, it only uses DirectX for rendering.</p>
<p>All in all WinRT is something impressive, its what we UI developers where waiting for to build the next generation of applications… I will deep dive in WinRT very soon so stay tuned <img class="wlEmoticon wlEmoticon-smile" style="border-style:none;" src="http://marlongrech.files.wordpress.com/2011/09/wlemoticon-smile.png" alt="Smile" /></p>
<p><strong>Conclusion</strong></p>
<p>So what is really coming at out?? its not just another version of Windows, Its new hardware, New way of interacting with devices, a whole new set of amazing apps. For me, yes, that is enough to say, Windows 8 changes everything!</p>
<br /> Tagged: <a href='http://marlongrech.wordpress.com/tag/winrt/'>WinRT</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/marlongrech.wordpress.com/543/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/marlongrech.wordpress.com/543/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/marlongrech.wordpress.com/543/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/marlongrech.wordpress.com/543/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/marlongrech.wordpress.com/543/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/marlongrech.wordpress.com/543/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/marlongrech.wordpress.com/543/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/marlongrech.wordpress.com/543/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/marlongrech.wordpress.com/543/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/marlongrech.wordpress.com/543/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/marlongrech.wordpress.com/543/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/marlongrech.wordpress.com/543/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/marlongrech.wordpress.com/543/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/marlongrech.wordpress.com/543/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=marlongrech.wordpress.com&amp;blog=783168&amp;post=543&amp;subd=marlongrech&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://marlongrech.wordpress.com/2011/09/15/windows-8-thoughts-after-a-day-at-build-2011/feed/</wfw:commentRss>
		<slash:comments>12</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://betanews.com/wp-content/uploads/2011/09/picker1.jpg" medium="image" />

		<media:content url="http://cdn1.afterdawn.fi/storage/pictures/1024/16-Windows_BUILD_conference_Search_Apps.jpg" medium="image" />

		<media:content url="http://images.scribblelive.com/2011/9/13/7333b9df-cbea-40d7-9c3d-9cca7824fdd1.jpg" medium="image" />

		<media:content url="http://marlongrech.files.wordpress.com/2011/09/winrt_thumb.png" medium="image">
			<media:title type="html">WinRT</media:title>
		</media:content>

		<media:content url="http://marlongrech.files.wordpress.com/2011/09/wlemoticon-smile.png" medium="image">
			<media:title type="html">Smile</media:title>
		</media:content>

		<media:content url="http://marlongrech.files.wordpress.com/2011/09/wlemoticon-smile.png" medium="image">
			<media:title type="html">Smile</media:title>
		</media:content>
	</item>
		<item>
		<title>MEFedMVVM NavigationExtension</title>
		<link>http://marlongrech.wordpress.com/2011/08/27/mefedmvvm-navigationextension/</link>
		<comments>http://marlongrech.wordpress.com/2011/08/27/mefedmvvm-navigationextension/#comments</comments>
		<pubDate>Sat, 27 Aug 2011 10:30:14 +0000</pubDate>
		<dc:creator>marlongrech</dc:creator>
				<category><![CDATA[MEF]]></category>
		<category><![CDATA[MEFedMVVM]]></category>
		<category><![CDATA[mvvm]]></category>
		<category><![CDATA[silverlight]]></category>
		<category><![CDATA[tips and tricks]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">https://marlongrech.wordpress.com/2011/08/27/mefedmvvm-navigationextension/</guid>
		<description><![CDATA[Introduction Most of the MEFedMVVM features so far were all around discoverability of ViewModels, yet when building MVVM application sometimes you want to also have a mechanism to discover and launch views. If we look at web development its all about resources sitting on a server and you can launch/load a specific resource via a [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=marlongrech.wordpress.com&amp;blog=783168&amp;post=536&amp;subd=marlongrech&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h2>Introduction</h2>
<p>Most of the MEFedMVVM features so far were all around discoverability of ViewModels, yet when building MVVM application sometimes you want to also have a mechanism to discover and launch views. If we look at web development its all about resources sitting on a server and you can launch/load a specific resource via a URI (Unique Resource Identifier). This mechanism proved to be a very easy and scalable way of locating views and within a Web Page you can link to other pages very easily. When building WPF applications that are purely content based such a mechanism would really come in handy, and if you think about it MEFedMVVM is all about discoverability so why not support this scenario.</p>
<p>Since this is not really part of the core MEFedMVVM I created an extension that you can use to accomplish this, MEFedMVVM NavigationExtension.</p>
<p>MEFedMVVM.NavigationExtension support both WPF and Silverlight 4. </p>
<p>&#160;</p>
<h2>Enter MEFedMVVM Navigation Extensions</h2>
<p>The idea is to be able to specify to a View that it can be located by a unique identifier (a string) and then you can have someway of launching that view and render it in some container/host. Something like this</p>
<p><a href="http://marlongrech.files.wordpress.com/2011/08/image.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="http://marlongrech.files.wordpress.com/2011/08/image_thumb.png?w=640&#038;h=281" width="640" height="281" /></a></p>
<p>And you make the view discoverable by decorating it with this attribute</p>
<p><a href="http://marlongrech.files.wordpress.com/2011/08/image1.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="http://marlongrech.files.wordpress.com/2011/08/image_thumb1.png?w=298&#038;h=54" width="298" height="54" /></a></p>
<p>As you can see in the figure above, there are 3 magic attached properties that are attached to the “Invoker” </p>
<ul>
<li>NavigationExtensions.NavigateTo
<ul>
<li>Specify the unique identifier (string) to locate the view. I use a URI format but you can use whatever you like as long as its unique </li>
</ul>
</li>
<li>NavigationExtensions.NavigationHost
<ul>
<li>Specify where you want the View to be rendered </li>
</ul>
</li>
<li>NavigationExtensions.NavigationParameter
<ul>
<li>Specify a Parameter to be passed to the ViewModel of the View. The reason why the parameter is passed to its ViewModel is because if you are doing MVVM then your View has no need for parameters, its the ViewModel that needs the parameter(after all the ViewModel controls the logic). We will see how you can still cheat and do whatever you like at the end of the day, the parameter can be passed to the View. </li>
</ul>
</li>
</ul>
<p>So one might wonder how will my ViewModel receive the parameter. This is done by your ViewModel being set as DataContext of the View (if you are using MEFedMVVM to link the View to the ViewModel this happens automatically) and also your ViewModel has to implement the INavigationInfoSubscriber interface. This interface defines 1 method OnNavigationChanged which will pass along the parameter and also give you an instance of the INavigationManager responsible for starting the Navigation.</p>
<p><a href="http://marlongrech.files.wordpress.com/2011/08/image2.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="http://marlongrech.files.wordpress.com/2011/08/image_thumb2.png?w=644&#038;h=85" width="644" height="85" /></a></p>
<p>&#160;</p>
<h2>Recap</h2>
<p>So till now we can </p>
<ol>
<li>Make a View discoverable by specifying a Unique Identifier </li>
<li>Specify an Invoker and give it enough information on what to render and where to render it </li>
<li>And also specify a parameter to be passed </li>
</ol>
<p>This pretty much covers the bare basics, let’s get a better understanding of what is a Host and what is an Invoker before we deep dive in more complex scenarios.</p>
<p>&#160;</p>
<h2>Host and Invoker Deep Dive</h2>
<p>When building the NavigationExtensions I wanted to make sure that you can create your own handlers both for Hosts and Invokers, and what is the best way to do so if not with MEF <img style="border-style:none;" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://marlongrech.files.wordpress.com/2011/08/wlemoticon-smile.png" /></p>
<p>There are 2 base classes you need to write in order to create your own handlers.</p>
<ul>
<li>ControlNavigationHost
<ul>
<li>This is to create your own hosting control. Out of the box you get one which is ContentControlNavigationHost (it handles any ContentControl) </li>
</ul>
</li>
<li>ControlNavigationHandler
<ul>
<li>This is to create your own invoker for a control. Out of the box you get one which is the ButtonNavigationHandler (it handles any ButtonBase) </li>
</ul>
</li>
</ul>
<p>The ControlNavigationHost has 4 methods that you need to implement (all method implementation would be usually one liners)</p>
<p><a href="http://marlongrech.files.wordpress.com/2011/08/image3.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="http://marlongrech.files.wordpress.com/2011/08/image_thumb3.png?w=644&#038;h=422" width="644" height="422" /></a></p>
<p>In order to make your own ControlNavigationHost discoverable by the NavigationExtensions simple Export it like this</p>
<p><a href="http://marlongrech.files.wordpress.com/2011/08/image4.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="http://marlongrech.files.wordpress.com/2011/08/image_thumb4.png?w=444&#038;h=55" width="444" height="55" /></a></p>
<p>The ControlNavigationHandler has 3 methods you need to implement </p>
<p><a href="http://marlongrech.files.wordpress.com/2011/08/image5.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="http://marlongrech.files.wordpress.com/2011/08/image_thumb5.png?w=644&#038;h=216" width="644" height="216" /></a></p>
<p>In the implementation you simple have to register to the Event you want and then call the OnEventFired protected method of the base class. here is an example</p>
<p><a href="http://marlongrech.files.wordpress.com/2011/08/image6.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="http://marlongrech.files.wordpress.com/2011/08/image_thumb6.png?w=644&#038;h=191" width="644" height="191" /></a></p>
<p>And again to make the handler discoverable you Export it like so</p>
<p><a href="http://marlongrech.files.wordpress.com/2011/08/image7.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="http://marlongrech.files.wordpress.com/2011/08/image_thumb7.png?w=444&#038;h=77" width="444" height="77" /></a></p>
<p><strong><em>Please note: that its up to you how you want the creation policy to be (i.e. If MEF should create a new instance of the NavigationHandler or not but in this case you should always make it NonShared so that for each invoker in your application you have a different ControlNavigationHandler instance)</em></strong></p>
<p><strong><em></em></strong></p>
<h2>Apps are usually more complicated, so let’s dive into more complicated scenarios</h2>
<p>Before we start going through these scenarios let’s have a look at some interfaces and classes that MEFedMVVM exposes for you to consume/implement</p>
<h3><font size="3">INavigationManager</font>&#160;</h3>
<p><a href="http://marlongrech.files.wordpress.com/2011/08/image8.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="http://marlongrech.files.wordpress.com/2011/08/image_thumb8.png?w=644&#038;h=308" width="644" height="308" /></a></p>
<h3>INavigationManagerProvider</h3>
<p>Implement this interface on a class that will be passed as NavigationParameter and you will get injected with a INavigationManager responsible for that Navigation</p>
<p><a href="http://marlongrech.files.wordpress.com/2011/08/image9.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="http://marlongrech.files.wordpress.com/2011/08/image_thumb9.png?w=644&#038;h=201" width="644" height="201" /></a></p>
<h3>INavigationInfoSubscriber</h3>
<p>Implement this interface in your ViewModel to get passed the NavigationParameter.</p>
<p><a href="http://marlongrech.files.wordpress.com/2011/08/image10.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="http://marlongrech.files.wordpress.com/2011/08/image_thumb10.png?w=644&#038;h=188" width="644" height="188" /></a></p>
<h3>NavigationCommand&lt;T&gt;</h3>
<p>A NavigationCommand is just a DelegateCommand&lt;T&gt; BUT it implements the INavigationManagerProvider interface. When used as a NavigationParameter it will hold the instance of the INavigationManager so that you can do things such as Closing a navigation. We will see the NavigationCommand&lt;T&gt; being used in the first scenario below.</p>
<p>&#160;</p>
<h3>Scenario 1</h3>
<p>Let’s say you have a dialog that shows some settings and when you are done you want to get those settings back to the original ViewModel that “started” the navigation to the Settings screen. Here are a couple of screen shots for such a scenario.</p>
<p><a href="http://marlongrech.files.wordpress.com/2011/08/image11.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="http://marlongrech.files.wordpress.com/2011/08/image_thumb11.png?w=644&#038;h=450" width="644" height="450" /></a></p>
<p>In order to do this we need the MainViewModel to expose a NavigationCommand&lt;T&gt; </p>
<p><a href="http://marlongrech.files.wordpress.com/2011/08/image12.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="http://marlongrech.files.wordpress.com/2011/08/image_thumb12.png?w=444&#038;h=24" width="444" height="24" /></a></p>
<p>and the Execute handler for this would be something like this</p>
<p><a href="http://marlongrech.files.wordpress.com/2011/08/image13.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="http://marlongrech.files.wordpress.com/2011/08/image_thumb13.png?w=444&#038;h=90" width="444" height="90" /></a></p>
<p>We will revisit the code inside the Execute Handler in a bit**… </p>
<p>Now we can specify that the NavigationParameter is this command so that the SettingsViewModel can execute this command when it is done and give us the ApplicationSettings object instance.</p>
<p><a href="http://marlongrech.files.wordpress.com/2011/08/image14.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="http://marlongrech.files.wordpress.com/2011/08/image_thumb14.png?w=444&#038;h=57" width="444" height="57" /></a></p>
<p>The Settings ViewModel implements the INavigationInfoSubscriber thus it will get injected with the NavigationCommand that we are passing to it via the NavigationParameter attached property</p>
<p><a href="http://marlongrech.files.wordpress.com/2011/08/image15.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="http://marlongrech.files.wordpress.com/2011/08/image_thumb15.png?w=444&#038;h=90" width="444" height="90" /></a></p>
<p>Once the Settings ViewModel calls the Execute on the _onSettingChangedCommand it will invoke the method inside the MainViewModel (OnSettingChangedExecuted) passing the new ApplicationSettings.</p>
<p>**One thing to note is that the MainViewModel is also calling CloseNavigation on the NavigationManager of the NavigationCommand. This is so that as soon as its done applying the new settings the Settings screen disappears.</p>
<p>Download the sample and play around with it to get a better feel of how this all works together (its under <a href="http://mefedmvvm.codeplex.com/SourceControl/list/changesets">Samples/TestNavigation</a>)</p>
<h3>Scenario 2</h3>
<p>Let’s say you have a sort of Wizard Step by Step UI.</p>
<p><a href="http://marlongrech.files.wordpress.com/2011/08/image16.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="http://marlongrech.files.wordpress.com/2011/08/image_thumb16.png?w=574&#038;h=484" width="574" height="484" /></a></p>
<p>In this case we want to chain the Navigation so that the CreateUserProfileViewModel send the UserProfile not to the MainViewModel (the ViewModel that started the Navigation) but to the ViewModel next in the chain i.e. the RenderUserProfileViewModel.</p>
<p>In order to do so both “Invokers” (i.e. the button for the CreateUserProfile and the button for the RenderUserProfile) must have the same navigation “invoker”. You do so by explicitly setting the NavigationHander attached property (this is an attached property that exposes the Navigation handler for an “invoker”).</p>
<p><a href="http://marlongrech.files.wordpress.com/2011/08/image17.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="http://marlongrech.files.wordpress.com/2011/08/image_thumb17.png?w=644&#038;h=267" width="644" height="267" /></a></p>
<p>Ok so now we have both “invokers” using the same NavigationHandler; because of this we can register to the NavigatingAway event of the INavigationManager inside the CreateProfileViewModel and pass the data we want to the RenderUserProfileViewModel (which is the NewNavigationInfoSubsciber in the NavigationEventArgs passed by the event)</p>
<p><a href="http://marlongrech.files.wordpress.com/2011/08/image18.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="http://marlongrech.files.wordpress.com/2011/08/image_thumb18.png?w=644&#038;h=403" width="644" height="403" /></a></p>
<p>So basically the CreateUserProfileViewModel (Step 1) could pass along data to RenderUserProfileViewModel (Step 2) and you can continue chaining like this one step after another.</p>
<p><strong><em>NOTE: For Silverlight you instead of using the NavigationExtensions.NavigationHandler use the NavigationExtensions.ChainToElement and specify the other button (this is because there are issues around binding to custom attached properties in SL). This approach can also be used in WPF.</em></strong></p>
<p><a href="http://marlongrech.files.wordpress.com/2011/08/image19.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="image" border="0" alt="image" src="http://marlongrech.files.wordpress.com/2011/08/image_thumb19.png?w=644&#038;h=75" width="644" height="75" /></a></p>
<p>&#160;</p>
<p>Download the sample and play around with it to get a better feel of how this all works together (its under <a href="http://mefedmvvm.codeplex.com/SourceControl/list/changesets">Samples/TestNavigation</a>)</p>
<h2>Conclusion</h2>
<p>One thing I love about this Extension is that it enables you to use View-First approach to MVVM in nearly any scenario. Yes granted sometimes its better to have ViewModel-First approach but in my experience if you can always work using View-First life becomes much more easy because your code is more loosely coupled. In fact this is one of the things I love about MVC and Web in general… Controllers never reference each other, A View has a controller and thats it. In MVVM we tend to complicate things by having Parent ViewModels that have Child ViewModels yada yada yada… just my 2 cents… </p>
<p>This is all still work in progress, it needs more testing from my end to make sure there are no side effects such as memory leaks etc yet feel free to poke around and play around with it. As always feedback/bug reports are very welcome.</p>
<p>Download the code from <a href="http://mefedmvvm.codeplex.com/SourceControl/list/changesets">http://mefedmvvm.codeplex.com/SourceControl/list/changesets</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/marlongrech.wordpress.com/536/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/marlongrech.wordpress.com/536/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/marlongrech.wordpress.com/536/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/marlongrech.wordpress.com/536/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/marlongrech.wordpress.com/536/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/marlongrech.wordpress.com/536/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/marlongrech.wordpress.com/536/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/marlongrech.wordpress.com/536/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/marlongrech.wordpress.com/536/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/marlongrech.wordpress.com/536/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/marlongrech.wordpress.com/536/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/marlongrech.wordpress.com/536/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/marlongrech.wordpress.com/536/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/marlongrech.wordpress.com/536/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=marlongrech.wordpress.com&amp;blog=783168&amp;post=536&amp;subd=marlongrech&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://marlongrech.wordpress.com/2011/08/27/mefedmvvm-navigationextension/feed/</wfw:commentRss>
		<slash:comments>8</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/2011/08/image_thumb.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://marlongrech.files.wordpress.com/2011/08/image_thumb1.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://marlongrech.files.wordpress.com/2011/08/image_thumb2.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://marlongrech.files.wordpress.com/2011/08/wlemoticon-smile.png" medium="image">
			<media:title type="html">Smile</media:title>
		</media:content>

		<media:content url="http://marlongrech.files.wordpress.com/2011/08/image_thumb3.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://marlongrech.files.wordpress.com/2011/08/image_thumb4.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://marlongrech.files.wordpress.com/2011/08/image_thumb5.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://marlongrech.files.wordpress.com/2011/08/image_thumb6.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://marlongrech.files.wordpress.com/2011/08/image_thumb7.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://marlongrech.files.wordpress.com/2011/08/image_thumb8.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://marlongrech.files.wordpress.com/2011/08/image_thumb9.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://marlongrech.files.wordpress.com/2011/08/image_thumb10.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://marlongrech.files.wordpress.com/2011/08/image_thumb11.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://marlongrech.files.wordpress.com/2011/08/image_thumb12.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://marlongrech.files.wordpress.com/2011/08/image_thumb13.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://marlongrech.files.wordpress.com/2011/08/image_thumb14.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://marlongrech.files.wordpress.com/2011/08/image_thumb15.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://marlongrech.files.wordpress.com/2011/08/image_thumb16.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://marlongrech.files.wordpress.com/2011/08/image_thumb17.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://marlongrech.files.wordpress.com/2011/08/image_thumb18.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://marlongrech.files.wordpress.com/2011/08/image_thumb19.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>Mole a debug tool that rocks your world!</title>
		<link>http://marlongrech.wordpress.com/2011/03/01/mole-a-debug-tool-that-rocks-your-world/</link>
		<comments>http://marlongrech.wordpress.com/2011/03/01/mole-a-debug-tool-that-rocks-your-world/#comments</comments>
		<pubDate>Tue, 01 Mar 2011 14:08:46 +0000</pubDate>
		<dc:creator>marlongrech</dc:creator>
				<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">https://marlongrech.wordpress.com/2011/03/01/mole-a-debug-tool-that-rocks-your-world/</guid>
		<description><![CDATA[If you never tried it, then my question is how do you live with yourself &#160;Mole is an awesome debug visualizer which you can use inspect any .Net object while you are debugging. Mole also have some really cool WPF only features such as Visual tree and Logical tree visualization. You can search for a [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=marlongrech.wordpress.com&amp;blog=783168&amp;post=491&amp;subd=marlongrech&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>If you never tried it, then my question is how do you live with yourself <img style="border-style:none;" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://marlongrech.files.wordpress.com/2011/03/wlemoticon-smile.png" />&#160;<a href="http://www.molosoft.com/">Mole</a> is an awesome debug visualizer which you can use inspect any .Net object while you are debugging. </p>
<p>Mole also have some really cool WPF only features such as Visual tree and Logical tree visualization. You can search for a specific object in the object graph… I am not gonna say much more because all this info is already on the <a href="http://www.molosoft.com/">Mole site</a>. Go and have a go with it….</p>
<p>Once you go Mole you never go back <img style="border-style:none;" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://marlongrech.files.wordpress.com/2011/03/wlemoticon-smile.png" /></p>
<p><a href="http://www.molosoft.com/">http://www.molosoft.com/</a></p>
<p><img alt="Mole 2010 by Molosoft" src="http://www.molosoft.com/wp-content/uploads/2010/11/moleminilogo3.png" /></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/marlongrech.wordpress.com/491/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/marlongrech.wordpress.com/491/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/marlongrech.wordpress.com/491/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/marlongrech.wordpress.com/491/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/marlongrech.wordpress.com/491/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/marlongrech.wordpress.com/491/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/marlongrech.wordpress.com/491/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/marlongrech.wordpress.com/491/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/marlongrech.wordpress.com/491/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/marlongrech.wordpress.com/491/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/marlongrech.wordpress.com/491/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/marlongrech.wordpress.com/491/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/marlongrech.wordpress.com/491/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/marlongrech.wordpress.com/491/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=marlongrech.wordpress.com&amp;blog=783168&amp;post=491&amp;subd=marlongrech&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://marlongrech.wordpress.com/2011/03/01/mole-a-debug-tool-that-rocks-your-world/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/2011/03/wlemoticon-smile.png" medium="image">
			<media:title type="html">Smile</media:title>
		</media:content>

		<media:content url="http://marlongrech.files.wordpress.com/2011/03/wlemoticon-smile.png" medium="image">
			<media:title type="html">Smile</media:title>
		</media:content>

		<media:content url="http://www.molosoft.com/wp-content/uploads/2010/11/moleminilogo3.png" medium="image">
			<media:title type="html">Mole 2010 by Molosoft</media:title>
		</media:content>
	</item>
		<item>
		<title>ICommand discovery with MEF</title>
		<link>http://marlongrech.wordpress.com/2011/02/17/icommand-discovery-with-mef/</link>
		<comments>http://marlongrech.wordpress.com/2011/02/17/icommand-discovery-with-mef/#comments</comments>
		<pubDate>Thu, 17 Feb 2011 12:13:01 +0000</pubDate>
		<dc:creator>marlongrech</dc:creator>
				<category><![CDATA[MEF]]></category>
		<category><![CDATA[MEFedMVVM]]></category>
		<category><![CDATA[mvvm]]></category>
		<category><![CDATA[tips and tricks]]></category>

		<guid isPermaLink="false">https://marlongrech.wordpress.com/2011/02/17/icommand-discovery-with-mef/</guid>
		<description><![CDATA[Sometimes you are in ViewModel X and you want to execute a command on ViewModel Y. You do not want to link the 2 because of some constrains that that might impose. How can you leverage MEFs capabilities to overcome such a situation? Easy have the ViewModel Y expose the command as a property just [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=marlongrech.wordpress.com&amp;blog=783168&amp;post=489&amp;subd=marlongrech&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Sometimes you are in ViewModel X and you want to execute a command on ViewModel Y. You do not want to link the 2 because of some constrains that that might impose. How can you leverage MEFs capabilities to overcome such a situation?</p>
<p>Easy have the ViewModel Y expose the command as a property just like you would have it for binding from the View, but also add an Export attribute on the property and give it a name</p>
<p><a href="http://marlongrech.files.wordpress.com/2011/02/image.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="image" border="0" alt="image" src="http://marlongrech.files.wordpress.com/2011/02/image_thumb.png?w=388&#038;h=55" width="388" height="55" /></a></p>
<p>&#160;</p>
<p>Now from ViewModel X simple imports the ICommand by specifying that same name (yes you can have the string as a constant, also I would advice to use constants to avoid conflicts in strings)</p>
<p><a href="http://marlongrech.files.wordpress.com/2011/02/image1.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="image" border="0" alt="image" src="http://marlongrech.files.wordpress.com/2011/02/image_thumb1.png?w=386&#038;h=42" width="386" height="42" /></a></p>
<p>&#160;</p>
<p>MEF will automatically get the command from ViewModel Y into ViewModel X for you. This works very nicely with <a href="http://mefedmvvm.codeplex.com/">MEFedMVVM</a> since <a href="http://mefedmvvm.codeplex.com/">MEFedMVVM</a> resolves all ViewModels via MEF thus you do not need to do anything to resolve the ViewModel or anything. You simply decorate the properties for Export and Import and viola you can start drinking beer <img style="border-style:none;" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://marlongrech.files.wordpress.com/2011/02/wlemoticon-smile.png" /></p>
<p>Happy coding <img style="border-style:none;" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://marlongrech.files.wordpress.com/2011/02/wlemoticon-smile.png" /></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/marlongrech.wordpress.com/489/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/marlongrech.wordpress.com/489/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/marlongrech.wordpress.com/489/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/marlongrech.wordpress.com/489/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/marlongrech.wordpress.com/489/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/marlongrech.wordpress.com/489/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/marlongrech.wordpress.com/489/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/marlongrech.wordpress.com/489/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/marlongrech.wordpress.com/489/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/marlongrech.wordpress.com/489/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/marlongrech.wordpress.com/489/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/marlongrech.wordpress.com/489/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/marlongrech.wordpress.com/489/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/marlongrech.wordpress.com/489/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=marlongrech.wordpress.com&amp;blog=783168&amp;post=489&amp;subd=marlongrech&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://marlongrech.wordpress.com/2011/02/17/icommand-discovery-with-mef/feed/</wfw:commentRss>
		<slash:comments>5</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/2011/02/image_thumb.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://marlongrech.files.wordpress.com/2011/02/image_thumb1.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://marlongrech.files.wordpress.com/2011/02/wlemoticon-smile.png" medium="image">
			<media:title type="html">Smile</media:title>
		</media:content>

		<media:content url="http://marlongrech.files.wordpress.com/2011/02/wlemoticon-smile.png" medium="image">
			<media:title type="html">Smile</media:title>
		</media:content>
	</item>
	</channel>
</rss>
