<?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>{Coding Context}</title>
	<atom:link href="http://codingcontext.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://codingcontext.wordpress.com</link>
	<description>con·text: The circumstances or facts regarding a particular event or situation</description>
	<lastBuildDate>Fri, 17 Jun 2011 03:14:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='codingcontext.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>{Coding Context}</title>
		<link>http://codingcontext.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://codingcontext.wordpress.com/osd.xml" title="{Coding Context}" />
	<atom:link rel='hub' href='http://codingcontext.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Implementing OpenId with ASP.Net MVC</title>
		<link>http://codingcontext.wordpress.com/2009/01/16/implementing-openid-with-aspnet-mvc/</link>
		<comments>http://codingcontext.wordpress.com/2009/01/16/implementing-openid-with-aspnet-mvc/#comments</comments>
		<pubDate>Fri, 16 Jan 2009 05:47:42 +0000</pubDate>
		<dc:creator>micahlmartin</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[Databinding]]></category>
		<category><![CDATA[ASP.Net]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[MVC]]></category>

		<guid isPermaLink="false">http://codingcontext.wordpress.com/?p=214</guid>
		<description><![CDATA[OpenId is awesome. I first discovered it when I started using StackOverflow.com. OpenId allows users to create a single account that they can use to login to any website that accepts it. All the user has to do is create an account with an OpenId provider (I happen to use www.myopenid.com). The nice thing about [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codingcontext.wordpress.com&amp;blog=4523479&amp;post=214&amp;subd=codingcontext&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>OpenId is awesome. I first discovered it when I started using <a href="http://www.stackoverflow.com">StackOverflow.com</a>. OpenId allows users to create a single account that they can use to login to any website that accepts it. All the user has to do is create an account with an OpenId provider (I happen to use <a href="http://www.myopenid.com">www.myopenid.com</a>). The nice thing about this for developers is that it completely offloads all the managing of users, profiles, passwords, authentication, and other headaches associated with developing a site to someone else.</p>
<p>Here is a <a href="https://rpxnow.com/docs#flow">diagram</a> and an explanation of the sign-in process.</p>
<p><strong>Get a Provider</strong><br />
The first thing you need to do is to setup an account with an OpenId provider. <a href="https://rpxnow.com/">RpxNow</a> has a &#8220;Basic&#8221; package for free that has everything you need to get started. They also allow users to sign-in using their existing accounts fomr places like Facebook, AOL, Google, and several others. This is awesome if you don&#8217;t want your users to deal with the hassles of createing <em>yet another account</em>.</p>
<p><strong>Add a Login Link</strong><br />
Now we need to provide a link to allow the user to sign-in to our site. Add the following code in the &lt;Head&gt; section of your page.<br />
<code><br />
&lt;script src="https://rpxnow.com/openid/v2/widget" type="text/javascript"&gt;&lt;/script&gt;<br />
&lt;script type="text/javascript"&gt;<br />
&lt;!--<br />
        RPXNOW.token_url = "http://mydomain.com/Account/Login";<br />
        RPXNOW.realm = "myRpxAccountName";<br />
        RPXNOW.overlay = true;<br />
// --&gt;<br />
&lt;/script&gt;</code></p>
<p>Then add the Login link to your page:<br />
<code><br />
&lt;a class="rpxnow" onclick="return false;" href="https://myRpxAccountName.rpxnow.com/openid/v2/signin?http://mydomain.com/Account/Login"&gt;Login&lt;/a&gt;</code></p>
<p>A couple of things to note here. The &#8220;myRpxAccountName&#8221; is the developer account you get when you register with RpxNow, and the &#8220;http://mydomain.com/Account/Login&#8221; link is where the authentication token gets sent (you&#8217;ll see this part below). Also, the only thing really needed for the link to work is for it to have a the &#8220;rpxnow&#8221; class assigned to it.</p>
<p><strong>Setup Controller Action</strong><br />
Once the user logs in through they&#8217;re OpenId provider we get an authentication token returned to us. It gets sent to the &#8220;http://mydomain.com/Account/Login&#8221; link we specified above. Using the &#8220;Default&#8221; routing of {controller}/{action}/{id} we can setup our controller like this:</p>
<pre><code>
public class AccountController : Controller
{
     // Matches http://mydomain.com/account/login
     public ActionResult Login(string token)
    {

    }
}
</code></pre>
<p><strong>Get User Information</strong><br />
The most complicated part of the process is sending the token to the Rpx Webservice and getting the user profile information back. The good news is they give us the code to help use get started. I&#8217;ve modified the code slightly which you can download at the end of this post.<br />
<code><br />
public ActionResult Login(string token)<br />
{<br />
     XElement profile = Rpx.GetProfileData(token);</code><code><br />
    /* Example of returned data.<br />
    &lt;rsp stat="ok"&gt;<br />
      &lt;profile&gt;<br />
        &lt;displayName&gt;Micah&lt;/displayName&gt;<br />
        &lt;identifier&gt;<br />
           http://micahlmartin.myopenid.com/<br />
        &lt;/identifier&gt;<br />
        &lt;name&gt;<br />
          &lt;givenName&gt;Micah&lt;/givenName&gt;<br />
          &lt;familyName&gt;Martin&lt;/familyName&gt;<br />
          &lt;formatted&gt;Micah Martin&lt;/formatted&gt;<br />
        &lt;/name&gt;<br />
        &lt;preferredUsername&gt;<br />
          </code><code>micahlmartin<br />
        &lt;/preferredUsername&gt;<br />
        &lt;url&gt;http://micahlmartin.myopenid.com/&lt;/url&gt;<br />
      &lt;/profile&gt;<br />
    &lt;/rsp&gt;*/<br />
    </code><code><br />
    //Determine if user is new and if so then create<br />
    //a new record in the database and map the recordId<br />
    //to the openId<br />
    if(UserIsNew)<br />
       Rpx.Map(openId, userId);</code></p>
<pre><code>    //Login user
    FormsAuth.SetAuthCookie(username, rememberMe);
    return RedirectToAction("Index", "Home");</code><code>
}</code></pre>
<p>Essentially what happens here is we call into the Rpx webservice and get the profile data back. You then determine if the user already exists in the database. If not then create a new record and pass the new record Id along with the OpenId (in my case http://micahlmartin.myopenid.com/) into the Rpx.Map function. Now all future login requests for the user will contain a <code>&lt;primaryKey&gt;</code> node with recordId of the user. Last thing to do is just call a FormsAuth function to finish the login.</p>
<p><strong>Conclusion<br />
</strong>All told it probably took less than 45 minutes to get it implemented. The longest part was understanding the work flow, and even that wasn&#8217;t bad. I hope this has been helpful. You can download the Rpx class file <a href='http://codingcontext.files.wordpress.com/2009/01/rpx1.doc'>Here</a> Rpx. You will need to rename it from .doc to .cs. </p>
<p><a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fcodingcontext.wordpress.com%2f2009%2f01%2f16%2fimplementing-openid-with-aspnet-mvc%2f"><img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fcodingcontext.wordpress.com%2f2009%2f01%2f16%2fimplementing-openid-with-aspnet-mvc%2f" border="0" alt="kick it on DotNetKicks.com" /></a></p>
<br />Posted in .Net, Databinding Tagged: .Net, ASP.Net, C#, MVC <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codingcontext.wordpress.com/214/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codingcontext.wordpress.com/214/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codingcontext.wordpress.com/214/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codingcontext.wordpress.com/214/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codingcontext.wordpress.com/214/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codingcontext.wordpress.com/214/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codingcontext.wordpress.com/214/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codingcontext.wordpress.com/214/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codingcontext.wordpress.com/214/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codingcontext.wordpress.com/214/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codingcontext.wordpress.com/214/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codingcontext.wordpress.com/214/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codingcontext.wordpress.com/214/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codingcontext.wordpress.com/214/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codingcontext.wordpress.com&amp;blog=4523479&amp;post=214&amp;subd=codingcontext&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codingcontext.wordpress.com/2009/01/16/implementing-openid-with-aspnet-mvc/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c23b963563e43954c912c41335411916?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=PG" medium="image">
			<media:title type="html">Micah</media:title>
		</media:content>

		<media:content url="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fcodingcontext.wordpress.com%2f2009%2f01%2f16%2fimplementing-openid-with-aspnet-mvc%2f" medium="image">
			<media:title type="html">kick it on DotNetKicks.com</media:title>
		</media:content>
	</item>
		<item>
		<title>Model-View-ModelController &#8211; My take on MVVM &#8211; Introduction</title>
		<link>http://codingcontext.wordpress.com/2009/01/09/model-view-modelcontroller-my-take-on-mvvm-introduction/</link>
		<comments>http://codingcontext.wordpress.com/2009/01/09/model-view-modelcontroller-my-take-on-mvvm-introduction/#comments</comments>
		<pubDate>Fri, 09 Jan 2009 18:18:30 +0000</pubDate>
		<dc:creator>micahlmartin</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[MVMC]]></category>
		<category><![CDATA[MVVM]]></category>
		<category><![CDATA[LOB]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://codingcontext.wordpress.com/?p=194</guid>
		<description><![CDATA[I&#8217;ve seen a lot of examples from guys like Josh Smith and Karl Shifflett on best practices for using MVVM (Model-View-ViewModel). These are really great examples, but I have yet to find anyone doing real-world development in WPF on a LOB (line of business) application applying these principles. I&#8217;m currently in development on a very [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codingcontext.wordpress.com&amp;blog=4523479&amp;post=194&amp;subd=codingcontext&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve seen a lot of examples from guys like <a href="http://joshsmithonwpf.wordpress.com/">Josh Smith</a> and <a href="http://karlshifflett.wordpress.com/">Karl Shifflett</a> on best practices for using MVVM (Model-View-ViewModel). These are really great examples, but I have yet to find anyone doing <em>real-world</em> development in WPF on a LOB (line of business) application applying these principles.</p>
<p>I&#8217;m currently in development on a very large application and I will be writing a series of articles on the structure in which it is built including what I am calling Model-View-ModelController; a cross between MVVM and MVC. They obviously won&#8217;t entail any of the business specifics, but I want to demonstrate some of the patterns I am using to both give ideas to anyone struggling with the same issues I have and to also learn more through feedback from the community. Any and all feedback will be much appreciated.</p>
<p>The technologies I will be focusing on are WPF, and Linq-To-Sql. A few of the tenets I will be focusing on are</p>
<ul>
<li><em>Views </em>Instantiate the <em>ModelControllers</em>, and other <em>Views</em></li>
<li><em>ModelControllers </em>know NOTHING about the <em>Views</em></li>
<li><em>ModelControllers </em>instantiate <em>Models </em>and other <em>ModelControllers</em></li>
<li><em>Models </em>are simply DTO objects and have no knowledge of the existence of anything other than related <em>Models</em></li>
</ul>
<p><a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fcodingcontext.wordpress.com%2f2009%2f01%2f09%2fmodel-view-modelcontroller-my-take-on-mvvm-introduction%2f"><img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fcodingcontext.wordpress.com%2f2009%2f01%2f09%2fmodel-view-modelcontroller-my-take-on-mvvm-introduction%2f" border="0" alt="kick it on DotNetKicks.com" /></a></p>
<br />Posted in .Net, MVMC, MVVM Tagged: LOB, MVMC, MVVM, WPF <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codingcontext.wordpress.com/194/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codingcontext.wordpress.com/194/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codingcontext.wordpress.com/194/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codingcontext.wordpress.com/194/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codingcontext.wordpress.com/194/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codingcontext.wordpress.com/194/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codingcontext.wordpress.com/194/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codingcontext.wordpress.com/194/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codingcontext.wordpress.com/194/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codingcontext.wordpress.com/194/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codingcontext.wordpress.com/194/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codingcontext.wordpress.com/194/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codingcontext.wordpress.com/194/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codingcontext.wordpress.com/194/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codingcontext.wordpress.com&amp;blog=4523479&amp;post=194&amp;subd=codingcontext&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codingcontext.wordpress.com/2009/01/09/model-view-modelcontroller-my-take-on-mvvm-introduction/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c23b963563e43954c912c41335411916?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=PG" medium="image">
			<media:title type="html">Micah</media:title>
		</media:content>

		<media:content url="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fcodingcontext.wordpress.com%2f2009%2f01%2f09%2fmodel-view-modelcontroller-my-take-on-mvvm-introduction%2f" medium="image">
			<media:title type="html">kick it on DotNetKicks.com</media:title>
		</media:content>
	</item>
		<item>
		<title>Solution: Styling a large amount of controls</title>
		<link>http://codingcontext.wordpress.com/2008/12/11/solution-styling-a-large-amount-of-controls/</link>
		<comments>http://codingcontext.wordpress.com/2008/12/11/solution-styling-a-large-amount-of-controls/#comments</comments>
		<pubDate>Thu, 11 Dec 2008 02:35:27 +0000</pubDate>
		<dc:creator>micahlmartin</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[styling]]></category>

		<guid isPermaLink="false">http://codingcontext.wordpress.com/?p=181</guid>
		<description><![CDATA[Using Attached Dependency Properties to apply styles to large amounts of controls.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codingcontext.wordpress.com&amp;blog=4523479&amp;post=181&amp;subd=codingcontext&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m really on this &#8220;Attached Property&#8221; kick. I&#8217;m probably totally over using them, but I think it&#8217;s such a powerful tool when used in the right scenario. I&#8217;m not really sure what the <em>right</em> scenario actually is, but I keep running into situations where to me they just make sense. Also there&#8217;s something about adding behavior to objects without actually inheriting from them that gives me a sense that I&#8217;m doing something really cool, cutting edge, and adventerous&#8230;alright that&#8217;s a little ridiculous. Moving on&#8230;</p>
<p>So I had posted a <a href="http://stackoverflow.com/questions/339710/what-is-the-best-approach-for-applying-styles-to-massive-amounts-of-items">question </a>on <a href="http://www.stackoverflow.com">StackOverflow</a> (by the way this is such an awesome site) and also wrote <a href="http://codingcontext.wordpress.com/2008/12/04/finding-the-best-approach-to-styling-a-lob-app/">here</a> about finding the best approach to applying styles to a large amount of controls. I spent an hour or so on the phone with <a href="http://karlshifflett.wordpress.com/">Karl Shifflett</a> discussing the pro&#8217;s and con&#8217;s of the various approaches to take which I wont re-hash here. I finally landed on this idea that uses my good buddy <a href="http://msdn.microsoft.com/en-us/library/ms597495.aspx">DependencyProperty.RegisterAttached</a>.</p>
<p><strong>Code</strong><br />
What I&#8217;ve done is create 4 styles in a resource dictionary</p>
<ol>
<li>A style for the<span style="color:#3366ff;"> <strong>containing panel</strong></span> (i.e. Grid, StackPanel, etc.)</li>
<li>A style for the<strong> <span style="color:#ff0000;">first item</span></strong>(s)</li>
<li>A style for the <strong>last items</strong>(s)</li>
<li>A style for all the<strong> <span style="color:#339966;">items in between</span></strong></li>
</ol>
<p><a href="http://codingcontext.files.wordpress.com/2008/12/styles121008.jpg"><img class="alignnone size-full wp-image-187" title="styles121008" src="http://codingcontext.files.wordpress.com/2008/12/styles121008.jpg?w=450&#038;h=295" alt="styles121008" width="450" height="295" /></a></p>
<p>The reason I create different styles is that depending on where the object is in the panel I may want to apply more or less margin, or to different amounts on different sides. Obviously this is just one particular scenario, but you get the point. Then I set the the attached property on the containing grid like this (can also be a StackPanel/DockPanel):</p>
<p><code>&lt;Grid local:AttachedProperties.IsStandardContainer="True"&gt;</code></p>
<p>Essentially what the attached property does is iterates through all the children in the Panel and applies one of the specified styles to each element. Care is taken not to override any explicit styles set on any child objects.</p>
<p><a href="http://codingcontext.files.wordpress.com/2008/12/stylingviaattachedpropertysample.doc">Here</a> is a full example including the code for the attached property. Make sure you change the extension from .doc to .zip. </p>
<p><a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fcodingcontext.wordpress.com%2f2008%2f12%2f11%2fsolution-styling-a-large-amount-of-controls%2f"><img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fcodingcontext.wordpress.com%2f2008%2f12%2f11%2fsolution-styling-a-large-amount-of-controls%2f" border="0" alt="kick it on DotNetKicks.com" /></a></p>
<br />Posted in .Net, WPF Tagged: .Net, styling, WPF <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codingcontext.wordpress.com/181/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codingcontext.wordpress.com/181/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codingcontext.wordpress.com/181/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codingcontext.wordpress.com/181/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codingcontext.wordpress.com/181/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codingcontext.wordpress.com/181/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codingcontext.wordpress.com/181/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codingcontext.wordpress.com/181/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codingcontext.wordpress.com/181/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codingcontext.wordpress.com/181/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codingcontext.wordpress.com/181/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codingcontext.wordpress.com/181/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codingcontext.wordpress.com/181/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codingcontext.wordpress.com/181/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codingcontext.wordpress.com&amp;blog=4523479&amp;post=181&amp;subd=codingcontext&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codingcontext.wordpress.com/2008/12/11/solution-styling-a-large-amount-of-controls/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c23b963563e43954c912c41335411916?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=PG" medium="image">
			<media:title type="html">Micah</media:title>
		</media:content>

		<media:content url="http://codingcontext.files.wordpress.com/2008/12/styles121008.jpg" medium="image">
			<media:title type="html">styles121008</media:title>
		</media:content>

		<media:content url="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fcodingcontext.wordpress.com%2f2008%2f12%2f11%2fsolution-styling-a-large-amount-of-controls%2f" medium="image">
			<media:title type="html">kick it on DotNetKicks.com</media:title>
		</media:content>
	</item>
		<item>
		<title>Joel on Software</title>
		<link>http://codingcontext.wordpress.com/2008/12/10/joel-on-software/</link>
		<comments>http://codingcontext.wordpress.com/2008/12/10/joel-on-software/#comments</comments>
		<pubDate>Wed, 10 Dec 2008 04:58:25 +0000</pubDate>
		<dc:creator>micahlmartin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[books]]></category>
		<category><![CDATA[life]]></category>

		<guid isPermaLink="false">http://codingcontext.wordpress.com/?p=166</guid>
		<description><![CDATA[Trying to find something interesting to read other than the typical MSDN mag or a 700+ page manual on the latest Microsoft development platform, I hit my co-worker up for his copy of &#8220;Joel on Software&#8221; (the first one). I&#8217;m only about half-way through it, and it has been incredibly eye-openning and inspiring. I&#8217;ve never [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codingcontext.wordpress.com&amp;blog=4523479&amp;post=166&amp;subd=codingcontext&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Trying to find something interesting to read other than the typical MSDN mag or a 700+ page manual on the latest Microsoft development platform, I hit my co-worker up for his copy of &#8220;Joel on Software&#8221; (the first one). I&#8217;m only about half-way through it, and it has been incredibly eye-openning and inspiring. I&#8217;ve never read any &#8220;technical&#8221; book other than the how-to or programmer-to-programmer types so it&#8217;s been quite a different experience.</p>
<p>There are two main points that really stick out for me in this book:</p>
<ol>
<li>Write specs for everything you have to code (that means <em>before</em> you write the code)</li>
<li>If you are bad at writing, learn to write</li>
</ol>
<p>I think the biggest reason this really sticks out to me is that I hate writing. No&#8230;I <em>loathe</em> writing; and according to Joel one of the key components of running successfull software projects and even being a successfull developer is being able to write specs. </p>
<p>So how do I become a good writer when I hate writing? He suggests writing an essay everyday. It can be on anything. So, that&#8217;s what I&#8217;m setting out to do. I&#8217;m going to try writing an essay every day on something programming related. I&#8217;m hoping to cover everything from coding tips to life experiences learned in the world of coding. Hopefully it will benefit somebody out there, but most importantly, hopefully I&#8217;ll become a better writer, developer, and project manager.</p>
<br />Posted in Uncategorized Tagged: books, life <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codingcontext.wordpress.com/166/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codingcontext.wordpress.com/166/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codingcontext.wordpress.com/166/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codingcontext.wordpress.com/166/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codingcontext.wordpress.com/166/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codingcontext.wordpress.com/166/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codingcontext.wordpress.com/166/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codingcontext.wordpress.com/166/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codingcontext.wordpress.com/166/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codingcontext.wordpress.com/166/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codingcontext.wordpress.com/166/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codingcontext.wordpress.com/166/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codingcontext.wordpress.com/166/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codingcontext.wordpress.com/166/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codingcontext.wordpress.com&amp;blog=4523479&amp;post=166&amp;subd=codingcontext&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codingcontext.wordpress.com/2008/12/10/joel-on-software/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c23b963563e43954c912c41335411916?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=PG" medium="image">
			<media:title type="html">Micah</media:title>
		</media:content>
	</item>
		<item>
		<title>CommandBindings in MVVM</title>
		<link>http://codingcontext.wordpress.com/2008/12/10/commandbindings-in-mvvm/</link>
		<comments>http://codingcontext.wordpress.com/2008/12/10/commandbindings-in-mvvm/#comments</comments>
		<pubDate>Wed, 10 Dec 2008 02:52:53 +0000</pubDate>
		<dc:creator>micahlmartin</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[MVVM]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[Commands]]></category>
		<category><![CDATA[Design Patterns]]></category>

		<guid isPermaLink="false">http://codingcontext.wordpress.com/2008/12/10/commandbindings-in-mvvm/</guid>
		<description><![CDATA[Anyone who has tried to implement RoutedCommands in WPF using M-V-VM has undoubtedly run into issues. Commands (non-UI commands that is) should be implemented in the ViewModel. For instance if I needed to save a CustomerViewModel then I would implement that as a command directly on my CustomerViewModel. However if I wanted to pop up [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codingcontext.wordpress.com&amp;blog=4523479&amp;post=116&amp;subd=codingcontext&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Anyone who has tried to implement RoutedCommands in WPF using M-V-VM has undoubtedly run into issues. Commands (non-UI commands that is) should be implemented in the ViewModel. For instance if I needed to save a CustomerViewModel then I would implement that as a command directly on my CustomerViewModel. However if I wanted to pop up a window to show the users addresses I would implement a ShowCustomerAddress command directly in the view since this a UI specific function.</p>
<p>The problem lies in the way that RoutedCommands find their associated CommandBindings. In order for a command to be executed it has to have a CommandBinding which tells it how to handle the Executed and CanExecute events. When you associate a control with a command it walks up the logical tree to find the first command binding associated with it. A typical scenario would look like this:</p>
<p><code>&lt;UserControl&gt;<br />
&lt;UserControl.CommandBindings&gt;<br />
&lt;CommandBinding Command="ApplicationCommands.Save" CanExecute="Save_CanExecute" Executed="Save_Executed" /&gt;<br />
&lt;/UserControl.CommandBindings&gt;</code></p>
<p>&lt;Button Command=&#8221;ApplicationCommands.Save&#8221; Content=&#8221;Save&#8221; /&gt;<br />
&lt;/UserControl&gt;</p>
<p>This approach forces us to define the behavior of of the command directly in our view, when really that logic should be in the ViewModel. So how do we get the the View to look for the CommandBindings in the ViewModel instead of the baked in behavior of searching up the logical tree? Well, we can&#8217;t. So instead, we need a way to get the CommandBindings out of the ViewModel and into the View. The first thing we need is a CommandBindingCollection property in our ViewModel:</p>
<p><code>private readonly CommandBindingCollection _CommandBindings;<br />
public CommandBindingCollection CommandBindings<br />
{<br />
   get<br />
   {<br />
      return _CommandBindings;<br />
   }<br />
}</code></p>
<p>Now we create our CommandBindings and add them to the CommandBinding property we created:</p>
<p><code>public CustomerViewModel(Customer model)<br />
{<br />
//Create a command binding for the Save command<br />
CommandBinding saveBinding = new CommandBinding(ApplicationCommands.Save, SaveExecuted, SaveCanExecute);</code></p>
<p>//Register the binding to the class<br />
CommandManager.RegisterClassCommandBinding(typeof(CustomerViewModel), saveBinding);</p>
<p>//Adds the binding to the CommandBindingCollection<br />
CommandBindings.Add(saveBinding);<br />
}</p>
<p>Now with a little Attached Property goodness we add the commandbindings of our ViewModel to our View:</p>
<p><code>public static DependencyProperty RegisterCommandBindingsProperty =  DependencyProperty.RegisterAttached("RegisterCommandBindings", typeof(CommandBindingCollection), typeof(AttachedProperties), new PropertyMetadata(null, OnRegisterCommandBindingChanged));</code></p>
<p><code>public static void SetRegisterCommandBindings(UIElement element, CommandBindingCollection value)<br />
{<br />
if(element != null)<br />
element.SetValue(RegisterCommandBindingsProperty, value);<br />
}<br />
public static CommandBindingCollection GetRegisterCommandBindings(UIElement element)<br />
{<br />
return (element != null ? (CommandBindingCollection)element.GetValue(RegisterCommandBindingsProperty) : null);<br />
}<br />
private static void OnRegisterCommandBindingChanged<br />
(DependencyObject sender, DependencyPropertyChangedEventArgs e)<br />
{<br />
UIElement element = sender as UIElement;<br />
if (element != null)<br />
{<br />
CommandBindingCollection bindings = e.NewValue as CommandBindingCollection;<br />
if (bindings != null)<br />
{<br />
element.CommandBindings.AddRange(bindings);<br />
}<br />
}<br />
}</code></p>
<p>This is how you would use it in the view:</p>
<p><code>&lt;UserControl local:AttachedProperties.<br />
RegisterCommandBindings="Binding CommandBindings}" &gt;</code></p>
<p><a href="http://codingcontext.files.wordpress.com/2008/12/image.png"><img style="border-width:0;" src="http://codingcontext.files.wordpress.com/2008/12/image-thumb.png?w=479&#038;h=216" alt="image" width="479" height="216" /></a></p>
<h3>Conclusion</h3>
<p>There are few other examples of how to do this like <a href="http://joshsmithonwpf.wordpress.com/" target="_blank">Josh Smith</a> posted on <a href="http://www.codeproject.com/KB/WPF/VMCommanding.aspx" target="_blank">CodePlex</a>, but I think this is a much more straightforward approach and requires less code. I really hope this helps someone dealing with the same issue. If you think there is a better way, please let me know.</p>
<h3>Code</h3>
<p>There is a full example that you can download <a href="http://codingcontext.files.wordpress.com/2008/12/mvvmcommandssample.doc">here</a>. Be sure to change the file extension from .doc to .zip.<br />
<a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fcodingcontext.wordpress.com%2f2008%2f12%2f10%2fcommandbindings-in-mvvm%2f"><img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fcodingcontext.wordpress.com%2f2008%2f12%2f10%2fcommandbindings-in-mvvm%2f" border="0" alt="kick it on DotNetKicks.com" /></a></p>
<br />Posted in .Net, MVVM, WPF Tagged: Commands, Design Patterns, MVVM, WPF <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codingcontext.wordpress.com/116/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codingcontext.wordpress.com/116/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codingcontext.wordpress.com/116/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codingcontext.wordpress.com/116/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codingcontext.wordpress.com/116/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codingcontext.wordpress.com/116/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codingcontext.wordpress.com/116/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codingcontext.wordpress.com/116/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codingcontext.wordpress.com/116/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codingcontext.wordpress.com/116/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codingcontext.wordpress.com/116/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codingcontext.wordpress.com/116/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codingcontext.wordpress.com/116/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codingcontext.wordpress.com/116/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codingcontext.wordpress.com&amp;blog=4523479&amp;post=116&amp;subd=codingcontext&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codingcontext.wordpress.com/2008/12/10/commandbindings-in-mvvm/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c23b963563e43954c912c41335411916?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=PG" medium="image">
			<media:title type="html">Micah</media:title>
		</media:content>

		<media:content url="http://codingcontext.files.wordpress.com/2008/12/image-thumb.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fcodingcontext.wordpress.com%2f2008%2f12%2f10%2fcommandbindings-in-mvvm%2f" medium="image">
			<media:title type="html">kick it on DotNetKicks.com</media:title>
		</media:content>
	</item>
		<item>
		<title>Finding the Best Approach to Styling a LOB App</title>
		<link>http://codingcontext.wordpress.com/2008/12/04/finding-the-best-approach-to-styling-a-lob-app/</link>
		<comments>http://codingcontext.wordpress.com/2008/12/04/finding-the-best-approach-to-styling-a-lob-app/#comments</comments>
		<pubDate>Thu, 04 Dec 2008 14:30:15 +0000</pubDate>
		<dc:creator>micahlmartin</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[Skinning]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://codingcontext.wordpress.com/?p=113</guid>
		<description><![CDATA[In my LOB apps I usually wind up with containers that contain a bunch of different TextBlocks and TextBoxes for users to enter data. Normally I need to apply a certain margin or vertical/horizontal alignment to each control. Let&#8217;s say I have Grid on my form that looks like this (a lot of markup was [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codingcontext.wordpress.com&amp;blog=4523479&amp;post=113&amp;subd=codingcontext&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In my LOB apps I usually wind up with containers that contain a bunch of different TextBlocks and TextBoxes for users to enter data. Normally I need to apply a certain margin or vertical/horizontal alignment to each control.</p>
<p>Let&#8217;s say I have Grid on my form that looks like this (a lot of markup was eliminated for brevity):</p>
<p><!-- code formatted by http://manoli.net/csharpformat/ --></p>
<pre class="csharpcode"><span class="kwrd">&lt;</span><span class="html">Grid</span><span class="kwrd">&gt;</span>
   <span class="kwrd">&lt;</span><span class="html">Grid.ColumnDefinitions...</span><span class="kwrd">/&gt;</span>
   <span class="kwrd">&lt;</span><span class="html">Grid.RowDefinitions...</span><span class="kwrd">/&gt;</span>
   <span class="kwrd">&lt;</span><span class="html">TextBlock</span> <span class="attr">Text</span><span class="kwrd">="MyLabel"</span> <span class="kwrd">/&gt;</span>
   <span class="kwrd">&lt;</span><span class="html">TextBox</span> <span class="attr">Text</span>={<span class="attr">Binding</span> ...}<span class="kwrd">/&gt;</span>
   .
   .
   <span class="rem">&lt;!-- Repated a bunch more times along with all of the Grid.Row,
Grid.Column definitions --&gt;</span>
   <span class="kwrd">&lt;/</span><span class="html">Grid</span><span class="kwrd">&gt;</span></pre>
<p>Now let&#8217;s say I need every single item contained in my grid to have Margin=&#8221;3,1&#8243; VerticalContentAlignment=&#8221;Left&#8221; VerticalAlignment=&#8221;Center&#8221;. There are several ways to achieve this:</p>
<ol>
<li>Set the properties directly on each control &#8211; BAD!! Does not allow for skinning or centralizing styles.</li>
<li>Create a Style with an x:Key=&#8221;MyStyleName&#8221; and apply the style to each control. Better&#8230;Makes centralizing styles and skinning more manageable but still requires a ton of markup, and can become unwieldy.</li>
<li>Create a global style (i.e. don&#8217;t specify an x:Key and set the TargetType={x:Type TextBox/TextBlock} &#8211; BAD!! The problem with this is that it affects ALL controls in the app that don&#8217;t explicity override this style. This can be bad for things like menus, grids, and other controls that use textblocks and textboxes.</li>
<li>Create a style that targets the Grid and explicitely sets the dependecy propety values like <code>&lt;Setter Property="Frameworkelement.Margin" Value="3,1" /&gt;</code> Not bad&#8230;it correctly applies the style to every element in it&#8217;s content, but also applies it directly to the Grid itself&#8230;not exactly what I want.</li>
</ol>
<p>So what approach do you take and why? What works the best?</p>
<p><a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fcodingcontext.wordpress.com%2f2008%2f12%2f04%2ffinding-the-best-approach-to-styling-a-lob-app%2f"><img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fcodingcontext.wordpress.com%2f2008%2f12%2f04%2ffinding-the-best-approach-to-styling-a-lob-app%2f" border="0" alt="kick it on DotNetKicks.com" /></a></p>
<br />Posted in .Net Tagged: Skinning, WPF <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codingcontext.wordpress.com/113/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codingcontext.wordpress.com/113/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codingcontext.wordpress.com/113/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codingcontext.wordpress.com/113/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codingcontext.wordpress.com/113/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codingcontext.wordpress.com/113/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codingcontext.wordpress.com/113/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codingcontext.wordpress.com/113/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codingcontext.wordpress.com/113/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codingcontext.wordpress.com/113/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codingcontext.wordpress.com/113/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codingcontext.wordpress.com/113/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codingcontext.wordpress.com/113/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codingcontext.wordpress.com/113/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codingcontext.wordpress.com&amp;blog=4523479&amp;post=113&amp;subd=codingcontext&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codingcontext.wordpress.com/2008/12/04/finding-the-best-approach-to-styling-a-lob-app/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c23b963563e43954c912c41335411916?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=PG" medium="image">
			<media:title type="html">Micah</media:title>
		</media:content>

		<media:content url="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fcodingcontext.wordpress.com%2f2008%2f12%2f04%2ffinding-the-best-approach-to-styling-a-lob-app%2f" medium="image">
			<media:title type="html">kick it on DotNetKicks.com</media:title>
		</media:content>
	</item>
		<item>
		<title>HeaderFormatString and ContentFormatString</title>
		<link>http://codingcontext.wordpress.com/2008/11/17/headerformatstring-and-contentformatstring/</link>
		<comments>http://codingcontext.wordpress.com/2008/11/17/headerformatstring-and-contentformatstring/#comments</comments>
		<pubDate>Mon, 17 Nov 2008 04:38:37 +0000</pubDate>
		<dc:creator>micahlmartin</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://codingcontext.wordpress.com/?p=73</guid>
		<description><![CDATA[I started exploring both HeaderFormatString and ContentFormatString and ran into a little weirdness. First thing to note is this: If you set the HeaderTemplate or HeaderTemplateSelector property of a HeaderedContentControl, the HeaderStringFormat property is ignored. MSDN There are quite a few gotchas like this in WPF to watch out for. Second thing to note is [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codingcontext.wordpress.com&amp;blog=4523479&amp;post=73&amp;subd=codingcontext&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I started exploring both HeaderFormatString and ContentFormatString and ran into a little weirdness.</p>
<p>First thing to note is this:</p>
<blockquote><p>If you set the HeaderTemplate or HeaderTemplateSelector property of a HeaderedContentControl, the HeaderStringFormat property is ignored. <a rel="nofollow" href="http://msdn.microsoft.com/en-us/library/system.windows.controls.headeredcontentcontrol.headerstringformat.aspx">MSDN</a></p></blockquote>
<p>There are quite a few gotchas like this in WPF to watch out for.</p>
<p>Second thing to note is that these properties aren&#8217;t the same as doing this:<br />
<span class="str"><img class="alignnone size-full wp-image-76" title="headerstringformatxaml3" src="http://codingcontext.files.wordpress.com/2008/11/headerstringformatxaml3.jpg?w=450" alt="headerstringformatxaml3"  /></span><br />
HeaderedContentControl and HeaderStringFormat are used specifically for classes that implement IFormattable. HederStringFormat formats the header, and ContentStringFormat formats the content. The value of either property is the format that gets passed to your classes implementation if IFormattable.ToString. You can read the full example on <a rel="nofollow" href="http://msdn.microsoft.com/en-us/library/system.windows.controls.headeredcontentcontrol.headerstringformat.aspx">MSDN</a>. But here is the gist of how to make it work.</p>
<p><img class="alignnone size-full wp-image-75" title="headerstringformatxaml2" src="http://codingcontext.files.wordpress.com/2008/11/headerstringformatxaml2.jpg?w=450" alt="headerstringformatxaml2"   /><br />
<img class="alignnone size-full wp-image-74" title="headerstringformatxaml" src="http://codingcontext.files.wordpress.com/2008/11/headerstringformatxaml.jpg?w=450" alt="headerstringformatxaml"   /></p>
<p>This TabItem will now display &#8220;This is my formatted string&#8221; in the header, and the content will be &#8220;this is my non-formatted string&#8221;.</p>
<p><img class="alignnone size-full wp-image-79" title="image.png" src="http://codingcontext.files.wordpress.com/2008/11/image.png?w=450" alt="image.png"   /></p>
<p><a href="http://codingcontext.files.wordpress.com/2008/11/image.png"></a></p>
<p>There a couple things to keep in mind. Typically these properties would be used in the context of an ItemsControl. The HeaderStringFormat would not be bound in this way, and instead will have the default binding provided by the ItemContainer of the HeaderedItemsControl. For instance if you set the ItemsSource property of the TabItem, then it will automatically wire up the header and the content binding for you, and all you have to do is supply the formatting value you want.</p>
<p>Last, but not least, I was able to get everything working properly with a GroupBox and TabItem, but not so much luck with an expander and I&#8217;m not sure why. The expander handles the ContentStringFormat properly, but not the HeaderContentStringFormat. This is suprising considering that the both inherit from HeaderContentControl&#8230;</p>
<p><a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fcodingcontext.wordpress.com%2f2008%2f11%2f17%2fheaderformatstring-and-contentformatstring%2f"><img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fcodingcontext.wordpress.com%2f2008%2f11%2f17%2fheaderformatstring-and-contentformatstring%2f" alt="kick it on DotNetKicks.com" /></a></p>
<br />Posted in .Net Tagged: WPF <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codingcontext.wordpress.com/73/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codingcontext.wordpress.com/73/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codingcontext.wordpress.com/73/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codingcontext.wordpress.com/73/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codingcontext.wordpress.com/73/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codingcontext.wordpress.com/73/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codingcontext.wordpress.com/73/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codingcontext.wordpress.com/73/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codingcontext.wordpress.com/73/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codingcontext.wordpress.com/73/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codingcontext.wordpress.com/73/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codingcontext.wordpress.com/73/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codingcontext.wordpress.com/73/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codingcontext.wordpress.com/73/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codingcontext.wordpress.com&amp;blog=4523479&amp;post=73&amp;subd=codingcontext&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codingcontext.wordpress.com/2008/11/17/headerformatstring-and-contentformatstring/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c23b963563e43954c912c41335411916?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=PG" medium="image">
			<media:title type="html">Micah</media:title>
		</media:content>

		<media:content url="http://codingcontext.files.wordpress.com/2008/11/headerstringformatxaml3.jpg" medium="image">
			<media:title type="html">headerstringformatxaml3</media:title>
		</media:content>

		<media:content url="http://codingcontext.files.wordpress.com/2008/11/headerstringformatxaml2.jpg" medium="image">
			<media:title type="html">headerstringformatxaml2</media:title>
		</media:content>

		<media:content url="http://codingcontext.files.wordpress.com/2008/11/headerstringformatxaml.jpg" medium="image">
			<media:title type="html">headerstringformatxaml</media:title>
		</media:content>

		<media:content url="http://codingcontext.files.wordpress.com/2008/11/image.png" medium="image">
			<media:title type="html">image.png</media:title>
		</media:content>

		<media:content url="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fcodingcontext.wordpress.com%2f2008%2f11%2f17%2fheaderformatstring-and-contentformatstring%2f" medium="image">
			<media:title type="html">kick it on DotNetKicks.com</media:title>
		</media:content>
	</item>
		<item>
		<title>Consolidating XAML Namespaces</title>
		<link>http://codingcontext.wordpress.com/2008/10/09/consolidating-xaml-namespaces/</link>
		<comments>http://codingcontext.wordpress.com/2008/10/09/consolidating-xaml-namespaces/#comments</comments>
		<pubDate>Thu, 09 Oct 2008 16:32:59 +0000</pubDate>
		<dc:creator>micahlmartin</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[Xaml]]></category>

		<guid isPermaLink="false">http://codingcontext.wordpress.com/?p=52</guid>
		<description><![CDATA[I&#8217;m working on a project that has numerous namespaces. Each time I need to use a class in XAML I have to add a new namespace declaration to the XAML file. This quickly becomes unwieldy when you start using multiple namespaces like this: Then of course you have to figure out what namespace each item [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codingcontext.wordpress.com&amp;blog=4523479&amp;post=52&amp;subd=codingcontext&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m working on a project that has numerous namespaces. Each time I need to use a class in XAML I have to add a new namespace declaration to the XAML file. This quickly becomes unwieldy when you start using multiple namespaces like this:</p>
<p><a href="http://codingcontext.files.wordpress.com/2008/10/image.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" src="http://codingcontext.files.wordpress.com/2008/10/image-thumb.png?w=486&#038;h=78" alt="image" width="486" height="78" /></a></p>
<p>Then of course you have to figure out what namespace each item is in order to use in XAML.</p>
<p>An easy way around this is to consolidate all of the namespaces at the assembly level using the <span style="color:#33aef9;">XmlnsDefinitionAttribute </span><span style="color:#000000;">from the System.Windows.Markup namespace. In the AssemblyInfo.cs (or .vb) you add this attribute for each namespace you want to consolidate like this:</span></p>
<p><a href="http://codingcontext.files.wordpress.com/2008/10/image4.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" src="http://codingcontext.files.wordpress.com/2008/10/image-thumb4.png?w=499&#038;h=120" alt="image" width="499" height="120" /></a></p>
<p><a href="http://codingcontext.files.wordpress.com/2008/10/image5.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" src="http://codingcontext.files.wordpress.com/2008/10/image-thumb5.png?w=504&#038;h=119" alt="image" width="504" height="119" /></a></p>
<p>There is an optional parameter you can pass in that specifies which assemblies the namespaces live in. This allows you to consolidate namespaces across multiple assemblies.</p>
<p>Now back to our XAML, we can blow out all of these namespace declarations for a much simpler, cleaner approach:</p>
<p><a href="http://codingcontext.files.wordpress.com/2008/10/image3.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" src="http://codingcontext.files.wordpress.com/2008/10/image-thumb3.png?w=453&#038;h=32" alt="image" width="453" height="32" /></a></p>
<p><a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fcodingcontext.wordpress.com%2f2008%2f10%2f09%2fconsolidating-xaml-namespaces%2f"><img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fcodingcontext.wordpress.com%2f2008%2f10%2f09%2fconsolidating-xaml-namespaces%2f" border="0" alt="kick it on DotNetKicks.com" /></a></p>
<br />Posted in .Net, WPF Tagged: .Net, WPF, Xaml <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codingcontext.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codingcontext.wordpress.com/52/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codingcontext.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codingcontext.wordpress.com/52/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codingcontext.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codingcontext.wordpress.com/52/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codingcontext.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codingcontext.wordpress.com/52/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codingcontext.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codingcontext.wordpress.com/52/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codingcontext.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codingcontext.wordpress.com/52/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codingcontext.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codingcontext.wordpress.com/52/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codingcontext.wordpress.com&amp;blog=4523479&amp;post=52&amp;subd=codingcontext&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codingcontext.wordpress.com/2008/10/09/consolidating-xaml-namespaces/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c23b963563e43954c912c41335411916?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=PG" medium="image">
			<media:title type="html">Micah</media:title>
		</media:content>

		<media:content url="http://codingcontext.files.wordpress.com/2008/10/image-thumb.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://codingcontext.files.wordpress.com/2008/10/image-thumb4.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://codingcontext.files.wordpress.com/2008/10/image-thumb5.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://codingcontext.files.wordpress.com/2008/10/image-thumb3.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fcodingcontext.wordpress.com%2f2008%2f10%2f09%2fconsolidating-xaml-namespaces%2f" medium="image">
			<media:title type="html">kick it on DotNetKicks.com</media:title>
		</media:content>
	</item>
		<item>
		<title>WPF Record Navigator (VCR) Control</title>
		<link>http://codingcontext.wordpress.com/2008/10/05/wpf-record-navigator-vcr-control/</link>
		<comments>http://codingcontext.wordpress.com/2008/10/05/wpf-record-navigator-vcr-control/#comments</comments>
		<pubDate>Sun, 05 Oct 2008 04:37:59 +0000</pubDate>
		<dc:creator>micahlmartin</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[Custom Controls]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://codingcontext.wordpress.com/?p=33</guid>
		<description><![CDATA[I haven&#8217;t seen any examples of a record navigator in WPF so I decided to create one. What it is: Allows you to bind to a collection of elements and navigate through each one. What it isn&#8217;t: Currently it doesn&#8217;t have any hooks for styling. The Current Index is read-only and can only be navigated [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codingcontext.wordpress.com&amp;blog=4523479&amp;post=33&amp;subd=codingcontext&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I haven&#8217;t seen any examples of a record navigator in WPF so I decided to create one.</p>
<p>What it is:</p>
<ul>
<li>Allows you to bind to a collection of elements and navigate through each one.</li>
</ul>
<p>What it isn&#8217;t:</p>
<ul>
<li>Currently it doesn&#8217;t have any hooks for styling.</li>
<li>The Current Index is read-only and can only be navigated using the buttons.</li>
</ul>
<p>The implementation is pretty straight forward. It uses routed commands to handle all the navigation. The trick to making the implementation simple was to forward everything on to a ListBox. The template contains a ListBox named &#8220;PART_List&#8221; which has it&#8217;s visibility set to Collapsed. This allows me to bind the TextBlocks that display the Count and Current Position directly to the ListBox. Also for all of the navigation commands, the Command Executed handlers simply forward their calls to the corresponding methods on the ListBox. The ListBox also just binds it&#8217;s ItemsSource and IsSynchronizedWithCurrentItem directly to the corresponding Dependency Properties on the RecordNavigator.</p>
<p>I hope this control is useful to some of you. I&#8217;ll be further refining it to support styling and allow the user to jump to a specific index. Please give me any feedback you have. If there is any bugs or anything it should do that it doesn&#8217;t, please let me know.</p>
<h5>Download</h5>
<p>You can download the code here: <a href="http://codingcontext.files.wordpress.com/2008/10/record-navigator.doc">record-navigator</a>. Make sure to change the extension from .doc to .zip.</p>
<p><a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fcodingcontext.wordpress.com%2f2008%2f10%2f05%2fwpf-record-navigator-vcr-control%2f"><img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fcodingcontext.wordpress.com%2f2008%2f10%2f05%2fwpf-record-navigator-vcr-control%2f" border="0" alt="kick it on DotNetKicks.com" /></a></p>
<br />Posted in .Net Tagged: .Net, Custom Controls, WPF <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codingcontext.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codingcontext.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codingcontext.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codingcontext.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codingcontext.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codingcontext.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codingcontext.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codingcontext.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codingcontext.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codingcontext.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codingcontext.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codingcontext.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codingcontext.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codingcontext.wordpress.com/33/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codingcontext.wordpress.com&amp;blog=4523479&amp;post=33&amp;subd=codingcontext&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codingcontext.wordpress.com/2008/10/05/wpf-record-navigator-vcr-control/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c23b963563e43954c912c41335411916?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=PG" medium="image">
			<media:title type="html">Micah</media:title>
		</media:content>

		<media:content url="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fcodingcontext.wordpress.com%2f2008%2f10%2f05%2fwpf-record-navigator-vcr-control%2f" medium="image">
			<media:title type="html">kick it on DotNetKicks.com</media:title>
		</media:content>
	</item>
		<item>
		<title>Changing the Data Template for the Currently Selected Item</title>
		<link>http://codingcontext.wordpress.com/2008/09/28/changing-the-data-template-for-the-currently-selected-item/</link>
		<comments>http://codingcontext.wordpress.com/2008/09/28/changing-the-data-template-for-the-currently-selected-item/#comments</comments>
		<pubDate>Sun, 28 Sep 2008 20:09:56 +0000</pubDate>
		<dc:creator>micahlmartin</dc:creator>
				<category><![CDATA[Databinding]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[.Net]]></category>

		<guid isPermaLink="false">http://codingcontext.wordpress.com/2008/09/28/changing-the-data-template-for-the-currently-selected-item/</guid>
		<description><![CDATA[Let&#8217;s say I have some sort of list control and I want to show or hide additional information for an item based on whether or not it is currently selected. The easiest way to do this is to create two separate DataTemplates and swap them when needed (For brevity this example just changes the color [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codingcontext.wordpress.com&amp;blog=4523479&amp;post=18&amp;subd=codingcontext&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Let&#8217;s say I have some sort of list control and I want to show or hide additional information for an item based on whether or not it is currently selected. The easiest way to do this is to create two separate DataTemplates and swap them when needed (For brevity this example just changes the color of the selected item, but this can easily be modified to show more complex information).</p>
<p>Typically when you create a data template for an ItemsControl you create it as a resource and set the &#8220;ItemTemplate&#8221; property like this:</p>
<blockquote>
<pre>&lt;DataTemplate x:Key="ItemTemplate"&gt;
    &lt;TextBlock Text="{Binding}" Foreground="Black"/&gt;
&lt;/DataTemplate&gt;
&lt;ListBox ItemTemplate="{StaticResource ItemTemplate}" /&gt;</pre>
</blockquote>
<p>Behind the scenes WPF is actually wrapping each one of our TextBlocks in a ListBoxItem control. In other words, our DataTemplate get&#8217;s set as the Content of the ListBoxItem (which inherits from ContentControl). This ListBoxItem is where the IsSelected property lives that we need to get a hold of in order to swap out our data template. What we need then is to setup a trigger for the ListBoxItem when the IsSelected property changes.</p>
<blockquote>
<pre>&lt;DataTemplate x:Key="ItemTemplate"&gt;
    &lt;TextBlock Text="{Binding}" Foreground="Black"/&gt;
&lt;/DataTemplate&gt;
&lt;DataTemplate x:Key="SelectedTemplate"&gt;
    &lt;TextBlock Text="{Binding}" Foreground="White"/&gt;
&lt;/DataTemplate&gt;
&lt;Style TargetType="{x:Type ListBoxItem}" x:Key="ContainerStyle"&gt;
    &lt;Setter Property="ContentTemplate" Value="{StaticResource ItemTemplate}" /&gt;
    &lt;Style.Triggers&gt;
        &lt;Trigger Property="IsSelected" Value="True"&gt;
            &lt;Setter Property="ContentTemplate" Value="{StaticResource SelectedTemplate}" /&gt;
        &lt;/Trigger&gt;
    &lt;/Style.Triggers&gt;
&lt;/Style&gt;</pre>
</blockquote>
<p>Now the ListBox declaration looks like this:</p>
<blockquote><p>&lt;ListBox ItemContainerStyle=&#8221;{StaticResource ContainerStyle}&#8221;  ItemsSource=&#8221;{Binding MyData}&#8221; /&gt;</p></blockquote>
<p>One thing to take note of here is that I am no longer setting the ItemTemplate property on the ListBox. Instead It is being set through the ContentTemplate property of the ListBoxItem. The reason is that setting it directly on the ListBox overrides the ContentTemplate property of the ListBoxItem.</p>
<p>Download the full code here: <a href="http://codingcontext.files.wordpress.com/2008/09/data-templates-example-092808.doc">data-templates-example-092808</a>. Remember to change the file extension from .doc to .zip.</p>
<p><a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fcodingcontext.wordpress.com%2f2008%2f09%2f28%2fchanging-the-data-template-for-the-currently-selected-item%2f"><img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fcodingcontext.wordpress.com%2f2008%2f09%2f28%2fchanging-the-data-template-for-the-currently-selected-item%2f" border="0" alt="kick it on DotNetKicks.com" /></a></p>
<br />Posted in Databinding, WPF Tagged: .Net, Databinding, WPF <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codingcontext.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codingcontext.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codingcontext.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codingcontext.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codingcontext.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codingcontext.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codingcontext.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codingcontext.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codingcontext.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codingcontext.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codingcontext.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codingcontext.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codingcontext.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codingcontext.wordpress.com/18/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codingcontext.wordpress.com&amp;blog=4523479&amp;post=18&amp;subd=codingcontext&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codingcontext.wordpress.com/2008/09/28/changing-the-data-template-for-the-currently-selected-item/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c23b963563e43954c912c41335411916?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=PG" medium="image">
			<media:title type="html">Micah</media:title>
		</media:content>

		<media:content url="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fcodingcontext.wordpress.com%2f2008%2f09%2f28%2fchanging-the-data-template-for-the-currently-selected-item%2f" medium="image">
			<media:title type="html">kick it on DotNetKicks.com</media:title>
		</media:content>
	</item>
	</channel>
</rss>
