<?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/"
	>

<channel>
	<title>//InterKnowlogy/ Blogs</title>
	<atom:link href="http://blogs.interknowlogy.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.interknowlogy.com</link>
	<description>Blogging the Art of Software</description>
	<lastBuildDate>Wed, 05 Jun 2013 21:30:49 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4.1</generator>
		<item>
		<title>Session 12 of the WinRT Development Class &#8211; Hackathon Results and Prize Giveaways (Links to All Class Materials &amp; Recordings)</title>
		<link>http://blogs.interknowlogy.com/2013/06/05/session-12-of-the-winrt-development-class-hackathon-results-and-prize-giveaways-links-to-all-class-materials-recordings/</link>
		<comments>http://blogs.interknowlogy.com/2013/06/05/session-12-of-the-winrt-development-class-hackathon-results-and-prize-giveaways-links-to-all-class-materials-recordings/#comments</comments>
		<pubDate>Wed, 05 Jun 2013 21:01:12 +0000</pubDate>
		<dc:creator>Danny Warren</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Hackathon]]></category>
		<category><![CDATA[Windows 8]]></category>
		<category><![CDATA[WinRT]]></category>

		<guid isPermaLink="false">http://blogs.interknowlogy.com/?p=4216</guid>
		<description><![CDATA[THAT WAS AWESOME!!! We had some killer apps show up to this and I just wanted to say thanks to everyone who showed attended any of our classes. I am very pleased at how well everyone performed. We had some rough patches, but I’d say this class was a huge success! I’d love to hear [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blogs.interknowlogy.com/wp-content/uploads/2013/06/WinRTWebBannerSmall_JPEG.jpg"><img title="WinRTWebBannerSmall_JPEG" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; float: none; padding-top: 0px; padding-left: 0px; margin-left: auto; display: block; padding-right: 0px; border-top-width: 0px; margin-right: auto" border="0" alt="WinRTWebBannerSmall_JPEG" src="http://blogs.interknowlogy.com/wp-content/uploads/2013/06/WinRTWebBannerSmall_JPEG_thumb.jpg" width="186" height="295"></a></p>
<p>THAT WAS AWESOME!!! We had some killer apps show up to this and I just wanted to say thanks to everyone who showed attended any of our classes. I am very pleased at how well everyone performed. We had some rough patches, but I’d say this class was a huge success! I’d love to hear what you thought about it! What can we do to improve it? </p>
<h2>Special Thanks</h2>
<p>First a huge thanks to Kim Schmidt who, despite many struggles during the course of this class, has been an outstanding support. She secured our location and really got this class up and running. So again, a huge thanks to her! Also, vNext_OC has been critical in this event. We want to thank all those who have helped organize the user group and keep it running! Great job! We want to give a special thanks to our hosts Saddleback College. They were tremendous hosts and helped us a ton! And a huge thanks to Microsoft for sponsoring dinner each night. It was delicious! Of course we wouldn’t be anywhere with out our prizes so another giant thanks to Microsoft and Nokia DVLUP who sponsored all of the cool prizes and giveaways! Kevin and I have feel honored and privileged to have worked with such amazing sponsors, leaders, and attendees! Thank you everyone for your participation!</p>
<p><a href="http://blogs.interknowlogy.com/wp-content/uploads/2013/06/WP_20130520_008.jpg"><img title="WP_20130520_008" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; float: none; padding-top: 0px; padding-left: 0px; margin-left: auto; display: block; padding-right: 0px; border-top-width: 0px; margin-right: auto" border="0" alt="WP_20130520_008" src="http://blogs.interknowlogy.com/wp-content/uploads/2013/06/WP_20130520_008_thumb.jpg" width="628" height="355"></a></p>
<h2>Overview Of Sessions</h2>
<h3>Blog Post Links (posts contain links to recorded sessions 2-11):</h3>
<p><a href="http://blogs.interknowlogy.com/2012/11/21/development-environment-for-windows-8/" target="_blank">Development Environment for Windows 8</a></p>
<p><a href="http://blogs.interknowlogy.com/2013/01/17/session-1-2-of-the-winrt-development-class/" target="_blank">Session 1 &amp; 2 of the WinRT Development Class – Introduction, XAML, and WinRT’s Control Framework</a></p>
<p><a href="http://blogs.interknowlogy.com/2013/01/17/session-3-of-the-winrt-development-class/" target="_blank">Session 3 of the WinRT Development Class – App Lifecycle and Navigation</a></p>
<p><a href="http://blogs.interknowlogy.com/2013/01/17/session-4-of-our-winrt-development-course/" target="_blank">Session 4 of the WinRT Development Class – Async/Await, WinRT API, and Security</a></p>
<p><a href="http://blogs.interknowlogy.com/2013/01/30/session-5-of-the-winrt-development-classsearch-and-settings/" target="_blank">Session 5 of the WinRT Development Class – Search and Settings</a></p>
<p><a href="http://blogs.interknowlogy.com/2013/02/07/session-6-of-the-winrt-development-class-share-contract/" target="_blank">Session 6 of the WinRT Development Class – Share Contract</a></p>
<p><a href="http://blogs.interknowlogy.com/2013/02/13/winrt-development-class-spring-break-update/" target="_blank">WinRT Development Class – Spring Break Update</a></p>
<p><a href="http://blogs.interknowlogy.com/2013/03/22/session-7-of-the-winrt-development-class-live-tiles-and-background-tasks/" target="_blank">Session 7 of the WinRT Development Class – Live Tiles and Background Tasks</a></p>
<p><a href="http://blogs.interknowlogy.com/2013/04/03/session-8-of-the-winrt-development-class-orientation-and-near-field-communication/" target="_blank">Session 8 of the WinRT Development Class – Orientation And Near Field Communication</a></p>
<p><a href="http://blogs.interknowlogy.com/2013/04/20/session-9-of-the-winrt-development-class-intro-to-model-view-viewmodel-mvvm/" target="_blank">Session 9 of the WinRT Development Class – Intro to Model-View-ViewModel (MVVM)</a></p>
<p><a href="http://blogs.interknowlogy.com/2013/05/02/session-10-of-the-winrt-development-class-interknowlogys-winrt-mvvm-framework-part-iii/" target="_blank">Session 10 of the WinRT Development Class – InterKnowlogy’s WinRT MVVM Framework Part I/II</a></p>
<p><a href="http://blogs.interknowlogy.com/2013/06/05/session-11-of-the-winrt-development-class-interknowlogys-winrt-mvvm-framework-part-iiii/" target="_blank">Session 11 of the WinRT Development Class – InterKnowlogy’s WinRT MVVM Framework Part II/II</a></p>
<h3>MeetUp Links:</h3>
<p>1. <a href="http://www.meetup.com/vNext-OrangeCounty/events/87939512/">Introductory Lecture</a> (Nov 27th by Danny &amp; Kevin)<br />2. <a href="http://www.meetup.com/vNext-OrangeCounty/events/93054202/">Introduction to XAML and WinRT’s powerful Control Framework; </a>(Dec 4th by Danny &amp; Kevin <a href="mms://ch39.saddleback.edu/TRMSVOD/1233-1.wmv">Click here for the video recording</a>)<br />3. <a href="http://www.meetup.com/vNext-OrangeCounty/events/94231612/">Page-Navigation Model and Application Lifecycle</a> (Jan 8th by Danny <a href="https://vimeo.com/57718588">Click here for the video recording</a>)<br />4. <a href="http://www.meetup.com/vNext-OrangeCounty/events/94231992/">Fundamentals (Async/Await, WinRT API, Security)</a> (Jan 15th by Kevin <a href="https://vimeo.com/57608362">Click here for the video recording</a>)<br />5. <a href="http://www.meetup.com/vNext-OrangeCounty/events/94232082/">Settings and Search Contract</a> (Jan 28th by Danny <a href="http://vimeopro.com/interknowlogy/winrt-development-class/video/58602648">Click here for the video recording</a>)<br />6. <a href="http://www.meetup.com/vNext-OrangeCounty/events/94232262/">Share Contract</a> (Feb 4th by Kevin <a href="https://vimeo.com/59111118">Click here for the video recording</a>)<br />7. <a href="http://www.meetup.com/vNext-OrangeCounty/events/94232412/">Live Tiles and Background Tasks</a> (March 18th by Kevin <a href="https://vimeo.com/62434993">Click here for the video recording</a>)<br />8. <a href="http://www.meetup.com/vNext-OrangeCounty/events/94232572/">Orientation Handling and Proximity using Near Field Communication (NFC)</a> (March 25th by Danny <a href="https://vimeo.com/63297314">Click here for the video recording</a>)<br />9. <a href="http://www.meetup.com/vNext-OrangeCounty/events/94232632/">Introduction to ModelViewViewModel (MVVM)</a> (April 8th by Danny <a href="https://vimeo.com/64254092">Click here for the video recording</a>)<br />10. <a href="http://www.meetup.com/vNext-OrangeCounty/events/94232752/">InterKnowlogy’s WinRT MVVM Framework Session Part I/II</a>(April 22nd by Kevin <a href="https://vimeo.com/65321617">Click here for the video recording</a>)<br />11. <a href="http://www.meetup.com/vNext-OrangeCounty/events/94232842/">InterKnowlogy’s WinRT MVVM Framework Session Part II/II</a>(May 6th by Danny <a href="https://vimeo.com/67268289" target="_blank">Click here for the video recording</a>)<br />12. <a href="http://www.meetup.com/vNext-OrangeCounty/events/94233072/">Presentation of Hackathon Results + Certificate/Prize Giveaway</a>(May 20th by Danny and Kevin)</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.interknowlogy.com/2013/06/05/session-12-of-the-winrt-development-class-hackathon-results-and-prize-giveaways-links-to-all-class-materials-recordings/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Session 11 of the WinRT Development Class &#8211; InterKnowlogy&#8217;s WinRT MVVM Framework Part II/II</title>
		<link>http://blogs.interknowlogy.com/2013/06/05/session-11-of-the-winrt-development-class-interknowlogys-winrt-mvvm-framework-part-iiii/</link>
		<comments>http://blogs.interknowlogy.com/2013/06/05/session-11-of-the-winrt-development-class-interknowlogys-winrt-mvvm-framework-part-iiii/#comments</comments>
		<pubDate>Wed, 05 Jun 2013 20:54:04 +0000</pubDate>
		<dc:creator>Danny Warren</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[MVVM]]></category>
		<category><![CDATA[Windows 8]]></category>
		<category><![CDATA[WinRT]]></category>

		<guid isPermaLink="false">http://blogs.interknowlogy.com/?p=4206</guid>
		<description><![CDATA[That’s a wrap! All code sessions are now complete! Awesome! Now to see the Hackathon results! Session Resources Link to Session Materials Link to Session Recording Overview Of Sessions The links below lead you to Meetup Events where you can RSVP. We look forward to seeing you at our next session! 1. Introductory Lecture (Nov [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blogs.interknowlogy.com/wp-content/uploads/2013/06/WinRTWebBannerSmall_JPEG_thumb1.jpg"><img title="WinRTWebBannerSmall_JPEG_thumb[1]" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; float: none; padding-top: 0px; padding-left: 0px; margin-left: auto; display: block; padding-right: 0px; border-top-width: 0px; margin-right: auto" border="0" alt="WinRTWebBannerSmall_JPEG_thumb[1]" src="http://blogs.interknowlogy.com/wp-content/uploads/2013/06/WinRTWebBannerSmall_JPEG_thumb1_thumb.jpg" width="186" height="295"></a>
<p>That’s a wrap! All code sessions are now complete! Awesome! Now to see the Hackathon results!<br />
<h3>Session Resources</h3>
<ul>
<li><a href="http://blogs.interknowlogy.com/wp-content/uploads/2013/06/Session11Materials.zip" target="_blank">Link to Session Materials</a>
<li><a href="https://vimeo.com/67268289" target="_blank">Link to Session Recording</a></li>
</ul>
<h2>Overview Of Sessions</h2>
<p>The links below lead you to Meetup Events where you can RSVP. We look forward to seeing you at our next session!
<p>1. <a href="http://www.meetup.com/vNext-OrangeCounty/events/87939512/">Introductory Lecture</a> (Nov 27th by Danny &amp; Kevin)<br />2. <a href="http://www.meetup.com/vNext-OrangeCounty/events/93054202/">Introduction to XAML and WinRT’s powerful Control Framework; </a>(Dec 4th by Danny &amp; Kevin <a href="mms://ch39.saddleback.edu/TRMSVOD/1233-1.wmv">Click here for the video recording</a>)<br />3. <a href="http://www.meetup.com/vNext-OrangeCounty/events/94231612/">Page-Navigation Model and Application Lifecycle</a> (Jan 8th by Danny <a href="https://vimeo.com/57718588">Click here for the video recording</a>)<br />4. <a href="http://www.meetup.com/vNext-OrangeCounty/events/94231992/">Fundamentals (Async/Await, WinRT API, Security)</a> (Jan 15th by Kevin <a href="https://vimeo.com/57608362">Click here for the video recording</a>)<br />5. <a href="http://www.meetup.com/vNext-OrangeCounty/events/94232082/">Settings and Search Contract</a> (Jan 28th by Danny <a href="http://vimeopro.com/interknowlogy/winrt-development-class/video/58602648">Click here for the video recording</a>)<br />6. <a href="http://www.meetup.com/vNext-OrangeCounty/events/94232262/">Share Contract</a> (Feb 4th by Kevin <a href="https://vimeo.com/59111118">Click here for the video recording</a>)<br />7. <a href="http://www.meetup.com/vNext-OrangeCounty/events/94232412/">Live Tiles and Background Tasks</a> (March 18th by Kevin <a href="https://vimeo.com/62434993">Click here for the video recording</a>)<br />8. <a href="http://www.meetup.com/vNext-OrangeCounty/events/94232572/">Orientation Handling and Proximity using Near Field Communication (NFC)</a> (March 25th by Danny <a href="https://vimeo.com/63297314">Click here for the video recording</a>)<br />9. <a href="http://www.meetup.com/vNext-OrangeCounty/events/94232632/">Introduction to ModelViewViewModel (MVVM)</a> (April 8th by Danny <a href="https://vimeo.com/64254092">Click here for the video recording</a>)<br />10. <a href="http://www.meetup.com/vNext-OrangeCounty/events/94232752/">InterKnowlogy’s WinRT MVVM Framework Session Part I/II</a>(April 22nd by Kevin <a href="https://vimeo.com/65321617">Click here for the video recording</a>)<br />11. <a href="http://www.meetup.com/vNext-OrangeCounty/events/94232842/">InterKnowlogy’s WinRT MVVM Framework Session Part II/II</a>(May 6th by Danny <a href="https://vimeo.com/67268289" target="_blank">Click here for the video recording</a>)<br />12. <a href="http://www.meetup.com/vNext-OrangeCounty/events/94233072/">Presentation of Hackathon Results + Certificate/Prize Giveaway</a>(May 20th by Danny and Kevin)</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.interknowlogy.com/2013/06/05/session-11-of-the-winrt-development-class-interknowlogys-winrt-mvvm-framework-part-iiii/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PDFX: First Thoughts</title>
		<link>http://blogs.interknowlogy.com/2013/05/29/4188/</link>
		<comments>http://blogs.interknowlogy.com/2013/05/29/4188/#comments</comments>
		<pubDate>Wed, 29 May 2013 22:29:30 +0000</pubDate>
		<dc:creator>mikebev</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blogs.interknowlogy.com/?p=4188</guid>
		<description><![CDATA[Quick poll: raise your hand if you A) are a developer, and B) have ever had to write an application with a complex graph of property dependencies. Keep your hand up if your solution to that complex graph involved some combination of complicated property update methods, a fragile web of events and handlers wired up [...]]]></description>
			<content:encoded><![CDATA[<p>Quick poll: raise your hand if you</p>
<p>A) are a developer, and</p>
<p>B) have ever had to write an application with a complex graph of property dependencies.</p>
<p>Keep your hand up if your solution to that complex graph involved some combination of complicated property update methods, a fragile web of events and handlers wired up between properties, wailing and gnashing of teeth, or all of the above.</p>
<p>Brothers and sisters, put down your hands and download your deliverance: fellow InterKnowlogist Kevin Stumpf recently posted a <a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-i-introduction-2/" title="Intro to PDFx">blog series on his new Property Dependency Framework for .NET applications, PDFx.</a> I&#8217;ve spent the last week or so implementing it for (my) first time on a project here at InterKnowlogy, and wanted to whip up a quick post on my first impressions. Since a code snippet is worth a thousand words, let&#8217;s lead with a quick example:</p>
<pre class="brush: csharp; gutter: false; title: ; notranslate">
//Depends on value of Properties B1 and B2, and returns their summation.
public int A1
{
     get
     {
          Property(() =&gt; A1)
                  .Depends(p =&gt; p.On(() =&gt; B1)
                  .AndOn(() =&gt; B2));
          //&quot;Property A1 depends on B1 and on B2&quot;. How cool is that?
		
          return B1 + B2;
     }
}
</pre>
<p>Yep, it&#8217;s really that simple. Fluent interface, stupid-simple declaration, and all that&#8217;s required is to inherit your model objects from a Bindable base class provided by the framework. And the best part? It all just&#8230; works, like magic. In our example above, any time B1 or B2 change, A1 is automatically reevaluated, as are any other properties dependent upon its value. There&#8217;s all sorts of great documentation on Kevin&#8217;s blog, including great info on advanced features like <a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-vi-external-property-dependencies/" title="external property dependencies">external property dependencies</a>, <a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-viii-collection-dependencies/" title="collection dependencies">collection dependencies</a> (very nifty), and <a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-x-caching/" title="caching">caching</a>. Bottom line: if you develop .NET applications in any capacity of even moderate complexity, <a href="http://pdfx.codeplex.com/" title="PDFx Codeplex">take five minutes to grab the code from CodePlex</a> and check out the documentation, and if you&#8217;re not completely satisfied, I&#8217;ll send you a case of <a href="http://en.wikipedia.org/wiki/K%C3%B6lsch_(beer)">Kölsch</a> as a way of saying entschuldigung.*</p>
<p>*German for &#8220;sorry&#8221;, in honor of Herr Stumpf&#8217;s forefathers.<br />
*Not an actual offer.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.interknowlogy.com/2013/05/29/4188/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PDFx &#8211; Property Dependency Framework &#8211; Part XVI, One Way Converters</title>
		<link>http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-xvi-one-way-converters/</link>
		<comments>http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-xvi-one-way-converters/#comments</comments>
		<pubDate>Fri, 17 May 2013 17:09:30 +0000</pubDate>
		<dc:creator>Kevin Stumpf</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blogs.interknowlogy.com/?p=4141</guid>
		<description><![CDATA[The PDFx is a lightweight open source .NET library that allows developers to describe dependencies between Properties in declarative C# code. Once relationships are registered, the framework monitors property changes and ensures that the INotifyPropertyChanged.PropertyChanged event is fired for all directly and indirectly dependent properties in a very efficient way. The library is available for [...]]]></description>
			<content:encoded><![CDATA[<p>The PDFx is a lightweight open source .NET library that allows developers to describe dependencies between Properties in declarative C# code. Once relationships are registered, the framework monitors property changes and ensures that the <em>INotifyPropertyChanged.PropertyChanged</em> event is fired for all directly and indirectly dependent properties in a very efficient way. The library is available for WPF, Silverlight, WinRT (Windows Store) and Windows Phone.</p>
<p>I’ve developed the PDFx as an InterKnowlogy RECESS project and published the source code and examples on <a href="http://pdfx.codeplex.com">codeplex</a>.</p>
<p>In a series of blog posts I am going to cover the library’s most important features:</p>
<ul>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-i-introduction-2/">Part I: Introduction</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-ii-library-versions/">Part II: Library Versions</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-iii-getting-started/">Part III: Getting Started</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-iv-using-pdfx-with-an-existing-3rd-party-framework/">Part IV: Using PDFx with an existing 3rd party framework</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-v-simple-property-dependencies/">Part V: Simple Property Dependencies</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-vi-external-property-dependencies/">Part VI: External Property Dependencies</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-vii-dynamic-external-property-dependencies/">Part VII: Dynamic External Property Dependencies</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-viii-collection-dependencies/">Part VIII: Collection Dependencies</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-ix-dynamic-collection-dependencies/">Part IX: Dynamic Collection Dependencies</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-x-caching/">Part X: Caching</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-xi-smart-property-changed-notification/">Part XI: Smart Property Changed Notification</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-xii-callbacks/">Part XII: Callbacks</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-xiii-sanity-checks/">Part XIII: Sanity Checks</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-xiv-data-delegation/">Part XIV: Data Delegation</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-xv-two-way-converters/">Part XV: Two Way Converters</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-xvi-one-way-converters/">Part XVI: One Way Converters</a></li>
</ul>
<h1>One Way Converters</h1>
<p><em>Although the following paragraph doesn&#8217;t describe a new feature of the PDFx, it demonstrates a use case that solves a common problem developers face every day, apart from the sole monitoring of large Property Dependency networks.</em></p>
<p><em>The source code of the following example can be found in ViewModel ConverterDemonstrationVM which is part of the WPFSample&#8217;s source code.</em></p>
<p>In <a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-xv-two-way-converters/">Two Way Converters</a> I argue that value converters should be used exclusively to convert business domain data to UI specific data rather than to solely transform business domain data. I also showed how the PDFx can be employed to render two-way value converters, which convert domain data, redundant. The very same pattern can be applied to mimic the behavior of one way value converters in your ViewModel:</p>
<div style="color: black; background-color: white">
<pre><span style="color: blue">class</span> ViewModel : BindableExt
{
	<span style="color: blue">private</span> Model Model { <span style="color: blue">get</span>; <span style="color: blue">set</span>; }

	<span style="color: blue">public</span> <span style="color: blue">string</span> MoneyQuantification
	{
		<span style="color: blue">get</span>
		{
			Property(() =&gt; MoneyQuantification)
				.Depends(p =&gt; p.On(Model, k =&gt; k.MoneyInEuros));

			<span style="color: blue">if</span> (Model.MoneyInEuros &lt; 0)
			{
				<span style="color: blue">return</span> <span style="color: #a31515">"Not too much"</span>;
			}

			<span style="color: blue">if</span> (Model.MoneyInEuros &lt; 1000)
			{
				<span style="color: blue">return</span> <span style="color: #a31515">"A Little"</span>;
			}

			<span style="color: blue">if</span> (Model.MoneyInEuros &lt; 10000)
			{
				<span style="color: blue">return</span> <span style="color: #a31515">"Quite some"</span>;
			}

			<span style="color: blue">return</span> <span style="color: #a31515">"A Lot"</span>;
		}
	}
}

<span style="color: blue">class</span> Model : BindableExt
{
	<span style="color: blue">private</span> <span style="color: blue">double</span> _moneyInEuros = 100;
	<span style="color: blue">public</span> <span style="color: blue">double</span> MoneyInEuros
	{
		<span style="color: blue">get</span> { <span style="color: blue">return</span> _moneyInEuros; }
		<span style="color: blue">set</span>
		{
			_moneyInEuros = value;
			NotifyPropertyChanged(() =&gt; MoneyInEuros);
		}
	}
}
</pre>
</div>
<p>In this scenario, the PDFx ensures that the <em>MoneyQuantification</em> Property gets reevaluated whenever the Model&#8217;s <em>MoneyInEuros</em> Property changes.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-xvi-one-way-converters/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>PDFx &#8211; Property Dependency Framework &#8211; Part XV, Two Way Converters</title>
		<link>http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-xv-two-way-converters/</link>
		<comments>http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-xv-two-way-converters/#comments</comments>
		<pubDate>Fri, 17 May 2013 17:08:00 +0000</pubDate>
		<dc:creator>Kevin Stumpf</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blogs.interknowlogy.com/?p=4139</guid>
		<description><![CDATA[The PDFx is a lightweight open source .NET library that allows developers to describe dependencies between Properties in declarative C# code. Once relationships are registered, the framework monitors property changes and ensures that the INotifyPropertyChanged.PropertyChanged event is fired for all directly and indirectly dependent properties in a very efficient way. The library is available for [...]]]></description>
			<content:encoded><![CDATA[<p>The PDFx is a lightweight open source .NET library that allows developers to describe dependencies between Properties in declarative C# code. Once relationships are registered, the framework monitors property changes and ensures that the <em>INotifyPropertyChanged.PropertyChanged</em> event is fired for all directly and indirectly dependent properties in a very efficient way. The library is available for WPF, Silverlight, WinRT (Windows Store) and Windows Phone.</p>
<p>I’ve developed the PDFx as an InterKnowlogy RECESS project and published the source code and examples on <a href="http://pdfx.codeplex.com">codeplex</a>.</p>
<p>In a series of blog posts I am going to cover the library’s most important features:</p>
<ul>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-i-introduction-2/">Part I: Introduction</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-ii-library-versions/">Part II: Library Versions</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-iii-getting-started/">Part III: Getting Started</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-iv-using-pdfx-with-an-existing-3rd-party-framework/">Part IV: Using PDFx with an existing 3rd party framework</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-v-simple-property-dependencies/">Part V: Simple Property Dependencies</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-vi-external-property-dependencies/">Part VI: External Property Dependencies</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-vii-dynamic-external-property-dependencies/">Part VII: Dynamic External Property Dependencies</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-viii-collection-dependencies/">Part VIII: Collection Dependencies</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-ix-dynamic-collection-dependencies/">Part IX: Dynamic Collection Dependencies</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-x-caching/">Part X: Caching</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-xi-smart-property-changed-notification/">Part XI: Smart Property Changed Notification</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-xii-callbacks/">Part XII: Callbacks</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-xiii-sanity-checks/">Part XIII: Sanity Checks</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-xiv-data-delegation/">Part XIV: Data Delegation</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-xv-two-way-converters/">Part XV: Two Way Converters</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-xvi-one-way-converters/">Part XVI: One Way Converters</a></li>
</ul>
<h1>Two Way Converters</h1>
<p><em>Although the following paragraph doesn&#8217;t describe a new feature of the PDFx, it demonstrates a use case that solves a common problem developers face every day, apart from the sole monitoring of large Property Dependency networks.</em></p>
<p><em>The source code of the following example can be found in ViewModel ConverterDemonstrationVM which is part of the WPFSample&#8217;s source code.</em></p>
<p>Oftentimes developers use value converters to transform domain-specific data into other domain-specific data (e.g. convert a money value from one currency to another), and thereby scatter conversion business logic throughout the project by implementing it in various different converters (that technically belong to the UI layer). The reason for this typical behavior is simple: comfort. value converters get automatically reevaluated as soon as the input data changes and therefore they are an easy tool to display up-to-date transformed data in the UI.<br />From my point of view, however, value converters should be used mainly to convert domain-specific data to UI-specific data (e.g. convert a bool from the ViewModel to a Visibility for the View). All the massaged data, which eventually ends up in the View, should be exposed by the ViewModel. This way a new View could easily be plugged into the existing ViewModel and business logic is executed before it reaches the View layer.</p>
<p>The PDFx allows you to enjoy the comfort of value converters (automatic reevaluation) within your ViewModels.</p>
<p>As explained in <a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-xiv-data-delegation/">Data Delegation</a>, the PDFx can be used to expose Model-data in the ViewModel.<br />The implementation of the <em>MoneyInUSD</em>-Property shows that the data doesn&#8217;t have to be delegated as is but can easily be transformed on the fly:</p>
<div style="color: black; background-color: white">
<pre><span style="color: blue">class</span> ViewModel : BindableExt
{
	<span style="color: blue">private</span> Model Model { <span style="color: blue">get</span>; <span style="color: blue">set</span>; }

	<span style="color: blue">public</span> <span style="color: blue">double</span> MoneyInUSD
	{
		<span style="color: blue">get</span>
		{
			Property(() =&gt; MoneyInUSD)
				.Depends(p =&gt; p.On(Model, k =&gt; k.MoneyInEuros));

			<span style="color: blue">return</span> Model.MoneyInEuros * 1.3;
		}
		<span style="color: blue">set</span> { Model.MoneyInEuros = value / 1.3; }
	}
}

<span style="color: blue">class</span> Model : BindableExt
{
	<span style="color: blue">private</span> <span style="color: blue">double</span> _moneyInEuros = 100;
	<span style="color: blue">public</span> <span style="color: blue">double</span> MoneyInEuros
	{
		<span style="color: blue">get</span> { <span style="color: blue">return</span> _moneyInEuros; }
		<span style="color: blue">set</span>
		{
			_moneyInEuros = value;
			NotifyPropertyChanged(() =&gt; MoneyInEuros);
		}
	}
}
</pre>
</div>
<p>In this scenario, the PDFx ensures that the <em>MoneyInUSD</em> Property gets reevaluated whenever the Model&#8217;s <em>MoneyInEuros</em> Property changes.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-xv-two-way-converters/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>PDFx &#8211; Property Dependency Framework &#8211; Part XIV, Data Delegation</title>
		<link>http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-xiv-data-delegation/</link>
		<comments>http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-xiv-data-delegation/#comments</comments>
		<pubDate>Fri, 17 May 2013 17:05:40 +0000</pubDate>
		<dc:creator>Kevin Stumpf</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blogs.interknowlogy.com/?p=4137</guid>
		<description><![CDATA[The PDFx is a lightweight open source .NET library that allows developers to describe dependencies between Properties in declarative C# code. Once relationships are registered, the framework monitors property changes and ensures that the INotifyPropertyChanged.PropertyChanged event is fired for all directly and indirectly dependent properties in a very efficient way. The library is available for [...]]]></description>
			<content:encoded><![CDATA[<p>The PDFx is a lightweight open source .NET library that allows developers to describe dependencies between Properties in declarative C# code. Once relationships are registered, the framework monitors property changes and ensures that the <em>INotifyPropertyChanged.PropertyChanged</em> event is fired for all directly and indirectly dependent properties in a very efficient way. The library is available for WPF, Silverlight, WinRT (Windows Store) and Windows Phone.</p>
<p>I’ve developed the PDFx as an InterKnowlogy RECESS project and published the source code and examples on <a href="http://pdfx.codeplex.com">codeplex</a>.</p>
<p>In a series of blog posts I am going to cover the library’s most important features:</p>
<ul>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-i-introduction-2/">Part I: Introduction</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-ii-library-versions/">Part II: Library Versions</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-iii-getting-started/">Part III: Getting Started</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-iv-using-pdfx-with-an-existing-3rd-party-framework/">Part IV: Using PDFx with an existing 3rd party framework</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-v-simple-property-dependencies/">Part V: Simple Property Dependencies</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-vi-external-property-dependencies/">Part VI: External Property Dependencies</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-vii-dynamic-external-property-dependencies/">Part VII: Dynamic External Property Dependencies</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-viii-collection-dependencies/">Part VIII: Collection Dependencies</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-ix-dynamic-collection-dependencies/">Part IX: Dynamic Collection Dependencies</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-x-caching/">Part X: Caching</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-xi-smart-property-changed-notification/">Part XI: Smart Property Changed Notification</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-xii-callbacks/">Part XII: Callbacks</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-xiii-sanity-checks/">Part XIII: Sanity Checks</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-xiv-data-delegation/">Part XIV: Data Delegation</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-xv-two-way-converters/">Part XV: Two Way Converters</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-xvi-one-way-converters/">Part XVI: One Way Converters</a></li>
</ul>
<h1>Simple Data Delegation</h1>
<p><em>Although the following paragraph doesn&#8217;t describe a new feature of the PDFx, it demonstrates a use case that solves a common problem developers face every day, apart from the sole monitoring of large Property Dependency networks.</em></p>
<p><em>The source code of the following example can be found in ViewModel ConverterDemonstrationVM which is part of the WPFSample&#8217;s source code.</em></p>
<p>More often than not, ViewModels wrap one or more instances of the Model Layer. Purists (like me) prefer to bind View-controls only to properties that come directly from the ViewModel layer rather than also to properties that come from the Model layer. This way they decouple their Model from the View and create a true MVVM architecture.<br />This approach, however, means that every Model-value the View eventually would like to display needs to be exposed by the ViewModel.</p>
<p>Let&#8217;s look at the following ViewModel implementation which wraps a Model and delegates its properties:</p>
<div style="color: black; background-color: white">
<pre><span style="color: blue">class</span> ViewModel
{
	<span style="color: blue">private</span> Model Model { <span style="color: blue">get</span>; <span style="color: blue">set</span>; }

	<span style="color: blue">public</span> <span style="color: blue">double</span> MoneyInEuros
	{
		<span style="color: blue">get</span> { <span style="color: blue">return</span> Model.MoneyInEuros; }
		<span style="color: blue">set</span> { Model.MoneyInEuros = value; }
	}
}

<span style="color: blue">class</span> Model : BindableExt
{
	<span style="color: blue">private</span> <span style="color: blue">double</span> _moneyInEuros = 100;
	<span style="color: blue">public</span> <span style="color: blue">double</span> MoneyInEuros
	{
		<span style="color: blue">get</span> { <span style="color: blue">return</span> _moneyInEuros; }
		<span style="color: blue">set</span>
		{
			_moneyInEuros = value;
			NotifyPropertyChanged(() =&gt; MoneyInEuros);
		}
	}
}
</pre>
</div>
<p>The problem with this purist approach is, however, that the data might change often directly in the Model layer without having passed through the ViewModel layer. <br />In the example above, the Model could represent an instance from a database. A service could now monitor the database and automatically reflect any changes that are applied to the database in the Model&#8217;s instance. Obviously, the ViewModel would not know about this change unless it explicitly monitors the <em>PropertyChanged</em> event of the Model instance.</p>
<p>This problem can easily be solved by employing the PDFx:</p>
<div style="color: black; background-color: white">
<pre><span style="color: blue">class</span> ViewModel : BindableExt
{
	<span style="color: blue">private</span> Model Model { <span style="color: blue">get</span>; <span style="color: blue">set</span>; }

	<span style="color: blue">public</span> <span style="color: blue">double</span> MoneyInEuros
	{
		<span style="color: blue">get</span>
		{
			Property(() =&gt; MoneyInEuros)
				.Depends(p =&gt; p.On(Model, k =&gt; k.MoneyInEuros));

			<span style="color: blue">return</span> Model.MoneyInEuros;
		}
		<span style="color: blue">set</span> { Model.MoneyInEuros = value; }
	}
}

<span style="color: blue">class</span> Model : BindableExt
{
	<span style="color: blue">private</span> <span style="color: blue">double</span> _moneyInEuros = 100;
	<span style="color: blue">public</span> <span style="color: blue">double</span> MoneyInEuros
	{
		<span style="color: blue">get</span> { <span style="color: blue">return</span> _moneyInEuros; }
		<span style="color: blue">set</span>
		{
			_moneyInEuros = value;
			NotifyPropertyChanged(() =&gt; MoneyInEuros);
		}
	}
}
</pre>
</div>
<p>In this scenario, the PDFx would automatically propagate the <em>MoneyInEuros</em> Property&#8217;s changes of the Model layer to the ViewModel layer.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-xiv-data-delegation/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>PDFx &#8211; Property Dependency Framework &#8211; Part XIII, Sanity Checks</title>
		<link>http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-xiii-sanity-checks/</link>
		<comments>http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-xiii-sanity-checks/#comments</comments>
		<pubDate>Fri, 17 May 2013 17:04:01 +0000</pubDate>
		<dc:creator>Kevin Stumpf</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blogs.interknowlogy.com/?p=4135</guid>
		<description><![CDATA[The PDFx is a lightweight open source .NET library that allows developers to describe dependencies between Properties in declarative C# code. Once relationships are registered, the framework monitors property changes and ensures that the INotifyPropertyChanged.PropertyChanged event is fired for all directly and indirectly dependent properties in a very efficient way. The library is available for [...]]]></description>
			<content:encoded><![CDATA[<p>The PDFx is a lightweight open source .NET library that allows developers to describe dependencies between Properties in declarative C# code. Once relationships are registered, the framework monitors property changes and ensures that the <em>INotifyPropertyChanged.PropertyChanged</em> event is fired for all directly and indirectly dependent properties in a very efficient way. The library is available for WPF, Silverlight, WinRT (Windows Store) and Windows Phone.</p>
<p>I’ve developed the PDFx as an InterKnowlogy RECESS project and published the source code and examples on <a href="http://pdfx.codeplex.com">codeplex</a>.</p>
<p>In a series of blog posts I am going to cover the library’s most important features:</p>
<ul>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-i-introduction-2/">Part I: Introduction</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-ii-library-versions/">Part II: Library Versions</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-iii-getting-started/">Part III: Getting Started</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-iv-using-pdfx-with-an-existing-3rd-party-framework/">Part IV: Using PDFx with an existing 3rd party framework</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-v-simple-property-dependencies/">Part V: Simple Property Dependencies</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-vi-external-property-dependencies/">Part VI: External Property Dependencies</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-vii-dynamic-external-property-dependencies/">Part VII: Dynamic External Property Dependencies</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-viii-collection-dependencies/">Part VIII: Collection Dependencies</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-ix-dynamic-collection-dependencies/">Part IX: Dynamic Collection Dependencies</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-x-caching/">Part X: Caching</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-xi-smart-property-changed-notification/">Part XI: Smart Property Changed Notification</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-xii-callbacks/">Part XII: Callbacks</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-xiii-sanity-checks/">Part XIII: Sanity Checks</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-xiv-data-delegation/">Part XIV: Data Delegation</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-xv-two-way-converters/">Part XV: Two Way Converters</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-xvi-one-way-converters/">Part XVI: One Way Converters</a></li>
</ul>
<h1>Sanity Checks</h1>
<p><em>Please refer to </em><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-ii-library-versions/">Library Versions</a><em></em><em> to find out whether your platform specific PDFx version supports Sanity Checks.</em></p>
<p>In Debug mode, the PDFx performs certain resource expensive Sanity Checks that try to capture typical developer mistakes that are not caught at compile time.</p>
<p>Both the <em>BindableExt&#8217;s</em> <em>Property</em> and <em>CachedValue</em> methods ensure that the Property that is being pointed to in the first method parameter equals the Property from which either method is being called.</p>
<p>In the following example, the PDFx notices upon first access of the properties <em>DependentPropertyMistake</em> and <em>CachedPropertyMistake</em> that the way they use the PDFx is incorrect.</p>
<div style="color: black; background-color: white">
<pre><span style="color: blue">class</span> WrongPDFXUsageDemonstration : BindableExt
{
	<span style="color: blue">private</span> <span style="color: blue">int</span> _inputValue;
	<span style="color: blue">public</span> <span style="color: blue">int</span> InputValue
	{
		<span style="color: blue">get</span> { <span style="color: blue">return</span> _inputValue; }
		<span style="color: blue">set</span>
		{
			_inputValue = value;
			NotifyPropertyChanged(() =&gt; InputValue);
		}
	}

	<span style="color: blue">public</span> <span style="color: blue">int</span> DependentPropertyMistake
	{
		<span style="color: blue">get</span>
		{
			Property(() =&gt; InputValue) <span style="color: green">//Should point to DependentPropertyMistake</span>
				.Depends(p =&gt; p.On(() =&gt; InputValue));

			<span style="color: blue">return</span> InputValue*2;
		}
	}

	<span style="color: blue">public</span> <span style="color: blue">int</span> DependentPropertyProper
	{
		<span style="color: blue">get</span>
		{
			Property(() =&gt; DependentPropertyProper)
				.Depends(p =&gt; p.On(() =&gt; InputValue));

			<span style="color: blue">return</span> InputValue * 2;
		}
	}

	<span style="color: blue">public</span> <span style="color: blue">int</span> CachedPropertyMistake
	{
		<span style="color: blue">get</span>
		{
			<span style="color: blue">return</span> CachedValue(() =&gt; InputValue, () =&gt; InputValue * 5);
			<span style="color: green">//Should point to CachedPropertyMistake</span>
		}
	}

	<span style="color: blue">public</span> <span style="color: blue">int</span> CachedPropertyProper
	{
		<span style="color: blue">get</span>
		{
			<span style="color: blue">return</span> CachedValue(() =&gt; CachedPropertyProper, () =&gt; InputValue * 5);
		}
	}
}
</pre>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-xiii-sanity-checks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PDFx &#8211; Property Dependency Framework &#8211; Part XII, Callbacks</title>
		<link>http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-xii-callbacks/</link>
		<comments>http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-xii-callbacks/#comments</comments>
		<pubDate>Fri, 17 May 2013 17:01:16 +0000</pubDate>
		<dc:creator>Kevin Stumpf</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blogs.interknowlogy.com/?p=4133</guid>
		<description><![CDATA[The PDFx is a lightweight open source .NET library that allows developers to describe dependencies between Properties in declarative C# code. Once relationships are registered, the framework monitors property changes and ensures that the INotifyPropertyChanged.PropertyChanged event is fired for all directly and indirectly dependent properties in a very efficient way. The library is available for [...]]]></description>
			<content:encoded><![CDATA[<p>The PDFx is a lightweight open source .NET library that allows developers to describe dependencies between Properties in declarative C# code. Once relationships are registered, the framework monitors property changes and ensures that the <em>INotifyPropertyChanged.PropertyChanged</em> event is fired for all directly and indirectly dependent properties in a very efficient way. The library is available for WPF, Silverlight, WinRT (Windows Store) and Windows Phone.</p>
<p>I’ve developed the PDFx as an InterKnowlogy RECESS project and published the source code and examples on <a href="http://pdfx.codeplex.com">codeplex</a>.</p>
<p>In a series of blog posts I am going to cover the library’s most important features:</p>
<ul>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-i-introduction-2/">Part I: Introduction</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-ii-library-versions/">Part II: Library Versions</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-iii-getting-started/">Part III: Getting Started</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-iv-using-pdfx-with-an-existing-3rd-party-framework/">Part IV: Using PDFx with an existing 3rd party framework</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-v-simple-property-dependencies/">Part V: Simple Property Dependencies</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-vi-external-property-dependencies/">Part VI: External Property Dependencies</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-vii-dynamic-external-property-dependencies/">Part VII: Dynamic External Property Dependencies</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-viii-collection-dependencies/">Part VIII: Collection Dependencies</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-ix-dynamic-collection-dependencies/">Part IX: Dynamic Collection Dependencies</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-x-caching/">Part X: Caching</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-xi-smart-property-changed-notification/">Part XI: Smart Property Changed Notification</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-xii-callbacks/">Part XII: Callbacks</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-xiii-sanity-checks/">Part XIII: Sanity Checks</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-xiv-data-delegation/">Part XIV: Data Delegation</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-xv-two-way-converters/">Part XV: Two Way Converters</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-xvi-one-way-converters/">Part XVI: One Way Converters</a></li>
</ul>
<h1>Callbacks</h1>
<p>When a source property changes, the PDFx allows you not only to automatically fire the <em>PropertyChanged</em> event for dependent properties, but also to execute callbacks in numerous scenarios.</p>
<p>The registration API for callbacks is not declarative, as the Property Dependency Registration API is, but rather imperative. Furthermore, the registration should not take place within a Property Getter but rather within a dedicated Registration method, as the following examples show.</p>
<h2>Callbacks on Property Changes</h2>
<p>The following example demonstrates how you can register Callbacks for normal Property Changes:</p>
<div style="color: black; background-color: white">
<pre><span style="color: blue">class</span> SimpleCallbackExample : BindableExt
{
	<span style="color: blue">public</span> SimpleCallbackExample()
	{
		RegisterCallbacks();
	}

	<span style="color: blue">private</span> <span style="color: blue">void</span> RegisterCallbacks()
	{
		RegisterCallbackDependency(Property1, OnProperty1Changed);
	}

	<span style="color: blue">private</span> <span style="color: blue">void</span> OnProperty1Changed()
	{
		Debug.WriteLine(<span style="color: #a31515">"Property1 has changed!"</span>);
	}

	<span style="color: blue">private</span> AnyType _property1;
	<span style="color: blue">public</span> AnyType Property1
	{
		<span style="color: blue">get</span> { <span style="color: blue">return</span> _property1; }
		<span style="color: blue">set</span>
		{
			_property1 = value;
			NotifyPropertyChanged(() =&gt; Property1);
		}
	}
}
</pre>
</div>
<p>The used overload of <em>RegisterCallbackDependency</em> expects you to pass in the owner of a property as the first parameter, a delegate that points to the Property that is to be monitored as the second parameter and finally a pointer to the callback that is supposed to be executed when the Property changes.</p>
<p>In the example above, <em>OnProperty1Changed</em> will be executed by the PDFx whenever <em>Property1</em> changes.</p>
<h2>Callbacks on Objects</h2>
<p>The following example demonstrates how you can register one callback for all Property Changes of an object:</p>
<div style="color: black; background-color: white">
<pre><span style="color: blue">class</span> ObjectCallbackExample : BindableExt
{
	<span style="color: blue">public</span> ObjectCallbackExample()
	{
		RegisterCallbacks();
	}

	<span style="color: blue">private</span> <span style="color: blue">void</span> RegisterCallbacks()
	{
		RegisterCallbackDependency(<span style="color: blue">this</span>, OnAnyPropertyChanged);
	}

	<span style="color: blue">private</span> <span style="color: blue">void</span> OnAnyPropertyChanged()
	{
		Debug.WriteLine(<span style="color: #a31515">"Any Property has changed!"</span>);
	}

	<span style="color: blue">private</span> AnyType _property1;
	<span style="color: blue">public</span> AnyType Property1
	{
		<span style="color: blue">get</span> { <span style="color: blue">return</span> _property1; }
		<span style="color: blue">set</span>
		{
			_property1 = value;
			NotifyPropertyChanged(() =&gt; Property1);
		}
	}

	<span style="color: blue">private</span> AnyType _property2;
	<span style="color: blue">public</span> AnyType Property2
	{
		<span style="color: blue">get</span> { <span style="color: blue">return</span> _property2; }
		<span style="color: blue">set</span>
		{
			_property2 = value;
			NotifyPropertyChanged(() =&gt; Property2);
		}
	}
}
</pre>
</div>
<p>The used overload of <em>RegisterCallbackDependency</em> expects you to pass in a property owner that is to be monitored as the first parameter and a pointer to the callback that is supposed to be executed when any Property changes as the second parameter.</p>
<p>In the example above, <em>OnAnyPropertyChanged</em> will be executed by the PDFx whenever <em>Property1</em> or <em>Property2</em> changes.</p>
<h2>Callbacks on Collections&#8217; children</h2>
<p>The PDFx also allows you to register callbacks that are to be fired when a specific property of an ObservableCollection&#8217;s child changes:</p>
<div style="color: black; background-color: white">
<pre><span style="color: blue">class</span> CollectionPropertyCallbackExample : BindableExt
{
	<span style="color: blue">private</span> DependencyFrameworkObservableCollection&lt;Child&gt; _children 
		= <span style="color: blue">new</span> DependencyFrameworkObservableCollection&lt;Child&gt;();

	<span style="color: blue">public</span> CollectionPropertyCallbackExample()
	{
		RegisterCallbacks();
	}

	<span style="color: blue">private</span> <span style="color: blue">void</span> RegisterCallbacks()
	{
		RegisterCallbackDependency(_children, k =&gt; k.Property1, OnCollectionChildPropertyChanged);
	}

	<span style="color: blue">private</span> <span style="color: blue">void</span> OnCollectionChildPropertyChanged()
	{
		Debug.WriteLine(<span style="color: #a31515">"Property1 of a child has changed!"</span>);
	}

	<span style="color: blue">private</span> <span style="color: blue">class</span> Child : BindableExt
	{
		<span style="color: blue">private</span> AnyType _property1;
		<span style="color: blue">public</span> AnyType Property1
		{
			<span style="color: blue">get</span> { <span style="color: blue">return</span> _property1; }
			<span style="color: blue">set</span>
			{
				_property1 = value;
				NotifyPropertyChanged(() =&gt; Property1);
			}
		}
	}
}
</pre>
</div>
<p>The first parameter of this <em>RegisterCallbackDependency</em> overload expects the collection that is to be monitored. The second parameter is to point to the Children&#8217;s Property that is of interest. The third parameter finally points to the callback that is to be executed.</p>
<p>In the example above, the method <em>OnCollectionChildPropertyChanged</em> will get fired whenever <em>Property1</em> of any child changes.</p>
<h2>Callbacks on entire Collections</h2>
<p>The PDFx also allows to register callbacks that get executed whenever any child&#8217;s property changes or a child gets added or removed:</p>
<div style="color: black; background-color: white">
<pre><span style="color: blue">class</span> CollectionCallbackExample : BindableExt
{
	<span style="color: blue">private</span> DependencyFrameworkObservableCollection&lt;Child&gt; _children
		= <span style="color: blue">new</span> DependencyFrameworkObservableCollection&lt;Child&gt;();

	<span style="color: blue">public</span> CollectionCallbackExample()
	{
		RegisterCallbacks();
	}

	<span style="color: blue">private</span> <span style="color: blue">void</span> RegisterCallbacks()
	{
		RegisterCallbackDependency(_children, OnCollectionChanged);
	}

	<span style="color: blue">private</span> <span style="color: blue">void</span> OnCollectionChanged()
	{
		Debug.WriteLine(<span style="color: #a31515">"Collection has changed!"</span>);
	}

	<span style="color: blue">private</span> <span style="color: blue">class</span> Child : BindableExt
	{
		<span style="color: blue">private</span> AnyType _property1;
		<span style="color: blue">public</span> AnyType Property1
		{
			<span style="color: blue">get</span> { <span style="color: blue">return</span> _property1; }
			<span style="color: blue">set</span>
			{
				_property1 = value;
				NotifyPropertyChanged(() =&gt; Property1);
			}
		}

		<span style="color: blue">private</span> AnyType _property2;
		<span style="color: blue">public</span> AnyType Property2
		{
			<span style="color: blue">get</span> { <span style="color: blue">return</span> _property2; }
			<span style="color: blue">set</span>
			{
				_property2 = value;
				NotifyPropertyChanged(() =&gt; Property2);
			}
		}
	}
}
</pre>
</div>
<p>The first parameter of the used <em>RegisterCallbackDependency</em> overload expects the ObservableCollection that is to be monitored. The second parameter points to the callback.</p>
<p>PDFx will automatically execute the callback whenever any property of a child changes and whenever the collection itself is modified either by adding or by removing a child.</p>
<h2>Deferred Callbacks</h2>
<p><em>Please refer to </em><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-ii-library-versions/">Library Versions</a><em></em><em> to find out whether the platform specific version of PDFx that you are using supports &#8220;Deferred Callbacks&#8221;</em></p>
<p>All the <em>RegisterCallbackDependency</em> overloads that are described in the paragraphs above are also available with the method <em>RegisterDeferredCallbackDependency</em> that allows you to register deferred callbacks.<br />If you register deferred callbacks, the execution of the callback is deferred by a certain amount of time (by default 100ms). Furthermore, if the callback trigger (such as a Property change) fires again before the wait time threshold has passed, the wait timer is reset. This feature gets especially useful when your callback is rather resource expensive and the underlying trigger might fire multiple times in a row.</p>
<p>Let&#8217;s look at the following example:</p>
<div style="color: black; background-color: white">
<pre><span style="color: blue">class</span> SimpleCallbackExample : BindableExt
{
	<span style="color: blue">public</span> SimpleCallbackExample()
	{
		RegisterCallbacks();
	}

	<span style="color: blue">private</span> <span style="color: blue">void</span> RegisterCallbacks()
	{
		RegisterDeferredCallbackDependency(<span style="color: blue">this</span>, k =&gt; SliderValue, SubmitDataToServer);
	}

	<span style="color: blue">private</span> <span style="color: blue">void</span> SubmitDataToServer()
	{
		Debug.WriteLine(<span style="color: #a31515">"Expensive call to submit data to server..."</span>);
	}

	<span style="color: blue">private</span> <span style="color: blue">int</span> _sliderValue;
	<span style="color: blue">public</span> <span style="color: blue">int</span> SliderValue
	{
		<span style="color: blue">get</span> { <span style="color: blue">return</span> _sliderValue; }
		<span style="color: blue">set</span>
		{
			_sliderValue = value;
			NotifyPropertyChanged(() =&gt; SliderValue);
		}
	}
}
</pre>
</div>
<p>In the example above, the <em>SliderValue</em> property could be bound to a slider. The requirement is to submit the slider&#8217;s new value to a server as soon as the user changes value. However, since a server call is rather expensive, the value should not be submitted while the user is still changing the value but rather as soon as the user finishes the change operation.<br />Such a requirement can easily be implemented by employing deferred callbacks as shown above.</p>
<h2>Extensive Example</h2>
<p>Please refer to WPFSample&#8217;s <em>CallbacksDemonstrationVM</em> to explore an example that makes heavy usage of the callback features.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-xii-callbacks/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>PDFx &#8211; Property Dependency Framework &#8211; Part XI, Smart Property Changed Notification</title>
		<link>http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-xi-smart-property-changed-notification/</link>
		<comments>http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-xi-smart-property-changed-notification/#comments</comments>
		<pubDate>Fri, 17 May 2013 16:59:07 +0000</pubDate>
		<dc:creator>Kevin Stumpf</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blogs.interknowlogy.com/?p=4131</guid>
		<description><![CDATA[The PDFx is a lightweight open source .NET library that allows developers to describe dependencies between Properties in declarative C# code. Once relationships are registered, the framework monitors property changes and ensures that the INotifyPropertyChanged.PropertyChanged event is fired for all directly and indirectly dependent properties in a very efficient way. The library is available for [...]]]></description>
			<content:encoded><![CDATA[<p>The PDFx is a lightweight open source .NET library that allows developers to describe dependencies between Properties in declarative C# code. Once relationships are registered, the framework monitors property changes and ensures that the <em>INotifyPropertyChanged.PropertyChanged</em> event is fired for all directly and indirectly dependent properties in a very efficient way. The library is available for WPF, Silverlight, WinRT (Windows Store) and Windows Phone.</p>
<p>I’ve developed the PDFx as an InterKnowlogy RECESS project and published the source code and examples on <a href="http://pdfx.codeplex.com">codeplex</a>.</p>
<p>In a series of blog posts I am going to cover the library’s most important features:</p>
<ul>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-i-introduction-2/">Part I: Introduction</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-ii-library-versions/">Part II: Library Versions</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-iii-getting-started/">Part III: Getting Started</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-iv-using-pdfx-with-an-existing-3rd-party-framework/">Part IV: Using PDFx with an existing 3rd party framework</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-v-simple-property-dependencies/">Part V: Simple Property Dependencies</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-vi-external-property-dependencies/">Part VI: External Property Dependencies</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-vii-dynamic-external-property-dependencies/">Part VII: Dynamic External Property Dependencies</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-viii-collection-dependencies/">Part VIII: Collection Dependencies</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-ix-dynamic-collection-dependencies/">Part IX: Dynamic Collection Dependencies</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-x-caching/">Part X: Caching</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-xi-smart-property-changed-notification/">Part XI: Smart Property Changed Notification</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-xii-callbacks/">Part XII: Callbacks</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-xiii-sanity-checks/">Part XIII: Sanity Checks</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-xiv-data-delegation/">Part XIV: Data Delegation</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-xv-two-way-converters/">Part XV: Two Way Converters</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-xvi-one-way-converters/">Part XVI: One Way Converters</a></li>
</ul>
<h1>Smart Property Changed Notification</h1>
<p>Whenever a property changes in a property dependency network, the PDFx can optionally first analyze all the property dependencies and then fire the <em>INotifyPropertyChanged.PropertyChanged</em> event only once for every directly or indirectly dependent property. This analysis saves tremendous amounts of precious CPU time since every <em>PropertyChanged</em> event causes your UI layer to access and thereby reevaluate the bound properties.</p>
<h2>Usage</h2>
<p>By default, the smart property changed notification is turned on.<br />If you have a reason to switch this behavior off, you can set the <em>Bindable</em> class&#8217;s <em>UseSmartPropertyChangedNotificationByDefault</em> Property to false.</p>
<h2>Performance Demonstration</h2>
<p><em>The source code of this example can be found in ViewModel SmartPropertyDependencyVM which is part of the WPFSample&#8217;s source code.</em></p>
<p>Let us look at the following object graph:</p>
<p><img title="SmartPropertyChangeNotificationI.png" alt="SmartPropertyChangeNotificationI.png" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=PDFx&amp;DownloadId=679820"></p>
<p><em>Green circles stand for Input Properties while purple circles indicate calculated properties. The arrows show the underlying math operations as well as the property dependencies.</em></p>
<p>The number next to the lightning icon indicates how often the <em>INotifyPropertyChanged.PropertyChanged</em> event has fired since the <i>D1</i> Property has changed the last time.</p>
<p>A change of <em>D1</em> results in the following:</p>
<p><img title="SmartPropertyChangeNotificationII.png" alt="SmartPropertyChangeNotificationII.png" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=PDFx&amp;DownloadId=679822"></p>
<p>As the picture indicates, <em>INotifyPropertyChanged.PropertyChanged</em> is fired only once for every single property for maximum performance.</p>
<p>When the Smart Property Change Notification is switched off, a change of <em>D1</em> results in the following:</p>
<p><img title="SmartPropertyChangeNotificationIII.png" alt="SmartPropertyChangeNotificationIII.png" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=PDFx&amp;DownloadId=679823"></p>
<p>In this scenario, the PDFx does not analyze the Property Dependency Network before <em>INotifyPropertyChanged.PropertyChanged</em> events are fired but rather blindly performs a depth-search traversal down the dependency tree along all directly and indirectly dependent properties and fires <em>INotifyPropertyChanged.PropertyChanged</em> for every single property it finds. As shown above, this behavior results in 10 <em>PropertyChanged</em> Notifications for the root node, <i>A1</i>.</p>
<p>To be more specific, the PDFx traverses the tree in the following manner, if smart property change notification is switched off:</p>
<div style="color: black; background-color: white">
<pre>D1 -&gt; C1 -&gt; B1 -&gt; A1
	 -&gt; B2 -&gt; A1
   -&gt; C2 -&gt; B2 -&gt; A1
         -&gt; B3 -&gt; A1
   -&gt; C3 -&gt; B3 -&gt; A1
         -&gt; B4 -&gt; A1
   -&gt; C4 -&gt; B4 -&gt; A1
         -&gt; B5 -&gt; A1
   -&gt; C5 -&gt; B5 -&gt; A1
         -&gt; B6 -&gt; A1
</pre>
</div>
<p>It becomes obvious that the <em>PropertyChanged</em> event is inefficiently raised 10 times for Property <em>A1</em> although once would be completely sufficient. Consequently, it is advisable to always take advantage of the smart property notification.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-xi-smart-property-changed-notification/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>PDFx &#8211; Property Dependency Framework &#8211; Part X, Caching</title>
		<link>http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-x-caching/</link>
		<comments>http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-x-caching/#comments</comments>
		<pubDate>Fri, 17 May 2013 16:52:16 +0000</pubDate>
		<dc:creator>Kevin Stumpf</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blogs.interknowlogy.com/?p=4129</guid>
		<description><![CDATA[The PDFx is a lightweight open source .NET library that allows developers to describe dependencies between Properties in declarative C# code. Once relationships are registered, the framework monitors property changes and ensures that the INotifyPropertyChanged.PropertyChanged event is fired for all directly and indirectly dependent properties in a very efficient way. The library is available for [...]]]></description>
			<content:encoded><![CDATA[<p>The PDFx is a lightweight open source .NET library that allows developers to describe dependencies between Properties in declarative C# code. Once relationships are registered, the framework monitors property changes and ensures that the <em>INotifyPropertyChanged.PropertyChanged</em> event is fired for all directly and indirectly dependent properties in a very efficient way. The library is available for WPF, Silverlight, WinRT (Windows Store) and Windows Phone.</p>
<p>I’ve developed the PDFx as an InterKnowlogy RECESS project and published the source code and examples on <a href="http://pdfx.codeplex.com">codeplex</a>.</p>
<p>In a series of blog posts I am going to cover the library’s most important features:</p>
<ul>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-i-introduction-2/">Part I: Introduction</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-ii-library-versions/">Part II: Library Versions</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-iii-getting-started/">Part III: Getting Started</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-iv-using-pdfx-with-an-existing-3rd-party-framework/">Part IV: Using PDFx with an existing 3rd party framework</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-v-simple-property-dependencies/">Part V: Simple Property Dependencies</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-vi-external-property-dependencies/">Part VI: External Property Dependencies</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-vii-dynamic-external-property-dependencies/">Part VII: Dynamic External Property Dependencies</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-viii-collection-dependencies/">Part VIII: Collection Dependencies</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-ix-dynamic-collection-dependencies/">Part IX: Dynamic Collection Dependencies</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-x-caching/">Part X: Caching</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-xi-smart-property-changed-notification/">Part XI: Smart Property Changed Notification</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-xii-callbacks/">Part XII: Callbacks</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-xiii-sanity-checks/">Part XIII: Sanity Checks</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-xiv-data-delegation/">Part XIV: Data Delegation</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-xv-two-way-converters/">Part XV: Two Way Converters</a>
<li><a href="http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-xvi-one-way-converters/">Part XVI: One Way Converters</a></li>
</ul>
<h1>Caching</h1>
<p>The PDFx allows you to cache Property evaluations and thereby avoid unnecessary executions of the very same evaluation business logic while the underlying data stayed the same. <br />When the <em>INotifyPropertyChanged.PropertyChanged</em> event is fired for a property, its cached value gets invalidated because the PDFx assumes that the underlying data has changed.<br />If a cached property depends on other properties, the cached value consequently gets invalidated as soon as any of its direct or indirect source properties change.<br />This feature helps to save precious CPU time when property evaluations become costly.</p>
<p>The following example demonstrates the usage:</p>
<div style="color: black; background-color: white">
<pre><span style="color: blue">class</span> CacheDemonstration : BindableExt
{
	<span style="color: blue">private</span> AnyType _property1;
	<span style="color: blue">public</span> AnyType Property1
	{
		<span style="color: blue">get</span> { <span style="color: blue">return</span> _property1; }
		<span style="color: blue">set</span> { _property1 = value; NotifyPropertyChanged(() =&gt; Property1); }
	}

	<span style="color: blue">private</span> AnyType _property2;
	<span style="color: blue">public</span> AnyType Property2
	{
		<span style="color: blue">get</span> { <span style="color: blue">return</span> _property2; }
		<span style="color: blue">set</span> { _property2 = value; NotifyPropertyChanged(() =&gt; Property2); }
	}

	<span style="color: blue">public</span> AnyOtherType DependentProperty
	{
		<span style="color: blue">get</span>
		{
			Property(() =&gt; DependentProperty)
				.Depends(p =&gt; p.On(() =&gt; Property1)
				               .AndOn(() =&gt; Property2));

			<span style="color: blue">return</span> CachedValue(() =&gt; DependentProperty,
			                   () =&gt;
				               {
					               <span style="color: blue">return</span> Property1 + Property2;
				               });
		}
	}
}
</pre>
</div>
<p>To use the caching feature, simply wrap the Property&#8217;s evaluation logic in a call to the Method <em>CachedValue</em>. The first parameter points to the current property while the second parameter points to a delegate that evaluates the property&#8217;s business logic.</p>
<p>When <em>DependentProperty</em> is evaluated for the first time, it calculates the property&#8217;s value and caches it. Whenever the property is evaluated the next time, it returns the cached value without re-evaluating <em>Property1</em> or <em>Property2</em>.<br />As soon as <em>Property1</em> or <em>Property2</em> change, however, <em>DependentProperty&#8217;s</em> cached value is invalidated and upon its next access re-evaluated and cached again.</p>
<h2>Simple Example</h2>
<p>Let&#8217;s consider the following object graph:</p>
<p><img title="SimpleCachingExample.png" alt="SimpleCachingExample.png" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=PDFx&amp;DownloadId=679800"></p>
<p><em>Green circles stand for Input Properties while purple circles indicate calculated properties. The arrows show the underlying math operations as well as the property dependencies.</em></p>
<p>Such a graph can easily be implemented using the PDFx:</p>
<div style="color: black; background-color: white">
<pre><span style="color: blue">class</span> SimpleCachingExample : BindableExt
{
	<span style="color: blue">public</span> <span style="color: blue">int</span> A1
	{
		<span style="color: blue">get</span>
		{
			Property(() =&gt; A1)
				.Depends(p =&gt; p.On(() =&gt; B1));

			<span style="color: blue">return</span> B1;
		}
	}

	<span style="color: blue">public</span> <span style="color: blue">int</span> A2
	{
		<span style="color: blue">get</span>
		{
			Property(() =&gt; A2)
				.Depends(p =&gt; p.On(() =&gt; B1));

			<span style="color: blue">return</span> 3 * B1;
		}
	}

	<span style="color: blue">public</span> <span style="color: blue">int</span> B1
	{
		<span style="color: blue">get</span>
		{
			Property(() =&gt; B1)
				.Depends(p =&gt; p.On(() =&gt; C1)
							   .AndOn(() =&gt; C2));

			<span style="color: blue">return</span> CachedValue(() =&gt; B1, () =&gt;
				                             {
					                             <span style="color: blue">return</span> C1 + C2;
				                             });
			<span style="color: green">//Note the usage of CachedValue</span>
		}
	}

	<span style="color: blue">private</span> <span style="color: blue">int</span> _c1;
	<span style="color: blue">public</span> <span style="color: blue">int</span> C1
	{
		<span style="color: blue">get</span> { <span style="color: blue">return</span> _c1; }
		<span style="color: blue">set</span> { _c1 = value; NotifyPropertyChanged(() =&gt; C1); }
	}

	<span style="color: blue">private</span> <span style="color: blue">int</span> _c2;
	<span style="color: blue">public</span> <span style="color: blue">int</span> C2
	{
		<span style="color: blue">get</span> { <span style="color: blue">return</span> _c2; }
		<span style="color: blue">set</span> { _c2 = value; NotifyPropertyChanged(() =&gt; C2); }
	}
}
</pre>
</div>
<p>A subsequent evaluation of <i>A1</i> and <i>A2</i> will result in only one evaluation of <i>B1</i>&#8216;s business logic. Any future request of <i>B1</i> will return the cached value. As soon as <i>C1</i> or <i>C2</i> change, <i>B1</i>&#8216;s cached value gets invalidated and reevaluated when its accessed the next time.</p>
<h2>Performance Demonstration</h2>
<p><em>The source code of this example can be found in ViewModel CachingDemonstrationVM which is part of the WPFSample&#8217;s source code.</em></p>
<p>Let&#8217;s consider the following object graph:</p>
<p><img title="CachingExample.png" alt="CachingExample.png" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=PDFx&amp;DownloadId=679804"></p>
<p>The indicator next to the calculator icon shows the number of Property Evaluations since any Input Property (<i>E1</i> through <i>E6</i>) has last changed.</p>
<p>A change of E1 with caching enabled results in the following:</p>
<p><img title="CachingExampleII.png" alt="CachingExampleII.png" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=PDFx&amp;DownloadId=679805"></p>
<p>Only <i>D1</i>, <i>C1</i>, <i>B1</i> and <i>A1</i> get re-evaluated. This makes perfect sense, since those are the only properties that are directly or indirectly dependent on <i>E1</i>.</p>
<p>Without caching, however, a change of E2 results in the following:</p>
<p><img title="CachingExampleIII.png" alt="CachingExampleIII.png" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=PDFx&amp;DownloadId=679806"></p>
<p>The PDFx notices that <i>D1</i>, <i>C1</i>, <i>B1</i> and <i>A1</i> all need to get reevaluated and fires <em>INotifyPropertyChanged.PropertyChanged</em> for all of them. The UI layer consequently accesses all of them and causes a reevaluation. <br />A reevaluation of for example <i>A1</i> will now access &#8211; amongst others -<i>B1</i>. Consequently, B1 is unnecessarily evaluated again (first time it was evaluated by the UI layer). And the game goes on for all the other properties and has a larger performance impact the more intricate your object graph becomes.</p>
<p>The ViewModel for the example above can be implemented as follows:</p>
<div style="color: black; background-color: white">
<pre><span style="color: blue">class</span> CachingDemonstrationVM : BindableExt
{
	<span style="color: blue">public</span> <span style="color: blue">int</span> A1
	{
		<span style="color: blue">get</span>
		{
			Property(() =&gt; A1)
				.Depends(p =&gt; p.On(() =&gt; B2)
							   .AndOn(() =&gt; B1));

			<span style="color: blue">return</span> CachedValue(() =&gt; A1, () =&gt; B1 + B2);
		}
	}

	<span style="color: blue">public</span> <span style="color: blue">int</span> B1
	{
		<span style="color: blue">get</span>
		{
			Property(() =&gt; B1)
				.Depends(p =&gt; p.On(() =&gt; C1)
							   .AndOn(() =&gt; C2));

			<span style="color: blue">return</span> CachedValue(() =&gt; B1, () =&gt; 2 * C1 - C2);
		}
	}

	<span style="color: blue">public</span> <span style="color: blue">int</span> B2
	{
		<span style="color: blue">get</span>
		{
			Property(() =&gt; B2)
				.Depends(p =&gt; p.On(() =&gt; C2)
							   .AndOn(() =&gt; C3));

			<span style="color: blue">return</span> CachedValue(() =&gt; B2, () =&gt; -C2 + C3);
		}
	}

	<span style="color: blue">public</span> <span style="color: blue">int</span> C1
	{
		<span style="color: blue">get</span>
		{
			Property(() =&gt; C1)
				.Depends(p =&gt; p.On(() =&gt; D1)
							   .AndOn(() =&gt; D2));

			<span style="color: blue">return</span> CachedValue(() =&gt; C1, () =&gt; D1 + D2);
		}
	}

	<span style="color: blue">public</span> <span style="color: blue">int</span> C2
	{
		<span style="color: blue">get</span>
		{
			Property(() =&gt; C2)
				.Depends(p =&gt; p.On(() =&gt; D3)
							   .AndOn(() =&gt; D4));

			<span style="color: blue">return</span> CachedValue(() =&gt; C2, () =&gt; 3 * D3 + 3 * D4);
		}
	}

	<span style="color: blue">public</span> <span style="color: blue">int</span> C3
	{
		<span style="color: blue">get</span>
		{
			Property(() =&gt; C3)
				.Depends(p =&gt; p.On(() =&gt; D5)
							   .AndOn(() =&gt; D6));

			<span style="color: blue">return</span> CachedValue(() =&gt; C3, () =&gt; D5 + D6);
		}
	}

	<span style="color: blue">public</span> <span style="color: blue">int</span> D1
	{
		<span style="color: blue">get</span>
		{
			Property(() =&gt; D1)
				.Depends(p =&gt; p.On(() =&gt; E1));

			<span style="color: blue">return</span> CachedValue(() =&gt; D1, () =&gt; E1);
		}
	}

	<span style="color: blue">public</span> <span style="color: blue">int</span> D2
	{
		<span style="color: blue">get</span>
		{
			Property(() =&gt; D2)
				.Depends(p =&gt; p.On(() =&gt; E2));

			<span style="color: blue">return</span> CachedValue(() =&gt; D2, () =&gt; E2);
		}
	}

	<span style="color: blue">public</span> <span style="color: blue">int</span> D3
	{
		<span style="color: blue">get</span>
		{
			Property(() =&gt; D3)
				.Depends(p =&gt; p.On(() =&gt; E3));

			<span style="color: blue">return</span> CachedValue(() =&gt; D3, () =&gt; E3);
		}
	}

	<span style="color: blue">public</span> <span style="color: blue">int</span> D4
	{
		<span style="color: blue">get</span>
		{
			Property(() =&gt; D4)
				.Depends(p =&gt; p.On(() =&gt; E4));

			<span style="color: blue">return</span> CachedValue(() =&gt; D4, () =&gt; E4);
		}
	}

	<span style="color: blue">public</span> <span style="color: blue">int</span> D5
	{
		<span style="color: blue">get</span>
		{
			Property(() =&gt; D5)
				.Depends(p =&gt; p.On(() =&gt; E5));

			<span style="color: blue">return</span> CachedValue(() =&gt; D5, () =&gt; E5);
		}
	}

	<span style="color: blue">public</span> <span style="color: blue">int</span> D6
	{
		<span style="color: blue">get</span>
		{
			Property(() =&gt; D6)
				.Depends(p =&gt; p.On(() =&gt; E6));

			<span style="color: blue">return</span> CachedValue(() =&gt; D6, () =&gt; E6);
		}
	}

	<span style="color: blue">private</span> <span style="color: blue">int</span> _e1;
	<span style="color: blue">public</span> <span style="color: blue">int</span> E1
	{
		<span style="color: blue">get</span> { <span style="color: blue">return</span> _e1; }
		<span style="color: blue">set</span>
		{
			_e1 = value;
			NotifyPropertyChanged(() =&gt; E1);
		}
	}

	<span style="color: blue">private</span> <span style="color: blue">int</span> _e2;
	<span style="color: blue">public</span> <span style="color: blue">int</span> E2
	{
		<span style="color: blue">get</span> { <span style="color: blue">return</span> _e2; }
		<span style="color: blue">set</span>
		{
			_e2 = value;
			NotifyPropertyChanged(() =&gt; E2);
		}
	}

	<span style="color: blue">private</span> <span style="color: blue">int</span> _e3;
	<span style="color: blue">public</span> <span style="color: blue">int</span> E3
	{
		<span style="color: blue">get</span> { <span style="color: blue">return</span> _e3; }
		<span style="color: blue">set</span>
		{
			_e3 = value;
			NotifyPropertyChanged(() =&gt; E3);
		}
	}

	<span style="color: blue">private</span> <span style="color: blue">int</span> _e4;
	<span style="color: blue">public</span> <span style="color: blue">int</span> E4
	{
		<span style="color: blue">get</span> { <span style="color: blue">return</span> _e4; }
		<span style="color: blue">set</span>
		{
			_e4 = value;
			NotifyPropertyChanged(() =&gt; E4);
		}
	}

	<span style="color: blue">private</span> <span style="color: blue">int</span> _e5;
	<span style="color: blue">public</span> <span style="color: blue">int</span> E5
	{
		<span style="color: blue">get</span> { <span style="color: blue">return</span> _e5; }
		<span style="color: blue">set</span>
		{
			_e5 = value;
			NotifyPropertyChanged(() =&gt; E5);
		}
	}

	<span style="color: blue">private</span> <span style="color: blue">int</span> _e6;
	<span style="color: blue">public</span> <span style="color: blue">int</span> E6
	{
		<span style="color: blue">get</span> { <span style="color: blue">return</span> _e6; }
		<span style="color: blue">set</span>
		{
			_e6 = value;
			NotifyPropertyChanged(() =&gt; E6);
		}
	}
}
</pre>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blogs.interknowlogy.com/2013/05/17/pdfx-property-dependency-framework-part-x-caching/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
