<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:georss="http://www.georss.org/georss" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>DotNetDude.com</title>
    <link>http://www.dotnetdude.com/</link>
    <description>Miguel A. Castro's Blog</description>
    <image>
      <url>http://www.dotnetdude.com/feed-icon-24x24.gif</url>
      <title>DotNetDude.com</title>
      <link>http://www.dotnetdude.com/</link>
    </image>
    <language>en-us</language>
    <copyright>Miguel A. Castro</copyright>
    <lastBuildDate>Thu, 29 Nov 2012 19:59:49 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 2.3.9074.18820</generator>
    <managingEditor>miguelcastro67@gmail.com</managingEditor>
    <webMaster>miguelcastro67@gmail.com</webMaster>
    <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/miguelcastro" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="miguelcastro" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
      <trackback:ping>http://www.dotnetdude.com/Trackback.aspx?guid=7662dd50-9625-41d3-85a1-1a949a8f47ea</trackback:ping>
      <pingback:server>http://www.dotnetdude.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.dotnetdude.com/PermaLink,guid,7662dd50-9625-41d3-85a1-1a949a8f47ea.aspx</pingback:target>
      <dc:creator>Miguel A. Castro</dc:creator>
      <wfw:comment>http://www.dotnetdude.com/CommentView,guid,7662dd50-9625-41d3-85a1-1a949a8f47ea.aspx</wfw:comment>
      <wfw:commentRss>http://www.dotnetdude.com/SyndicationService.asmx/GetEntryCommentsRss?guid=7662dd50-9625-41d3-85a1-1a949a8f47ea</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I recently started working heavily with <a href="http://knockoutjs.com">KnockoutJS</a> and
I gotta say it’s one of the coolest things I’ve ever used.
</p>
        <p>
As an ASP.NET MVC developer, I rely quite a bit on the ability to set a layout page
(or two) and have a master page/content page relationship in my sites. I encountered
however that Knockout seems to flake out a little but when you have &lt;script&gt;
sections scattered in your content pages. The one I have in the layout page works
fine, but the ones I define in the content pages did not. The content of these script
tags is obviously my view models and can be defined either inline or linking to a
js file. Either way, no workie.
</p>
        <p>
When viewing the page source on the rendered page, you can see the &lt;script&gt;
section defined in the layout page up on top and the one for the content page down
in the middle somewhere. For testing purposes, I moved the content page’s &lt;script&gt;
content to the layout page and guess what, it all works fine.
</p>
        <p>
Obviously in the case of having more than one ViewModel, you have to use the <strong>applyBindings</strong> method
with the “root element” argument.
</p>
        <p>
So after a little searching and finding nothing on this problem (I guess Knockout
being so new, searches still lack quite a bit – yes, even <a href="http://stackoverflow.com">StackOverflow</a>),
something occurred to me and it fixed my problem:
</p>
        <p>
I can declare the content page’s &lt;script&gt; section inside a <strong>@section <em>sectionname</em> {
}</strong>. Then in my layout page I used the <strong>@RenderSection</strong> command
to render that section using the name I gave it. Now the scripts can be physically
encapsulated within the content page to which they belong, but render up at the top
of the layout page’s &lt;script&gt; section – best of both worlds.
</p>
        <p>
I hope this posting reaches the search engines and helps others who may have run into
this.
</p>
        <h3>
          <em>Until next time…</em>
        </h3>
        <img width="0" height="0" src="http://www.dotnetdude.com/aggbug.ashx?id=7662dd50-9625-41d3-85a1-1a949a8f47ea" />
      </body>
      <title>Knockout ViewModels and ASP.NET MVC Layout Pages</title>
      <guid isPermaLink="false">http://www.dotnetdude.com/PermaLink,guid,7662dd50-9625-41d3-85a1-1a949a8f47ea.aspx</guid>
      <link>http://www.dotnetdude.com/2012/11/29/KnockoutViewModelsAndASPNETMVCLayoutPages.aspx</link>
      <pubDate>Thu, 29 Nov 2012 19:59:49 GMT</pubDate>
      <description>&lt;p&gt;
I recently started working heavily with &lt;a href="http://knockoutjs.com"&gt;KnockoutJS&lt;/a&gt; and
I gotta say it’s one of the coolest things I’ve ever used.
&lt;/p&gt;
&lt;p&gt;
As an ASP.NET MVC developer, I rely quite a bit on the ability to set a layout page
(or two) and have a master page/content page relationship in my sites. I encountered
however that Knockout seems to flake out a little but when you have &amp;lt;script&amp;gt;
sections scattered in your content pages. The one I have in the layout page works
fine, but the ones I define in the content pages did not. The content of these script
tags is obviously my view models and can be defined either inline or linking to a
js file. Either way, no workie.
&lt;/p&gt;
&lt;p&gt;
When viewing the page source on the rendered page, you can see the &amp;lt;script&amp;gt;
section defined in the layout page up on top and the one for the content page down
in the middle somewhere. For testing purposes, I moved the content page’s &amp;lt;script&amp;gt;
content to the layout page and guess what, it all works fine.
&lt;/p&gt;
&lt;p&gt;
Obviously in the case of having more than one ViewModel, you have to use the &lt;strong&gt;applyBindings&lt;/strong&gt; method
with the “root element” argument.
&lt;/p&gt;
&lt;p&gt;
So after a little searching and finding nothing on this problem (I guess Knockout
being so new, searches still lack quite a bit – yes, even &lt;a href="http://stackoverflow.com"&gt;StackOverflow&lt;/a&gt;),
something occurred to me and it fixed my problem:
&lt;/p&gt;
&lt;p&gt;
I can declare the content page’s &amp;lt;script&amp;gt; section inside a &lt;strong&gt;@section &lt;em&gt;sectionname&lt;/em&gt; {
}&lt;/strong&gt;. Then in my layout page I used the &lt;strong&gt;@RenderSection&lt;/strong&gt; command
to render that section using the name I gave it. Now the scripts can be physically
encapsulated within the content page to which they belong, but render up at the top
of the layout page’s &amp;lt;script&amp;gt; section – best of both worlds.
&lt;/p&gt;
&lt;p&gt;
I hope this posting reaches the search engines and helps others who may have run into
this.
&lt;/p&gt;
&lt;h3&gt;&lt;em&gt;Until next time…&lt;/em&gt;
&lt;/h3&gt;
&lt;img width="0" height="0" src="http://www.dotnetdude.com/aggbug.ashx?id=7662dd50-9625-41d3-85a1-1a949a8f47ea" /&gt;</description>
      <comments>http://www.dotnetdude.com/CommentView,guid,7662dd50-9625-41d3-85a1-1a949a8f47ea.aspx</comments>
      <category>ASP</category>
      <category>Dev Stuff</category>
    </item>
    <item>
      <trackback:ping>http://www.dotnetdude.com/Trackback.aspx?guid=313ad92b-8e3f-4e19-ad7a-e85a96225727</trackback:ping>
      <pingback:server>http://www.dotnetdude.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.dotnetdude.com/PermaLink,guid,313ad92b-8e3f-4e19-ad7a-e85a96225727.aspx</pingback:target>
      <dc:creator>Miguel A. Castro</dc:creator>
      <wfw:comment>http://www.dotnetdude.com/CommentView,guid,313ad92b-8e3f-4e19-ad7a-e85a96225727.aspx</wfw:comment>
      <wfw:commentRss>http://www.dotnetdude.com/SyndicationService.asmx/GetEntryCommentsRss?guid=313ad92b-8e3f-4e19-ad7a-e85a96225727</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I just finished a session on MVVM at DevReach in Sofia, Bulgaria and the concern came
up about using a method to call the PropertyChanged event with a string for the property.
Obviously this does not have compile-time safety and opens the door to a lot risk.
In the real world, I use the Prism framework which has a facility to extract a property
name from an expression so I pulled that piece out and am showing it here for those
interest.
</p>
        <p>
Here’s a very simple base class that encapsulates property change notification. Notice
the overloaded method for raising the event. One uses a string argument and the other
an expression.
</p>
        <div class="csharpcode">
          <pre class="alt">
            <span class="lnum"> 1: </span>
            <span class="kwrd">public</span>
            <span class="kwrd">abstract</span>
            <span class="kwrd">class</span> ObjectBase
: INotifyPropertyChanged</pre>
          <pre>
            <span class="lnum"> 2: </span> {</pre>
          <pre class="alt">
            <span class="lnum"> 3: </span>
            <span class="kwrd">public</span>
            <span class="kwrd">event</span> PropertyChangedEventHandler
PropertyChanged;</pre>
          <pre>
            <span class="lnum"> 4: </span> </pre>
          <pre class="alt">
            <span class="lnum"> 5: </span>
            <span class="kwrd">protected</span>
            <span class="kwrd">internal</span>
            <span class="kwrd">void</span> OnPropertyChanged(<span class="kwrd">string</span> propertyName)</pre>
          <pre>
            <span class="lnum"> 6: </span> {</pre>
          <pre class="alt">
            <span class="lnum"> 7: </span>
            <span class="kwrd">if</span> (<span class="kwrd">this</span>.PropertyChanged
!= <span class="kwrd">null</span>)</pre>
          <pre>
            <span class="lnum"> 8: </span>
            <span class="kwrd">this</span>.PropertyChanged(<span class="kwrd">this</span>, <span class="kwrd">new</span> PropertyChangedEventArgs(propertyName));</pre>
          <pre class="alt">
            <span class="lnum"> 9: </span> }</pre>
          <pre>
            <span class="lnum"> 10: </span> </pre>
          <pre class="alt">
            <span class="lnum"> 11: </span>
            <span class="kwrd">protected</span>
            <span class="kwrd">virtual</span>
            <span class="kwrd">void</span> OnPropertyChanged&lt;T&gt;(Expression&lt;Func&lt;T&gt;&gt;
propertyExpression)</pre>
          <pre>
            <span class="lnum"> 12: </span> {</pre>
          <pre class="alt">
            <span class="lnum"> 13: </span> var propertyName = ExtractPropertyName(propertyExpression);</pre>
          <pre>
            <span class="lnum"> 14: </span> OnPropertyChanged(propertyName);</pre>
          <pre class="alt">
            <span class="lnum"> 15: </span> }</pre>
          <pre>
            <span class="lnum"> 16: </span> </pre>
          <pre class="alt">
            <span class="lnum"> 17: </span>
            <span class="kwrd">static</span>
            <span class="kwrd">string</span> ExtractPropertyName&lt;T&gt;(Expression&lt;Func&lt;T&gt;&gt;
propertyExpression)</pre>
          <pre>
            <span class="lnum"> 18: </span> {</pre>
          <pre class="alt">
            <span class="lnum"> 19: </span>
            <span class="kwrd">if</span> (propertyExpression
== <span class="kwrd">null</span>)</pre>
          <pre>
            <span class="lnum"> 20: </span> {</pre>
          <pre class="alt">
            <span class="lnum"> 21: </span>
            <span class="kwrd">throw</span>
            <span class="kwrd">new</span> ArgumentNullException(<span class="str">"propertyExpression"</span>);</pre>
          <pre>
            <span class="lnum"> 22: </span> }</pre>
          <pre class="alt">
            <span class="lnum"> 23: </span> </pre>
          <pre>
            <span class="lnum"> 24: </span> var memberExpression = propertyExpression.Body <span class="kwrd">as</span> MemberExpression;</pre>
          <pre class="alt">
            <span class="lnum"> 25: </span>
            <span class="kwrd">if</span> (memberExpression
== <span class="kwrd">null</span>)</pre>
          <pre>
            <span class="lnum"> 26: </span>
            <span class="kwrd">throw</span>
            <span class="kwrd">new</span> Exception();</pre>
          <pre class="alt">
            <span class="lnum"> 27: </span> </pre>
          <pre>
            <span class="lnum"> 28: </span> var property = memberExpression.Member <span class="kwrd">as</span> PropertyInfo;</pre>
          <pre class="alt">
            <span class="lnum"> 29: </span>
            <span class="kwrd">if</span> (property
== <span class="kwrd">null</span>)</pre>
          <pre>
            <span class="lnum"> 30: </span>
            <span class="kwrd">if</span> (memberExpression
== <span class="kwrd">null</span>)</pre>
          <pre class="alt">
            <span class="lnum"> 31: </span>
            <span class="kwrd">throw</span>
            <span class="kwrd">new</span> Exception();</pre>
          <pre>
            <span class="lnum"> 32: </span> </pre>
          <pre class="alt">
            <span class="lnum"> 33: </span> var getMethod = property.GetGetMethod(<span class="kwrd">true</span>);</pre>
          <pre>
            <span class="lnum"> 34: </span>
            <span class="kwrd">if</span> (getMethod.IsStatic)</pre>
          <pre class="alt">
            <span class="lnum"> 35: </span>
            <span class="kwrd">if</span> (memberExpression
== <span class="kwrd">null</span>)</pre>
          <pre>
            <span class="lnum"> 36: </span>
            <span class="kwrd">throw</span>
            <span class="kwrd">new</span> Exception();</pre>
          <pre class="alt">
            <span class="lnum"> 37: </span> </pre>
          <pre>
            <span class="lnum"> 38: </span>
            <span class="kwrd">return</span> memberExpression.Member.Name;</pre>
          <pre class="alt">
            <span class="lnum"> 39: </span> }</pre>
          <pre>
            <span class="lnum"> 40: </span> }</pre>
        </div>
        <style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
        <p>
 
</p>
        <p>
Using this is easy. Instead of sending in the property name as a string when calling
OnPropertyChanged, you use an expression and get full compile-time safety:
</p>
        <div class="csharpcode">
          <pre class="alt">
            <span class="lnum"> 1: </span>
            <span class="kwrd">public</span> ViewModelBase
CurrentChild</pre>
          <pre>
            <span class="lnum"> 2: </span> {</pre>
          <pre class="alt">
            <span class="lnum"> 3: </span> get { <span class="kwrd">return</span> _CurrentChild;
}</pre>
          <pre>
            <span class="lnum"> 4: </span> set</pre>
          <pre class="alt">
            <span class="lnum"> 5: </span> {</pre>
          <pre>
            <span class="lnum"> 6: </span>
            <span class="kwrd">if</span> (_CurrentChild != <span class="kwrd">null</span> &amp;&amp;
_CurrentChild.Equals(<span class="kwrd">value</span>))</pre>
          <pre class="alt">
            <span class="lnum"> 7: </span>
            <span class="kwrd">return</span>;</pre>
          <pre>
            <span class="lnum"> 8: </span> </pre>
          <pre class="alt">
            <span class="lnum"> 9: </span> _CurrentChild = <span class="kwrd">value</span>;</pre>
          <pre>
            <span class="lnum"> 10: </span> OnPropertyChanged(() =&gt; CurrentChild);</pre>
          <pre class="alt">
            <span class="lnum"> 11: </span> }</pre>
          <pre>
            <span class="lnum"> 12: </span> }</pre>
        </div>
        <style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
        <h3>
          <em>Until next time…</em>
        </h3>
        <img width="0" height="0" src="http://www.dotnetdude.com/aggbug.ashx?id=313ad92b-8e3f-4e19-ad7a-e85a96225727" />
      </body>
      <title>Compile-Time Safety on Property Notification</title>
      <guid isPermaLink="false">http://www.dotnetdude.com/PermaLink,guid,313ad92b-8e3f-4e19-ad7a-e85a96225727.aspx</guid>
      <link>http://www.dotnetdude.com/2012/10/04/CompileTimeSafetyOnPropertyNotification.aspx</link>
      <pubDate>Thu, 04 Oct 2012 13:49:59 GMT</pubDate>
      <description>&lt;p&gt;
I just finished a session on MVVM at DevReach in Sofia, Bulgaria and the concern came
up about using a method to call the PropertyChanged event with a string for the property.
Obviously this does not have compile-time safety and opens the door to a lot risk.
In the real world, I use the Prism framework which has a facility to extract a property
name from an expression so I pulled that piece out and am showing it here for those
interest.
&lt;/p&gt;
&lt;p&gt;
Here’s a very simple base class that encapsulates property change notification. Notice
the overloaded method for raising the event. One uses a string argument and the other
an expression.
&lt;/p&gt;
&lt;div class="csharpcode"&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 1: &lt;/span&gt; &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;abstract&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; ObjectBase
: INotifyPropertyChanged&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 2: &lt;/span&gt; {&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 3: &lt;/span&gt; &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;event&lt;/span&gt; PropertyChangedEventHandler
PropertyChanged;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 4: &lt;/span&gt;&amp;#160;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 5: &lt;/span&gt; &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;internal&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; OnPropertyChanged(&lt;span class="kwrd"&gt;string&lt;/span&gt; propertyName)&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 6: &lt;/span&gt; {&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 7: &lt;/span&gt; &lt;span class="kwrd"&gt;if&lt;/span&gt; (&lt;span class="kwrd"&gt;this&lt;/span&gt;.PropertyChanged
!= &lt;span class="kwrd"&gt;null&lt;/span&gt;)&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 8: &lt;/span&gt; &lt;span class="kwrd"&gt;this&lt;/span&gt;.PropertyChanged(&lt;span class="kwrd"&gt;this&lt;/span&gt;, &lt;span class="kwrd"&gt;new&lt;/span&gt; PropertyChangedEventArgs(propertyName));&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 9: &lt;/span&gt; }&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 10: &lt;/span&gt;&amp;#160;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 11: &lt;/span&gt; &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;virtual&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; OnPropertyChanged&amp;lt;T&amp;gt;(Expression&amp;lt;Func&amp;lt;T&amp;gt;&amp;gt;
propertyExpression)&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 12: &lt;/span&gt; {&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 13: &lt;/span&gt; var propertyName = ExtractPropertyName(propertyExpression);&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 14: &lt;/span&gt; OnPropertyChanged(propertyName);&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 15: &lt;/span&gt; }&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 16: &lt;/span&gt;&amp;#160;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 17: &lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; ExtractPropertyName&amp;lt;T&amp;gt;(Expression&amp;lt;Func&amp;lt;T&amp;gt;&amp;gt;
propertyExpression)&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 18: &lt;/span&gt; {&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 19: &lt;/span&gt; &lt;span class="kwrd"&gt;if&lt;/span&gt; (propertyExpression
== &lt;span class="kwrd"&gt;null&lt;/span&gt;)&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 20: &lt;/span&gt; {&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 21: &lt;/span&gt; &lt;span class="kwrd"&gt;throw&lt;/span&gt; &lt;span class="kwrd"&gt;new&lt;/span&gt; ArgumentNullException(&lt;span class="str"&gt;&amp;quot;propertyExpression&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 22: &lt;/span&gt; }&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 23: &lt;/span&gt;&amp;#160;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 24: &lt;/span&gt; var memberExpression = propertyExpression.Body &lt;span class="kwrd"&gt;as&lt;/span&gt; MemberExpression;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 25: &lt;/span&gt; &lt;span class="kwrd"&gt;if&lt;/span&gt; (memberExpression
== &lt;span class="kwrd"&gt;null&lt;/span&gt;)&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 26: &lt;/span&gt; &lt;span class="kwrd"&gt;throw&lt;/span&gt; &lt;span class="kwrd"&gt;new&lt;/span&gt; Exception();&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 27: &lt;/span&gt;&amp;#160;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 28: &lt;/span&gt; var property = memberExpression.Member &lt;span class="kwrd"&gt;as&lt;/span&gt; PropertyInfo;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 29: &lt;/span&gt; &lt;span class="kwrd"&gt;if&lt;/span&gt; (property
== &lt;span class="kwrd"&gt;null&lt;/span&gt;)&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 30: &lt;/span&gt; &lt;span class="kwrd"&gt;if&lt;/span&gt; (memberExpression
== &lt;span class="kwrd"&gt;null&lt;/span&gt;)&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 31: &lt;/span&gt; &lt;span class="kwrd"&gt;throw&lt;/span&gt; &lt;span class="kwrd"&gt;new&lt;/span&gt; Exception();&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 32: &lt;/span&gt;&amp;#160;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 33: &lt;/span&gt; var getMethod = property.GetGetMethod(&lt;span class="kwrd"&gt;true&lt;/span&gt;);&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 34: &lt;/span&gt; &lt;span class="kwrd"&gt;if&lt;/span&gt; (getMethod.IsStatic)&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 35: &lt;/span&gt; &lt;span class="kwrd"&gt;if&lt;/span&gt; (memberExpression
== &lt;span class="kwrd"&gt;null&lt;/span&gt;)&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 36: &lt;/span&gt; &lt;span class="kwrd"&gt;throw&lt;/span&gt; &lt;span class="kwrd"&gt;new&lt;/span&gt; Exception();&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 37: &lt;/span&gt;&amp;#160;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 38: &lt;/span&gt; &lt;span class="kwrd"&gt;return&lt;/span&gt; memberExpression.Member.Name;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 39: &lt;/span&gt; }&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 40: &lt;/span&gt; }&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;
&lt;p&gt;
&amp;#160;
&lt;/p&gt;
&lt;p&gt;
Using this is easy. Instead of sending in the property name as a string when calling
OnPropertyChanged, you use an expression and get full compile-time safety:
&lt;/p&gt;
&lt;div class="csharpcode"&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 1: &lt;/span&gt; &lt;span class="kwrd"&gt;public&lt;/span&gt; ViewModelBase
CurrentChild&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 2: &lt;/span&gt; {&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 3: &lt;/span&gt; get { &lt;span class="kwrd"&gt;return&lt;/span&gt; _CurrentChild;
}&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 4: &lt;/span&gt; set&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 5: &lt;/span&gt; {&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 6: &lt;/span&gt; &lt;span class="kwrd"&gt;if&lt;/span&gt; (_CurrentChild != &lt;span class="kwrd"&gt;null&lt;/span&gt; &amp;amp;&amp;amp;
_CurrentChild.Equals(&lt;span class="kwrd"&gt;value&lt;/span&gt;))&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 7: &lt;/span&gt; &lt;span class="kwrd"&gt;return&lt;/span&gt;;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 8: &lt;/span&gt;&amp;#160;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 9: &lt;/span&gt; _CurrentChild = &lt;span class="kwrd"&gt;value&lt;/span&gt;;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 10: &lt;/span&gt; OnPropertyChanged(() =&amp;gt; CurrentChild);&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 11: &lt;/span&gt; }&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 12: &lt;/span&gt; }&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;
&lt;h3&gt;&lt;em&gt;Until next time…&lt;/em&gt;
&lt;/h3&gt;
&lt;img width="0" height="0" src="http://www.dotnetdude.com/aggbug.ashx?id=313ad92b-8e3f-4e19-ad7a-e85a96225727" /&gt;</description>
      <comments>http://www.dotnetdude.com/CommentView,guid,313ad92b-8e3f-4e19-ad7a-e85a96225727.aspx</comments>
    </item>
    <item>
      <trackback:ping>http://www.dotnetdude.com/Trackback.aspx?guid=a2fa626f-a2b5-4beb-9ff7-002f07203a0a</trackback:ping>
      <pingback:server>http://www.dotnetdude.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.dotnetdude.com/PermaLink,guid,a2fa626f-a2b5-4beb-9ff7-002f07203a0a.aspx</pingback:target>
      <dc:creator>Miguel A. Castro</dc:creator>
      <wfw:comment>http://www.dotnetdude.com/CommentView,guid,a2fa626f-a2b5-4beb-9ff7-002f07203a0a.aspx</wfw:comment>
      <wfw:commentRss>http://www.dotnetdude.com/SyndicationService.asmx/GetEntryCommentsRss?guid=a2fa626f-a2b5-4beb-9ff7-002f07203a0a</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Hi all, I’ll be speaking at Visual Studio Live this December, including an all-day
pre-con on Services where I cover both WCF and Web API.
</p>
        <p>
You can click below and use the promotion code VOSPK6, and please stop by and say
hi personally!
</p>
        <p>
          <a href="http://vslive.com/events/orlando-2012/home.aspx?utm_source=AttendeeMktg&amp;utm_medium=Miscellaneous&amp;utm_campaign=VOSPK6">
            <img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="VSLOR12 Speaker Incentive_Castro" border="0" alt="VSLOR12 Speaker Incentive_Castro" src="http://www.dotnetdude.com/content/binary/Windows-Live-Writer/Visual-Studio-Live-Orlando-in-DecemberDI_AAD0/VSLOR12%20Speaker%20Incentive_Castro_3.jpg" width="163" height="163" />
          </a>
        </p>
        <p>
CYA THERE !
</p>
        <img width="0" height="0" src="http://www.dotnetdude.com/aggbug.ashx?id=a2fa626f-a2b5-4beb-9ff7-002f07203a0a" />
      </body>
      <title>Visual Studio Live Orlando in December !!!</title>
      <guid isPermaLink="false">http://www.dotnetdude.com/PermaLink,guid,a2fa626f-a2b5-4beb-9ff7-002f07203a0a.aspx</guid>
      <link>http://www.dotnetdude.com/2012/09/19/VisualStudioLiveOrlandoInDecember.aspx</link>
      <pubDate>Wed, 19 Sep 2012 16:12:36 GMT</pubDate>
      <description>&lt;p&gt;
Hi all, I’ll be speaking at Visual Studio Live this December, including an all-day
pre-con on Services where I cover both WCF and Web API.
&lt;/p&gt;
&lt;p&gt;
You can click below and use the promotion code VOSPK6, and please stop by and say
hi personally!
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://vslive.com/events/orlando-2012/home.aspx?utm_source=AttendeeMktg&amp;amp;utm_medium=Miscellaneous&amp;amp;utm_campaign=VOSPK6"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="VSLOR12 Speaker Incentive_Castro" border="0" alt="VSLOR12 Speaker Incentive_Castro" src="http://www.dotnetdude.com/content/binary/Windows-Live-Writer/Visual-Studio-Live-Orlando-in-DecemberDI_AAD0/VSLOR12%20Speaker%20Incentive_Castro_3.jpg" width="163" height="163"&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
CYA THERE !
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.dotnetdude.com/aggbug.ashx?id=a2fa626f-a2b5-4beb-9ff7-002f07203a0a" /&gt;</description>
      <comments>http://www.dotnetdude.com/CommentView,guid,a2fa626f-a2b5-4beb-9ff7-002f07203a0a.aspx</comments>
    </item>
    <item>
      <trackback:ping>http://www.dotnetdude.com/Trackback.aspx?guid=27457c9e-6881-476b-8a59-a262e1fb3bac</trackback:ping>
      <pingback:server>http://www.dotnetdude.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.dotnetdude.com/PermaLink,guid,27457c9e-6881-476b-8a59-a262e1fb3bac.aspx</pingback:target>
      <dc:creator>Miguel A. Castro</dc:creator>
      <wfw:comment>http://www.dotnetdude.com/CommentView,guid,27457c9e-6881-476b-8a59-a262e1fb3bac.aspx</wfw:comment>
      <wfw:commentRss>http://www.dotnetdude.com/SyndicationService.asmx/GetEntryCommentsRss?guid=27457c9e-6881-476b-8a59-a262e1fb3bac</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
As part of the ACT Fly-In this year, I was recently given the opportunity to go to
Washington and meet with some of our law makers to discuss several issues in the IT
arena. One of them is an issue I’ve been discussing with people for a while way before
this event, and that’s the issue of spectrum shortages. I had some good discussions
with several congressmen, senators, and staffers and thought it’d be good to touch
base on it here. For those of you that think this may not affect you, let me tell
you that it already has and you’ve even made it every-day topics of discussion and
argument. Our daily discussions of dropped calls, cellular dead-zones, and slow wi-fi
is certain proof that the problem of bandwidth is alive and well and most certainly
getting worse. As we move into the 4G era, towers are needing to be upgraded and even
new ones built.  But the development of the physical infrastructure is useless
without the invisible commodity that rides on it, and this is spectrum. Put simply,
spectrum is a frequency range that is used by wireless communication. Also known as
Wireless Spread Spectrum, it consists of the frequency range 3ghz and 300ghz with
its availability is limited and its usage assigned through licensing. It’s considered
a national resource, and because of that, subject to governmental administration.
Such administration and management is necessary to limit what’s known as radio spectrum
pollution. Since 1934, authority for spectrum management is granted to the President
for any federal use and to the FCC for all domestic use. Companies with spectrum assignment
are the regulators for that frequency and have been known to “sit on it” even when
not in use. This lead to congress passing the Spectrum Act requiring spectrum licensees
to share spectrum and participate in wireless broadband spectrum actions. As I stated
earlier, though considered a national resource, it unlike water and gas because it
is reusable.
</p>
        <p>
The government incentive auctions have allowed for unused spectrum, much of it held
by over-the-air broadcasters after the switch-to-digital, to be released and “purchased”
by licensees willing to light it up. This is a win-win situation because the current
licensees of unused spectrum profit from the auction proceeds, and it opens up new
business opportunities for new services. These “new services” are us, the app developers.
The apps we’re writing today are more connected than ever. It’s funny how for a long
time, I taught developers how to write architect apps for disconnected use, but that’s
becoming more and more difficult with the requirements users (and customers) are placing
on “the cloud”. We’re going to see our bandwidth problems gets worse before they get
better as more and more applications that require the internet in their core usage
are developed. This is ever-so-evident in today (and tomorrow’s) tablets. Nearly every
application uses the cloud in one way or another. Media streaming from cloud storage
versus local storage will be the next big challenge. Devices are offering no on-board
memory increase in favor or more and more cloud storage. Apple’s iPad is on its third
iteration and its maximum capacity has remained the same since its introduction. Apple
themselves say the play to open the iTunes Match service to video by the end of this
year. This will result in a enormous weight on the carrier lines, making the need
for more spectrum activation even more critical.
</p>
        <p>
The incentive auctions should continue but not hindered by unnecessary regulation
in the interest of a “level playing field”. And the FCC should readily approve spectrum
deals that are in front of them, like Verizon’s bid to buy out and build out spectrum
from the cable companies. It shouldn’t lay dormant. If purchasers of unused spectrum
have the capacity to contribute to the marketplace, provide innovation, better coverage,
and more jobs, they should be allowed to do so. Getting in the middle of this can
literally bottleneck the Internet and the cell-lines, and today this is not a trivial
thing. There is a way to get involved and get your opinion heard on topics that are
important to you. Gone are the days where we need to run to the library to use the
encyclopedia to research something. Everything we need is literally at our fingertips,
but to remain at all our fingertips, the technology must be allowed to grow and progress
and not be stalled by people with incomplete information. ACT offered me the unique
opportunity to actually discuss this with the people that make our laws. What this
taught me was that we don’t have to be a “cast the vote and walk away” people.
</p>
        <p>
Time will tell if our discussions will result in success, but I for one was impressed
for how I was received; even in offices for which I was not a constituent. I try to
be optimistic in our system of government, despite the partisan ship that does and
will always take place, and despite whether or not I agree with what certain parties
are doing. My frequent travels abroad constantly reaffirm that optimism. This one
topic was of particular fascination to me when I first educated myself on it, and
became a constant interest as I followed the legislative actions covering it. I do
feel it is one that affects everyone in the technology business and when it comes
to infrastructure construction, innovation, and application development, it affects
the country as a whole.
</p>
        <img width="0" height="0" src="http://www.dotnetdude.com/aggbug.ashx?id=27457c9e-6881-476b-8a59-a262e1fb3bac" />
      </body>
      <title>Technology, meet Politics. Politics, meet Technology</title>
      <guid isPermaLink="false">http://www.dotnetdude.com/PermaLink,guid,27457c9e-6881-476b-8a59-a262e1fb3bac.aspx</guid>
      <link>http://www.dotnetdude.com/2012/06/18/TechnologyMeetPoliticsPoliticsMeetTechnology.aspx</link>
      <pubDate>Mon, 18 Jun 2012 16:01:20 GMT</pubDate>
      <description>&lt;p&gt;
As part of the ACT Fly-In this year, I was recently given the opportunity to go to
Washington and meet with some of our law makers to discuss several issues in the IT
arena. One of them is an issue I’ve been discussing with people for a while way before
this event, and that’s the issue of spectrum shortages. I had some good discussions
with several congressmen, senators, and staffers and thought it’d be good to touch
base on it here. For those of you that think this may not affect you, let me tell
you that it already has and you’ve even made it every-day topics of discussion and
argument. Our daily discussions of dropped calls, cellular dead-zones, and slow wi-fi
is certain proof that the problem of bandwidth is alive and well and most certainly
getting worse. As we move into the 4G era, towers are needing to be upgraded and even
new ones built.&amp;nbsp; But the development of the physical infrastructure is useless
without the invisible commodity that rides on it, and this is spectrum. Put simply,
spectrum is a frequency range that is used by wireless communication. Also known as
Wireless Spread Spectrum, it consists of the frequency range 3ghz and 300ghz with
its availability is limited and its usage assigned through licensing. It’s considered
a national resource, and because of that, subject to governmental administration.
Such administration and management is necessary to limit what’s known as radio spectrum
pollution. Since 1934, authority for spectrum management is granted to the President
for any federal use and to the FCC for all domestic use. Companies with spectrum assignment
are the regulators for that frequency and have been known to “sit on it” even when
not in use. This lead to congress passing the Spectrum Act requiring spectrum licensees
to share spectrum and participate in wireless broadband spectrum actions. As I stated
earlier, though considered a national resource, it unlike water and gas because it
is reusable.
&lt;/p&gt;
&lt;p&gt;
The government incentive auctions have allowed for unused spectrum, much of it held
by over-the-air broadcasters after the switch-to-digital, to be released and “purchased”
by licensees willing to light it up. This is a win-win situation because the current
licensees of unused spectrum profit from the auction proceeds, and it opens up new
business opportunities for new services. These “new services” are us, the app developers.
The apps we’re writing today are more connected than ever. It’s funny how for a long
time, I taught developers how to write architect apps for disconnected use, but that’s
becoming more and more difficult with the requirements users (and customers) are placing
on “the cloud”. We’re going to see our bandwidth problems gets worse before they get
better as more and more applications that require the internet in their core usage
are developed. This is ever-so-evident in today (and tomorrow’s) tablets. Nearly every
application uses the cloud in one way or another. Media streaming from cloud storage
versus local storage will be the next big challenge. Devices are offering no on-board
memory increase in favor or more and more cloud storage. Apple’s iPad is on its third
iteration and its maximum capacity has remained the same since its introduction. Apple
themselves say the play to open the iTunes Match service to video by the end of this
year. This will result in a enormous weight on the carrier lines, making the need
for more spectrum activation even more critical.
&lt;/p&gt;
&lt;p&gt;
The incentive auctions should continue but not hindered by unnecessary regulation
in the interest of a “level playing field”. And the FCC should readily approve spectrum
deals that are in front of them, like Verizon’s bid to buy out and build out spectrum
from the cable companies. It shouldn’t lay dormant. If purchasers of unused spectrum
have the capacity to contribute to the marketplace, provide innovation, better coverage,
and more jobs, they should be allowed to do so. Getting in the middle of this can
literally bottleneck the Internet and the cell-lines, and today this is not a trivial
thing. There is a way to get involved and get your opinion heard on topics that are
important to you. Gone are the days where we need to run to the library to use the
encyclopedia to research something. Everything we need is literally at our fingertips,
but to remain at all our fingertips, the technology must be allowed to grow and progress
and not be stalled by people with incomplete information. ACT offered me the unique
opportunity to actually discuss this with the people that make our laws. What this
taught me was that we don’t have to be a “cast the vote and walk away” people.
&lt;/p&gt;
&lt;p&gt;
Time will tell if our discussions will result in success, but I for one was impressed
for how I was received; even in offices for which I was not a constituent. I try to
be optimistic in our system of government, despite the partisan ship that does and
will always take place, and despite whether or not I agree with what certain parties
are doing. My frequent travels abroad constantly reaffirm that optimism. This one
topic was of particular fascination to me when I first educated myself on it, and
became a constant interest as I followed the legislative actions covering it. I do
feel it is one that affects everyone in the technology business and when it comes
to infrastructure construction, innovation, and application development, it affects
the country as a whole.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.dotnetdude.com/aggbug.ashx?id=27457c9e-6881-476b-8a59-a262e1fb3bac" /&gt;</description>
      <comments>http://www.dotnetdude.com/CommentView,guid,27457c9e-6881-476b-8a59-a262e1fb3bac.aspx</comments>
    </item>
    <item>
      <trackback:ping>http://www.dotnetdude.com/Trackback.aspx?guid=572a71f7-bbab-4da8-88dc-bb11365927ad</trackback:ping>
      <pingback:server>http://www.dotnetdude.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.dotnetdude.com/PermaLink,guid,572a71f7-bbab-4da8-88dc-bb11365927ad.aspx</pingback:target>
      <dc:creator>Miguel A. Castro</dc:creator>
      <wfw:comment>http://www.dotnetdude.com/CommentView,guid,572a71f7-bbab-4da8-88dc-bb11365927ad.aspx</wfw:comment>
      <wfw:commentRss>http://www.dotnetdude.com/SyndicationService.asmx/GetEntryCommentsRss?guid=572a71f7-bbab-4da8-88dc-bb11365927ad</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Funny how 10 years ago, I was reading publications and listening to sessions by many
of the people that today I have the honor and pleasure of calling my friends. It’s
been a hell of a ride being active in the .NET community and I owe a lot of the beginnings
of that to INETA. Traveling around the country, speaking at user groups and meeting
many, many talented developers (some of whom have become friends of mine) has been
one of the highlights of my community involvement. It was another good friend of mine,
Bill Wolff, that introduced me to INETA and since then there have been a number of
good people involved. Nancy, Scott, Rob, Chris, Trish, Lori, and many others. All
of them made the organization a big priority in their lives and careers and it thrives
today because of that collective effort. And it’s not just about the fun I and others
have had as speakers; many user groups owe a lot to INETA for their support. I hope
the organization continues to be the glue for the symbiotic relationship between those
who run the groups and those who speak at them.
</p>
        <p>
So a lot has evolved and changed over the years in the formula that defines the interaction
between the groups and the speakers, but one thing has remained. INETA is still the
primary user group support mechanism out there. I still get to travel around and speak
to great developers around the country and sample what they try to pass of as pizza
(they forget I’m from Jersey). 
</p>
        <p>
Happy anniversary INETA; may the next 10 years be even better, even though pizza outside
of Jersey will probably get worse.
</p>
        <h3>
          <em>Until next time…</em>
        </h3>
        <img width="0" height="0" src="http://www.dotnetdude.com/aggbug.ashx?id=572a71f7-bbab-4da8-88dc-bb11365927ad" />
      </body>
      <title>Happy 10th Anniversary INETA</title>
      <guid isPermaLink="false">http://www.dotnetdude.com/PermaLink,guid,572a71f7-bbab-4da8-88dc-bb11365927ad.aspx</guid>
      <link>http://www.dotnetdude.com/2012/02/01/Happy10thAnniversaryINETA.aspx</link>
      <pubDate>Wed, 01 Feb 2012 16:26:58 GMT</pubDate>
      <description>&lt;p&gt;
Funny how 10 years ago, I was reading publications and listening to sessions by many
of the people that today I have the honor and pleasure of calling my friends. It’s
been a hell of a ride being active in the .NET community and I owe a lot of the beginnings
of that to INETA. Traveling around the country, speaking at user groups and meeting
many, many talented developers (some of whom have become friends of mine) has been
one of the highlights of my community involvement. It was another good friend of mine,
Bill Wolff, that introduced me to INETA and since then there have been a number of
good people involved. Nancy, Scott, Rob, Chris, Trish, Lori, and many others. All
of them made the organization a big priority in their lives and careers and it thrives
today because of that collective effort. And it’s not just about the fun I and others
have had as speakers; many user groups owe a lot to INETA for their support. I hope
the organization continues to be the glue for the symbiotic relationship between those
who run the groups and those who speak at them.
&lt;/p&gt;
&lt;p&gt;
So a lot has evolved and changed over the years in the formula that defines the interaction
between the groups and the speakers, but one thing has remained. INETA is still the
primary user group support mechanism out there. I still get to travel around and speak
to great developers around the country and sample what they try to pass of as pizza
(they forget I’m from Jersey). 
&lt;/p&gt;
&lt;p&gt;
Happy anniversary INETA; may the next 10 years be even better, even though pizza outside
of Jersey will probably get worse.
&lt;/p&gt;
&lt;h3&gt;&lt;em&gt;Until next time…&lt;/em&gt;
&lt;/h3&gt;
&lt;img width="0" height="0" src="http://www.dotnetdude.com/aggbug.ashx?id=572a71f7-bbab-4da8-88dc-bb11365927ad" /&gt;</description>
      <comments>http://www.dotnetdude.com/CommentView,guid,572a71f7-bbab-4da8-88dc-bb11365927ad.aspx</comments>
    </item>
    <item>
      <trackback:ping>http://www.dotnetdude.com/Trackback.aspx?guid=caf5772f-866f-4a36-97ee-44a700d3445e</trackback:ping>
      <pingback:server>http://www.dotnetdude.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.dotnetdude.com/PermaLink,guid,caf5772f-866f-4a36-97ee-44a700d3445e.aspx</pingback:target>
      <dc:creator>Miguel A. Castro</dc:creator>
      <wfw:comment>http://www.dotnetdude.com/CommentView,guid,caf5772f-866f-4a36-97ee-44a700d3445e.aspx</wfw:comment>
      <wfw:commentRss>http://www.dotnetdude.com/SyndicationService.asmx/GetEntryCommentsRss?guid=caf5772f-866f-4a36-97ee-44a700d3445e</wfw:commentRss>
      <slash:comments>3</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I’m headed to the <a href="http://www.vslive.com" target="_blank">Visual Studio Live</a> conference
in Las Vegas on Sunday. I'll be doing a full-day precon on WCF on Monday then two
WPF talks on Tuesday.
</p>
        <p>
If you’re going to be there, please stop by and say hi !
</p>
        <img width="0" height="0" src="http://www.dotnetdude.com/aggbug.ashx?id=caf5772f-866f-4a36-97ee-44a700d3445e" />
      </body>
      <title>Upcoming Visual Studio Live next week</title>
      <guid isPermaLink="false">http://www.dotnetdude.com/PermaLink,guid,caf5772f-866f-4a36-97ee-44a700d3445e.aspx</guid>
      <link>http://www.dotnetdude.com/2011/04/15/UpcomingVisualStudioLiveNextWeek.aspx</link>
      <pubDate>Fri, 15 Apr 2011 16:26:50 GMT</pubDate>
      <description>&lt;p&gt;
I’m headed to the &lt;a href="http://www.vslive.com" target="_blank"&gt;Visual Studio Live&lt;/a&gt; conference
in Las Vegas on Sunday. I'll be doing a full-day precon on WCF on Monday then two
WPF talks on Tuesday.
&lt;/p&gt;
&lt;p&gt;
If you’re going to be there, please stop by and say hi !
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.dotnetdude.com/aggbug.ashx?id=caf5772f-866f-4a36-97ee-44a700d3445e" /&gt;</description>
      <comments>http://www.dotnetdude.com/CommentView,guid,caf5772f-866f-4a36-97ee-44a700d3445e.aspx</comments>
      <category>Speaking Events</category>
    </item>
    <item>
      <trackback:ping>http://www.dotnetdude.com/Trackback.aspx?guid=cb7f3676-6b5e-4a1c-87ec-f9b4b8a95370</trackback:ping>
      <pingback:server>http://www.dotnetdude.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.dotnetdude.com/PermaLink,guid,cb7f3676-6b5e-4a1c-87ec-f9b4b8a95370.aspx</pingback:target>
      <dc:creator>Miguel A. Castro</dc:creator>
      <wfw:comment>http://www.dotnetdude.com/CommentView,guid,cb7f3676-6b5e-4a1c-87ec-f9b4b8a95370.aspx</wfw:comment>
      <wfw:commentRss>http://www.dotnetdude.com/SyndicationService.asmx/GetEntryCommentsRss?guid=cb7f3676-6b5e-4a1c-87ec-f9b4b8a95370</wfw:commentRss>
      <slash:comments>2</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <strong>
            <em>Update:</em>
          </strong>
        </p>
        <p>
Nice blog post from an attendee: <a href="http://bejabbers2.blogspot.com/2011/03/inaugural-devready-event-on-mvvm.html">http://bejabbers2.blogspot.com/2011/03/inaugural-devready-event-on-mvvm.html</a></p>
        <p>
----------------------------------------------------
</p>
        <p>
A big thank you to all who made it out to the <a href="http://www.devready.net/" target="_blank">DevReady</a> MVVM
events we put together on the 19th and the 21st in the Microsoft Philly and NYC offices!
</p>
        <p>
The turnout was fantastic and the feedback I’ve seen so far has exceeded my expectations.
</p>
        <p>
We had five sessions set up and they went as follows:
</p>
        <ol>
          <li>
XAML: Achieving your moment of clarity 
</li>
          <li>
Programming with MVVM 
</li>
          <li>
Programming with MVVM – Advanced Topics 
</li>
          <li>
Platform Reusability with MVVM – also known as “How MVVM saved my butt and how laziness
came back to bite me” 
</li>
          <li>
Intro to Prism – previously “Leveraging Controls to Build XAML-based applications”</li>
        </ol>
        <p>
The first three sessions were done by me in what can be construed as a very painful
delivery process, but not because of the sessions. A couple of days before, I woke
up with an inflamed nerve in my left hip and I was in pretty intense pain for a while.
I was walking with a cane and was popping Alleve like Dr. House pops Vitaken. By the
time the first event (Philly) came around, I was better but nowhere near 100%. Luckily
it was offset by a beautiful day on Thursday and I got to ride from Jersey down to
Philly Intl. with the top down, seriously raising my mood.
</p>
        <p>
What was I doing in Philly Intl you ask? That gets me to the most important point
regarding these events. I was picking up a friend of mine who’s an evangelist for <a href="http://www.devexpress.com" target="_blank">DevExpress</a>.
DevExpress graciously put up the sole sponsorship for both these events and provided
everyone with both breakfast and lunch, along with several product licenses. On top
of that, they flew <a href="http://community.devexpress.com/blogs/seth/default.aspx" target="_blank">Seth
Juarez</a> out to deliver one of the sessions, during which Seth also demonstrated
the power and versatility of using DevExpress tools in WPF and Silverlight while also
teaching attendees how to use the Prism framework.
</p>
        <p>
          <a href="http://smallandmighty.net/" target="_blank">Dani Diaz</a>, the Microsoft
Developer Evangelist for the Philly area delivered the fourth session at both events.
Dani did a terrific job showing everyone how to take what I had just taught them and
reuse it among a desktop and Phone 7 application.
</p>
        <p>
Also, a great thank you to my own Developer Evangelist, <a href="http://blogs.msdn.com/b/peterlau/" target="_blank">Peter
Laudati</a>, for putting together all the tedious logistics at the NY offices. Anyone
who has ever tried to throw an event in any Microsoft office knows that it is not
a trivial process logistically and kudos goes out to both Peter and Dani for grabbing
the bull by the horns on this one.
</p>
        <p>
We’ve already received requests for repeating this event in other regions, possibly
starting with the Capital Area, so DC here we come.
</p>
        <p>
Once again, thank you to all involved in the events and thank you to the attendees
for making it so much fun and putting up with my bizarre and sometimes unorthodox
sense of humor; and most of all thank you to <a href="www.devexpress.com" target="_blank">Developer
Express</a>, without whom these events could not have taken place.
</p>
        <p>
Stay on top of the <a href="http://www.devready.net/" target="_blank">DevReady</a> web
site. There you can find out about more events and also about exactly what the DevReady
concept is.
</p>
        <p>
My session material for both these events can be found on the <a href="www.dotnetdude.com/downloads" target="_blank">Downloads</a> section
of this site. The rest can be found on the <a href="http://www.devready.net/" target="_blank">DevReady</a> web
site.
</p>
        <p>
 
</p>
        <h3>
          <em>Until next time…</em>
        </h3>
        <img width="0" height="0" src="http://www.dotnetdude.com/aggbug.ashx?id=cb7f3676-6b5e-4a1c-87ec-f9b4b8a95370" />
      </body>
      <title>Get DevReady with MVVM–Success!</title>
      <guid isPermaLink="false">http://www.dotnetdude.com/PermaLink,guid,cb7f3676-6b5e-4a1c-87ec-f9b4b8a95370.aspx</guid>
      <link>http://www.dotnetdude.com/2011/03/25/GetDevReadyWithMVVMSuccess.aspx</link>
      <pubDate>Fri, 25 Mar 2011 15:34:28 GMT</pubDate>
      <description>&lt;p&gt;
&lt;strong&gt;&lt;em&gt;Update:&lt;/em&gt;&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
Nice blog post from an attendee: &lt;a href="http://bejabbers2.blogspot.com/2011/03/inaugural-devready-event-on-mvvm.html"&gt;http://bejabbers2.blogspot.com/2011/03/inaugural-devready-event-on-mvvm.html&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
----------------------------------------------------
&lt;/p&gt;
&lt;p&gt;
A big thank you to all who made it out to the &lt;a href="http://www.devready.net/" target="_blank"&gt;DevReady&lt;/a&gt; MVVM
events we put together on the 19th and the 21st in the Microsoft Philly and NYC offices!
&lt;/p&gt;
&lt;p&gt;
The turnout was fantastic and the feedback I’ve seen so far has exceeded my expectations.
&lt;/p&gt;
&lt;p&gt;
We had five sessions set up and they went as follows:
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
XAML: Achieving your moment of clarity 
&lt;li&gt;
Programming with MVVM 
&lt;li&gt;
Programming with MVVM – Advanced Topics 
&lt;li&gt;
Platform Reusability with MVVM – also known as “How MVVM saved my butt and how laziness
came back to bite me” 
&lt;li&gt;
Intro to Prism – previously “Leveraging Controls to Build XAML-based applications”&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
The first three sessions were done by me in what can be construed as a very painful
delivery process, but not because of the sessions. A couple of days before, I woke
up with an inflamed nerve in my left hip and I was in pretty intense pain for a while.
I was walking with a cane and was popping Alleve like Dr. House pops Vitaken. By the
time the first event (Philly) came around, I was better but nowhere near 100%. Luckily
it was offset by a beautiful day on Thursday and I got to ride from Jersey down to
Philly Intl. with the top down, seriously raising my mood.
&lt;/p&gt;
&lt;p&gt;
What was I doing in Philly Intl you ask? That gets me to the most important point
regarding these events. I was picking up a friend of mine who’s an evangelist for &lt;a href="http://www.devexpress.com" target="_blank"&gt;DevExpress&lt;/a&gt;.
DevExpress graciously put up the sole sponsorship for both these events and provided
everyone with both breakfast and lunch, along with several product licenses. On top
of that, they flew &lt;a href="http://community.devexpress.com/blogs/seth/default.aspx" target="_blank"&gt;Seth
Juarez&lt;/a&gt; out to deliver one of the sessions, during which Seth also demonstrated
the power and versatility of using DevExpress tools in WPF and Silverlight while also
teaching attendees how to use the Prism framework.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://smallandmighty.net/" target="_blank"&gt;Dani Diaz&lt;/a&gt;, the Microsoft
Developer Evangelist for the Philly area delivered the fourth session at both events.
Dani did a terrific job showing everyone how to take what I had just taught them and
reuse it among a desktop and Phone 7 application.
&lt;/p&gt;
&lt;p&gt;
Also, a great thank you to my own Developer Evangelist, &lt;a href="http://blogs.msdn.com/b/peterlau/" target="_blank"&gt;Peter
Laudati&lt;/a&gt;, for putting together all the tedious logistics at the NY offices. Anyone
who has ever tried to throw an event in any Microsoft office knows that it is not
a trivial process logistically and kudos goes out to both Peter and Dani for grabbing
the bull by the horns on this one.
&lt;/p&gt;
&lt;p&gt;
We’ve already received requests for repeating this event in other regions, possibly
starting with the Capital Area, so DC here we come.
&lt;/p&gt;
&lt;p&gt;
Once again, thank you to all involved in the events and thank you to the attendees
for making it so much fun and putting up with my bizarre and sometimes unorthodox
sense of humor; and most of all thank you to &lt;a href="www.devexpress.com" target="_blank"&gt;Developer
Express&lt;/a&gt;, without whom these events could not have taken place.
&lt;/p&gt;
&lt;p&gt;
Stay on top of the &lt;a href="http://www.devready.net/" target="_blank"&gt;DevReady&lt;/a&gt; web
site. There you can find out about more events and also about exactly what the DevReady
concept is.
&lt;/p&gt;
&lt;p&gt;
My session material for both these events can be found on the &lt;a href="www.dotnetdude.com/downloads" target="_blank"&gt;Downloads&lt;/a&gt; section
of this site. The rest can be found on the &lt;a href="http://www.devready.net/" target="_blank"&gt;DevReady&lt;/a&gt; web
site.
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;h3&gt;&lt;em&gt;Until next time…&lt;/em&gt;
&lt;/h3&gt;
&lt;img width="0" height="0" src="http://www.dotnetdude.com/aggbug.ashx?id=cb7f3676-6b5e-4a1c-87ec-f9b4b8a95370" /&gt;</description>
      <comments>http://www.dotnetdude.com/CommentView,guid,cb7f3676-6b5e-4a1c-87ec-f9b4b8a95370.aspx</comments>
    </item>
    <item>
      <trackback:ping>http://www.dotnetdude.com/Trackback.aspx?guid=26f80ed0-a2d4-4692-b9bf-bed9f2394dc7</trackback:ping>
      <pingback:server>http://www.dotnetdude.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.dotnetdude.com/PermaLink,guid,26f80ed0-a2d4-4692-b9bf-bed9f2394dc7.aspx</pingback:target>
      <dc:creator>Miguel A. Castro</dc:creator>
      <wfw:comment>http://www.dotnetdude.com/CommentView,guid,26f80ed0-a2d4-4692-b9bf-bed9f2394dc7.aspx</wfw:comment>
      <wfw:commentRss>http://www.dotnetdude.com/SyndicationService.asmx/GetEntryCommentsRss?guid=26f80ed0-a2d4-4692-b9bf-bed9f2394dc7</wfw:commentRss>
      <slash:comments>9</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I’m running two events in the northeast called MVVM DevReady coming up this month.
</p>
        <p>
The first one is in Philly (Malvern actually) and will run on Saturday the 19th of
March.  The second is the following Monday, the 21st, in the NYC Microsoft office.
</p>
        <p>
Both events are <strong>FREE</strong> of charge but registration is limited and is
quickly filling up.  We just put up the registration site yesterday and are more
than half full already.
</p>
        <p>
I will be giving the first three sessions, with the local DE giving the fourth, and
our sponsor providing the last session of the day. These events could not have been
possible if not for our sponsor, <a href="http://www.devexpress.com/" target="_blank">Developer
Express</a>.  They are not only covering event expenses but are flying out one
of their chief evangelists, <a href="http://community.devexpress.com/blogs/seth/default.aspx" target="_blank">Seth
Juarez</a>, to present the session personally.
</p>
        <p>
The registration sites are:
</p>
        <p>
3/19/2011 - Philly: <a href="http://devready-estw.eventbrite.com/">http://devready-estw.eventbrite.com/</a></p>
        <p>
3/21/2011 - NYC: <a href="http://devreadynyc.eventbrite.com/">http://devreadynyc.eventbrite.com/</a></p>
        <p>
          <br />
Get your development skills ready for MVVM (Model View View Model Design Pattern)
and build some exciting applications for WPF, Silverlight or Windows Phone. In this
all day event you will learn everything you need to know to get start with MVVM. We
will start with the basics and end with some more advance topics. 
</p>
        <img width="0" height="0" src="http://www.dotnetdude.com/aggbug.ashx?id=26f80ed0-a2d4-4692-b9bf-bed9f2394dc7" />
      </body>
      <title>MVVM DevReady Events in NYC &amp; Philly</title>
      <guid isPermaLink="false">http://www.dotnetdude.com/PermaLink,guid,26f80ed0-a2d4-4692-b9bf-bed9f2394dc7.aspx</guid>
      <link>http://www.dotnetdude.com/2011/03/09/MVVMDevReadyEventsInNYCPhilly.aspx</link>
      <pubDate>Wed, 09 Mar 2011 20:17:43 GMT</pubDate>
      <description>&lt;p&gt;
I’m running two events in the northeast called MVVM DevReady coming up this month.
&lt;/p&gt;
&lt;p&gt;
The first one is in Philly (Malvern actually) and will run on Saturday the 19th of
March.&amp;nbsp; The second is the following Monday, the 21st, in the NYC Microsoft office.
&lt;/p&gt;
&lt;p&gt;
Both events are &lt;strong&gt;FREE&lt;/strong&gt; of charge but registration is limited and is
quickly filling up.&amp;nbsp; We just put up the registration site yesterday and are more
than half full already.
&lt;/p&gt;
&lt;p&gt;
I will be giving the first three sessions, with the local DE giving the fourth, and
our sponsor providing the last session of the day. These events could not have been
possible if not for our sponsor, &lt;a href="http://www.devexpress.com/" target="_blank"&gt;Developer
Express&lt;/a&gt;.&amp;nbsp; They are not only covering event expenses but are flying out one
of their chief evangelists, &lt;a href="http://community.devexpress.com/blogs/seth/default.aspx" target="_blank"&gt;Seth
Juarez&lt;/a&gt;, to present the session personally.
&lt;/p&gt;
&lt;p&gt;
The registration sites are:
&lt;/p&gt;
&lt;p&gt;
3/19/2011 - Philly: &lt;a href="http://devready-estw.eventbrite.com/"&gt;http://devready-estw.eventbrite.com/&lt;/a&gt; 
&lt;p&gt;
3/21/2011 - NYC: &lt;a href="http://devreadynyc.eventbrite.com/"&gt;http://devreadynyc.eventbrite.com/&lt;/a&gt; 
&lt;p&gt;
&lt;br&gt;
Get your development skills ready for MVVM (Model View View Model Design Pattern)
and build some exciting applications for WPF, Silverlight or Windows Phone. In this
all day event you will learn everything you need to know to get start with MVVM. We
will start with the basics and end with some more advance topics. 
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.dotnetdude.com/aggbug.ashx?id=26f80ed0-a2d4-4692-b9bf-bed9f2394dc7" /&gt;</description>
      <comments>http://www.dotnetdude.com/CommentView,guid,26f80ed0-a2d4-4692-b9bf-bed9f2394dc7.aspx</comments>
      <category>Dev Stuff</category>
      <category>Speaking Events</category>
    </item>
    <item>
      <trackback:ping>http://www.dotnetdude.com/Trackback.aspx?guid=982904ee-baaa-42b4-a5e8-496be9c98009</trackback:ping>
      <pingback:server>http://www.dotnetdude.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.dotnetdude.com/PermaLink,guid,982904ee-baaa-42b4-a5e8-496be9c98009.aspx</pingback:target>
      <dc:creator>Miguel A. Castro</dc:creator>
      <wfw:comment>http://www.dotnetdude.com/CommentView,guid,982904ee-baaa-42b4-a5e8-496be9c98009.aspx</wfw:comment>
      <wfw:commentRss>http://www.dotnetdude.com/SyndicationService.asmx/GetEntryCommentsRss?guid=982904ee-baaa-42b4-a5e8-496be9c98009</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I’ve been beating my head against the wall with a small problem and after lots of
trial and error, and some searching around, I found the answer – and it was NOT obvious
!
</p>
        <p>
The problem space was simple and common:
</p>
        <p>
I have placed a lot of my styles, data templates, and converters into separate XAML
files (ResourceDictionaries), with the idea of just declaring them in the App.Xaml
since I’m pretty much using these all over the application.  I started out declaring
things in my App.Xaml like this:
</p>
        <p>
 
</p>
        <pre class="brush: xml;">&lt;Application.Resources&gt;
    &lt;controls:BooleanToVisibilityConverter x:Key="booleanToVisibilityConverter" /&gt;
    &lt;refractionConverter:ReverseBooleanToVisibilityConverter x:Key="reverseBooleanToVisibilityConverter" /&gt;
    &lt;refractionConverter:PercentageConverter x:Key="percentageConverter" /&gt;
    &lt;ResourceDictionary&gt;
        &lt;ResourceDictionary.MergedDictionaries&gt;
            &lt;ResourceDictionary&gt;
            &lt;/ResourceDictionary&gt;
            &lt;ResourceDictionary Source="Resources/SharedResources.xaml" /&gt;
            &lt;ResourceDictionary Source="Resources/MdiTemplates.xaml" /&gt;
        &lt;/ResourceDictionary.MergedDictionaries&gt;
    &lt;/ResourceDictionary&gt;
&lt;/Application.Resources&gt;

</pre>
        <p>
 
</p>
        <p>
Looks simple enough right?  Wrong.
</p>
        <p>
The second I moved the converters from the individual User Controls to the <strong>App.Xaml</strong>,
styles that are declared in the <strong>SharedResources.xaml</strong> file became
unreachable.  In my debugging efforts, I tapped into the <strong>Application_Startup</strong> event
to examine the resources that WPF was loading.  I noticed that the value of <strong>this.Resources.Count</strong> was <strong>4</strong>,
but the value of <strong>this.Resources.MergedDictionaries.Count</strong> was <strong>0</strong>.  
</p>
        <p>
So I continued digging and here’s what I found out:
</p>
        <p>
Once you commit to using <strong>MergedDictionaries</strong> in your <strong>App.Xaml</strong>,
you must use them for everything.  I moved the three converters inside the <strong>MergedDictionaries</strong> section
and tested the debugging again.  This time, <strong>this.Resources.Count</strong> was
set to <strong>0</strong>, and <strong>this.Resources.MergedDictionaries.Count</strong> was
set to <strong>3</strong>.  This told me the resources I listed as <strong>MergedDictionaries</strong> were
now loading.  The key indicator that things were better is that my styles now
worked.
</p>
        <p>
Here’s the code:
</p>
        <p>
 
</p>
        <pre class="brush: xml;">&lt;Application.Resources&gt;
    &lt;ResourceDictionary&gt;
        &lt;ResourceDictionary.MergedDictionaries&gt;
            &lt;ResourceDictionary&gt;
                &lt;controls:BooleanToVisibilityConverter x:Key="booleanToVisibilityConverter" /&gt;
                &lt;refractionConverter:ReverseBooleanToVisibilityConverter x:Key="reverseBooleanToVisibilityConverter" /&gt;
                &lt;refractionConverter:PercentageConverter x:Key="percentageConverter" /&gt;
            &lt;/ResourceDictionary&gt;
            &lt;ResourceDictionary Source="Resources/SharedResources.xaml" /&gt;
            &lt;ResourceDictionary Source="Resources/MdiTemplates.xaml" /&gt;
        &lt;/ResourceDictionary.MergedDictionaries&gt;
    &lt;/ResourceDictionary&gt;
&lt;/Application.Resources&gt;

</pre>
        <p>
 
</p>
        <p>
I hope this helps since believe it or not, though there’s a lot of code samples out
there, much of it is unclear and flat out wrong.
</p>
        <h3>
          <em>Until next time…</em>
        </h3>
        <img width="0" height="0" src="http://www.dotnetdude.com/aggbug.ashx?id=982904ee-baaa-42b4-a5e8-496be9c98009" />
      </body>
      <title>Resource Dictionaries Are Making My Hair Hurt!</title>
      <guid isPermaLink="false">http://www.dotnetdude.com/PermaLink,guid,982904ee-baaa-42b4-a5e8-496be9c98009.aspx</guid>
      <link>http://www.dotnetdude.com/2011/01/23/ResourceDictionariesAreMakingMyHairHurt.aspx</link>
      <pubDate>Sun, 23 Jan 2011 20:24:02 GMT</pubDate>
      <description>&lt;p&gt;
I’ve been beating my head against the wall with a small problem and after lots of
trial and error, and some searching around, I found the answer – and it was NOT obvious
!
&lt;/p&gt;
&lt;p&gt;
The problem space was simple and common:
&lt;/p&gt;
&lt;p&gt;
I have placed a lot of my styles, data templates, and converters into separate XAML
files (ResourceDictionaries), with the idea of just declaring them in the App.Xaml
since I’m pretty much using these all over the application.&amp;nbsp; I started out declaring
things in my App.Xaml like this:
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;pre class="brush: xml;"&gt;&amp;lt;Application.Resources&amp;gt;
    &amp;lt;controls:BooleanToVisibilityConverter x:Key="booleanToVisibilityConverter" /&amp;gt;
    &amp;lt;refractionConverter:ReverseBooleanToVisibilityConverter x:Key="reverseBooleanToVisibilityConverter" /&amp;gt;
    &amp;lt;refractionConverter:PercentageConverter x:Key="percentageConverter" /&amp;gt;
    &amp;lt;ResourceDictionary&amp;gt;
        &amp;lt;ResourceDictionary.MergedDictionaries&amp;gt;
            &amp;lt;ResourceDictionary&amp;gt;
            &amp;lt;/ResourceDictionary&amp;gt;
            &amp;lt;ResourceDictionary Source="Resources/SharedResources.xaml" /&amp;gt;
            &amp;lt;ResourceDictionary Source="Resources/MdiTemplates.xaml" /&amp;gt;
        &amp;lt;/ResourceDictionary.MergedDictionaries&amp;gt;
    &amp;lt;/ResourceDictionary&amp;gt;
&amp;lt;/Application.Resources&amp;gt;

&lt;/pre&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
Looks simple enough right?&amp;nbsp; Wrong.
&lt;/p&gt;
&lt;p&gt;
The second I moved the converters from the individual User Controls to the &lt;strong&gt;App.Xaml&lt;/strong&gt;,
styles that are declared in the &lt;strong&gt;SharedResources.xaml&lt;/strong&gt; file became
unreachable.&amp;nbsp; In my debugging efforts, I tapped into the &lt;strong&gt;Application_Startup&lt;/strong&gt; event
to examine the resources that WPF was loading.&amp;nbsp; I noticed that the value of &lt;strong&gt;this.Resources.Count&lt;/strong&gt; was &lt;strong&gt;4&lt;/strong&gt;,
but the value of &lt;strong&gt;this.Resources.MergedDictionaries.Count&lt;/strong&gt; was &lt;strong&gt;0&lt;/strong&gt;.&amp;nbsp; 
&lt;/p&gt;
&lt;p&gt;
So I continued digging and here’s what I found out:
&lt;/p&gt;
&lt;p&gt;
Once you commit to using &lt;strong&gt;MergedDictionaries&lt;/strong&gt; in your &lt;strong&gt;App.Xaml&lt;/strong&gt;,
you must use them for everything.&amp;nbsp; I moved the three converters inside the &lt;strong&gt;MergedDictionaries&lt;/strong&gt; section
and tested the debugging again.&amp;nbsp; This time, &lt;strong&gt;this.Resources.Count&lt;/strong&gt; was
set to &lt;strong&gt;0&lt;/strong&gt;, and &lt;strong&gt;this.Resources.MergedDictionaries.Count&lt;/strong&gt; was
set to &lt;strong&gt;3&lt;/strong&gt;.&amp;nbsp; This told me the resources I listed as &lt;strong&gt;MergedDictionaries&lt;/strong&gt; were
now loading.&amp;nbsp; The key indicator that things were better is that my styles now
worked.
&lt;/p&gt;
&lt;p&gt;
Here’s the code:
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;pre class="brush: xml;"&gt;&amp;lt;Application.Resources&amp;gt;
    &amp;lt;ResourceDictionary&amp;gt;
        &amp;lt;ResourceDictionary.MergedDictionaries&amp;gt;
            &amp;lt;ResourceDictionary&amp;gt;
                &amp;lt;controls:BooleanToVisibilityConverter x:Key="booleanToVisibilityConverter" /&amp;gt;
                &amp;lt;refractionConverter:ReverseBooleanToVisibilityConverter x:Key="reverseBooleanToVisibilityConverter" /&amp;gt;
                &amp;lt;refractionConverter:PercentageConverter x:Key="percentageConverter" /&amp;gt;
            &amp;lt;/ResourceDictionary&amp;gt;
            &amp;lt;ResourceDictionary Source="Resources/SharedResources.xaml" /&amp;gt;
            &amp;lt;ResourceDictionary Source="Resources/MdiTemplates.xaml" /&amp;gt;
        &amp;lt;/ResourceDictionary.MergedDictionaries&amp;gt;
    &amp;lt;/ResourceDictionary&amp;gt;
&amp;lt;/Application.Resources&amp;gt;

&lt;/pre&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
I hope this helps since believe it or not, though there’s a lot of code samples out
there, much of it is unclear and flat out wrong.
&lt;/p&gt;
&lt;h3&gt;&lt;em&gt;Until next time…&lt;/em&gt;
&lt;/h3&gt;
&lt;img width="0" height="0" src="http://www.dotnetdude.com/aggbug.ashx?id=982904ee-baaa-42b4-a5e8-496be9c98009" /&gt;</description>
      <comments>http://www.dotnetdude.com/CommentView,guid,982904ee-baaa-42b4-a5e8-496be9c98009.aspx</comments>
      <category>Dev Stuff</category>
      <category>WPF</category>
    </item>
    <item>
      <trackback:ping>http://www.dotnetdude.com/Trackback.aspx?guid=ad7991b3-12d2-44bf-a39b-4050d18d2850</trackback:ping>
      <pingback:server>http://www.dotnetdude.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.dotnetdude.com/PermaLink,guid,ad7991b3-12d2-44bf-a39b-4050d18d2850.aspx</pingback:target>
      <dc:creator>Miguel A. Castro</dc:creator>
      <wfw:comment>http://www.dotnetdude.com/CommentView,guid,ad7991b3-12d2-44bf-a39b-4050d18d2850.aspx</wfw:comment>
      <wfw:commentRss>http://www.dotnetdude.com/SyndicationService.asmx/GetEntryCommentsRss?guid=ad7991b3-12d2-44bf-a39b-4050d18d2850</wfw:commentRss>
      <slash:comments>4</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I’ll be doing a user group triple play this month starting on Tuesday, Dec. 14 at
the <a href="http://www.setfocus.com/n3ug/welcome.aspx" target="_blank">Northern New
Jersey .NET User Group</a>.  On Wednesday, the 15th, I’ll be at the <a href="http://www.phillydotnet.org/SitePages/Home.aspx" target="_blank">Philly
.NET User Group</a>, and on Thursday the 16th, I’ll be visiting the <a href="http://www.nycdotnetdev.com/" target="_blank">New
York City .NET User Group</a>.
</p>
        <p>
The topic will be the same across all three groups, though the name seems to be different
in each one.  I guess the common title would be, “<strong>Programming With MVVM</strong>”. 
Here’s the session description:
</p>
        <p>
WPF overwhelmed us with the most powerful data binding ever released in a development
platform. It seemed there was so much to learn in order to use it, but it really isn't
that complicated. However, to use it to its full potential, you really do need to
introduce the Model-View-ViewModel pattern. The ideas and goal around this pattern
seem to vary from person to person, but the one thing that they all share is that
it provides a point of binding for XAML pages. In this session, I'll show you what
MVVM is and how to use it and what to put in it, in order to get maximum potential
out of XAML binding. I'll even show you how to get a small MVVM Framework going for
sharing across all your applications.
</p>
        <img width="0" height="0" src="http://www.dotnetdude.com/aggbug.ashx?id=ad7991b3-12d2-44bf-a39b-4050d18d2850" />
      </body>
      <title>Upcoming Northeast MVVM Tour</title>
      <guid isPermaLink="false">http://www.dotnetdude.com/PermaLink,guid,ad7991b3-12d2-44bf-a39b-4050d18d2850.aspx</guid>
      <link>http://www.dotnetdude.com/2010/12/01/UpcomingNortheastMVVMTour.aspx</link>
      <pubDate>Wed, 01 Dec 2010 17:18:23 GMT</pubDate>
      <description>&lt;p&gt;
I’ll be doing a user group triple play this month starting on Tuesday, Dec. 14 at
the &lt;a href="http://www.setfocus.com/n3ug/welcome.aspx" target="_blank"&gt;Northern New
Jersey .NET User Group&lt;/a&gt;.&amp;nbsp; On Wednesday, the 15th, I’ll be at the &lt;a href="http://www.phillydotnet.org/SitePages/Home.aspx" target="_blank"&gt;Philly
.NET User Group&lt;/a&gt;, and on Thursday the 16th, I’ll be visiting the &lt;a href="http://www.nycdotnetdev.com/" target="_blank"&gt;New
York City .NET User Group&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
The topic will be the same across all three groups, though the name seems to be different
in each one.&amp;nbsp; I guess the common title would be, “&lt;strong&gt;Programming With MVVM&lt;/strong&gt;”.&amp;nbsp;
Here’s the session description:
&lt;/p&gt;
&lt;p&gt;
WPF overwhelmed us with the most powerful data binding ever released in a development
platform. It seemed there was so much to learn in order to use it, but it really isn't
that complicated. However, to use it to its full potential, you really do need to
introduce the Model-View-ViewModel pattern. The ideas and goal around this pattern
seem to vary from person to person, but the one thing that they all share is that
it provides a point of binding for XAML pages. In this session, I'll show you what
MVVM is and how to use it and what to put in it, in order to get maximum potential
out of XAML binding. I'll even show you how to get a small MVVM Framework going for
sharing across all your applications.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.dotnetdude.com/aggbug.ashx?id=ad7991b3-12d2-44bf-a39b-4050d18d2850" /&gt;</description>
      <comments>http://www.dotnetdude.com/CommentView,guid,ad7991b3-12d2-44bf-a39b-4050d18d2850.aspx</comments>
    </item>
  </channel>
</rss>
