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

<channel>
	<title>Kiener&#039;s Blog</title>
	<atom:link href="http://blog.thekieners.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.thekieners.com</link>
	<description>Blog of Beat Kiener, containing my experiences, thoughts, comments and questions</description>
	<lastBuildDate>Thu, 26 Jan 2012 02:01:22 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='blog.thekieners.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Kiener&#039;s Blog</title>
		<link>http://blog.thekieners.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://blog.thekieners.com/osd.xml" title="Kiener&#039;s Blog" />
	<atom:link rel='hub' href='http://blog.thekieners.com/?pushpress=hub'/>
		<item>
		<title>Touch enabled runtime for Windows Slates Apps</title>
		<link>http://blog.thekieners.com/2011/09/07/touch-enabled-runtime-for-windows-slates-apps-2/</link>
		<comments>http://blog.thekieners.com/2011/09/07/touch-enabled-runtime-for-windows-slates-apps-2/#comments</comments>
		<pubDate>Wed, 07 Sep 2011 08:44:43 +0000</pubDate>
		<dc:creator>beatkiener</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[evidence nova]]></category>
		<category><![CDATA[Metro UI]]></category>
		<category><![CDATA[touch]]></category>

		<guid isPermaLink="false">https://bkiener.wordpress.com/2011/09/07/touch-enabled-runtime-for-windows-slates-apps-2/</guid>
		<description><![CDATA[&#160; &#160; Before Microsoft is changing the game next week at BUILD conference in Anaheim, I want to post one of our current developments. Driven by a project need, we have built a real touch enabled windows slate runtime. The runtime includes: touch enabled date picker touch enabled Combobox with popover selector touch enabled Checkbox [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.thekieners.com&amp;blog=7436128&amp;post=558&amp;subd=bkiener&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>&#160;</p>
<p><a href="http://bkiener.files.wordpress.com/2011/09/fmnemdskmskdmskmskxmsxksmsdkwdmk.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="fmnemdskmskdmskmskxmsxksmsdkwdmk" border="0" alt="fmnemdskmskdmskmskxmsxksmsdkwdmk" src="http://bkiener.files.wordpress.com/2011/09/fmnemdskmskdmskmskxmsxksmsdkwdmk_thumb.png?w=353&#038;h=254" width="353" height="254" /></a></p>
<p>&#160;</p>
<p>Before Microsoft is changing the game next week at <a href="http://www.buildwindows.com/" target="_blank">BUILD conference in Anaheim</a>, I want to post one of our current developments. Driven by a project need, we have built a real touch enabled windows slate runtime. </p>
<p>The runtime includes:</p>
<ul>
<li><strong>touch enabled date picker</strong> </li>
<li><strong>touch enabled Combobox</strong> with popover selector </li>
<li><strong>touch enabled Checkbox</strong> with popover selector </li>
<li>A <strong>virtual touch keyboard</strong> which is fully integrated into the runtime in order that the textbox can be correct positioned. So the keyboard will never hide the textbox target. The keyboard provides full input scope for numbers, text and special signs (inspired by the Windows Phone 7 keyboard). </li>
<li>A <strong>navigation service</strong> to move from one to other screens. </li>
<li><strong>Metro UI</strong> style (not yet finished). We believe Windows 8 will push Metro much more. On the other side, we experienced a much better rendering performance on slates which haven’t that much of CPU and GPU power as on a standard desktop. This allows us to use the runtime on lower equipped hardware too. </li>
<li><strong>touch enabled Textbox with select, copy, paste and delete</strong> functionality. </li>
<li><strong>touch enabled multiline, long-text control</strong> which morphs to a larger editor while in edit mode. </li>
<li><strong>touch enabled list box</strong> which allows for very smooth touch scrolling, including a bounce effect if it reaches the end. </li>
<li><strong>Full Screen app style</strong>, without windows border and chrome. </li>
<li><strong>Message box service</strong> </li>
<li>And much more…. </li>
</ul>
<p>&#160;</p>
<p>Deep knowledge in Windows Phone 7 programming allowed us to get the most possible out of WPF in which we have built the runtime, so that the controls and application feels like a real world touch application like other known platforms. We&#8217;ve had enough of words. The best way to show our first release is a short video.</p>
<p>&#160;</p>
<p><a href="http://files.thekieners.com/blogcontent/2011/Evidence4SlateV1/" target="_blank"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="rjidmewcewmkcdmk3454km3ckm3e4df" border="0" alt="rjidmewcewmkcdmk3454km3ckm3e4df" src="http://bkiener.files.wordpress.com/2011/09/rjidmewcewmkcdmk3454km3ckm3e4df.png?w=369&#038;h=214" width="369" height="214" /></a></p>
<p><font size="2"><a title="http://files.thekieners.com/blogcontent/2011/Evidence4SlateV1/" href="http://files.thekieners.com/blogcontent/2011/Evidence4SlateV1/" target="_blank">http://files.thekieners.com/blogcontent/2011/Evidence4SlateV1/</a></font></p>
<p>Btw. This video was recorded by a Windows Phone 7! Not that bad for a phone.</p>
<p>&#160;</p>
<p>What&#8217;s coming next?</p>
<ul>
<li>Thumbstoning the View State, in order that the user can exit the app at any time and restart it at the position he has left the app (Similar as we know form the Windows Phone). </li>
<li>Improving Metro style </li>
<li>Adding more controls </li>
<li>See what is coming with the Windows 8 announcement next week…. </li>
</ul>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/bkiener.wordpress.com/558/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/bkiener.wordpress.com/558/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/bkiener.wordpress.com/558/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/bkiener.wordpress.com/558/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/bkiener.wordpress.com/558/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/bkiener.wordpress.com/558/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/bkiener.wordpress.com/558/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/bkiener.wordpress.com/558/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/bkiener.wordpress.com/558/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/bkiener.wordpress.com/558/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/bkiener.wordpress.com/558/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/bkiener.wordpress.com/558/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/bkiener.wordpress.com/558/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/bkiener.wordpress.com/558/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.thekieners.com&amp;blog=7436128&amp;post=558&amp;subd=bkiener&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.thekieners.com/2011/09/07/touch-enabled-runtime-for-windows-slates-apps-2/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/bbdffd0b655e44e12898217ff1973ad3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">beatkiener</media:title>
		</media:content>

		<media:content url="http://bkiener.files.wordpress.com/2011/09/fmnemdskmskdmskmskxmsxksmsdkwdmk_thumb.png" medium="image">
			<media:title type="html">fmnemdskmskdmskmskxmsxksmsdkwdmk</media:title>
		</media:content>

		<media:content url="http://bkiener.files.wordpress.com/2011/09/rjidmewcewmkcdmk3454km3ckm3e4df.png" medium="image">
			<media:title type="html">rjidmewcewmkcdmk3454km3ckm3e4df</media:title>
		</media:content>
	</item>
		<item>
		<title>Passed Silverlight 4 Development Exam</title>
		<link>http://blog.thekieners.com/2011/08/16/passed-silverlight-4-development-exam/</link>
		<comments>http://blog.thekieners.com/2011/08/16/passed-silverlight-4-development-exam/#comments</comments>
		<pubDate>Tue, 16 Aug 2011 07:09:26 +0000</pubDate>
		<dc:creator>beatkiener</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[MCTS]]></category>

		<guid isPermaLink="false">https://bkiener.wordpress.com/2011/08/16/passed-silverlight-4-development-exam/</guid>
		<description><![CDATA[<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.thekieners.com&amp;blog=7436128&amp;post=543&amp;subd=bkiener&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://bkiener.files.wordpress.com/2011/08/mctssl42.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="mctssl4" border="0" alt="mctssl4" src="http://bkiener.files.wordpress.com/2011/08/mctssl4_thumb2.png?w=661&#038;h=502" width="661" height="502" /></a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/bkiener.wordpress.com/543/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/bkiener.wordpress.com/543/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/bkiener.wordpress.com/543/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/bkiener.wordpress.com/543/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/bkiener.wordpress.com/543/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/bkiener.wordpress.com/543/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/bkiener.wordpress.com/543/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/bkiener.wordpress.com/543/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/bkiener.wordpress.com/543/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/bkiener.wordpress.com/543/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/bkiener.wordpress.com/543/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/bkiener.wordpress.com/543/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/bkiener.wordpress.com/543/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/bkiener.wordpress.com/543/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.thekieners.com&amp;blog=7436128&amp;post=543&amp;subd=bkiener&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.thekieners.com/2011/08/16/passed-silverlight-4-development-exam/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/bbdffd0b655e44e12898217ff1973ad3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">beatkiener</media:title>
		</media:content>

		<media:content url="http://bkiener.files.wordpress.com/2011/08/mctssl4_thumb2.png" medium="image">
			<media:title type="html">mctssl4</media:title>
		</media:content>
	</item>
		<item>
		<title>Passed Windows Communication Foundation Exam</title>
		<link>http://blog.thekieners.com/2011/07/29/passed-windows-communication-foundation-exam/</link>
		<comments>http://blog.thekieners.com/2011/07/29/passed-windows-communication-foundation-exam/#comments</comments>
		<pubDate>Fri, 29 Jul 2011 07:09:00 +0000</pubDate>
		<dc:creator>beatkiener</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[MCTS]]></category>

		<guid isPermaLink="false">https://bkiener.wordpress.com/2011/07/29/passed-windows-communication-foundation-exam/</guid>
		<description><![CDATA[<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.thekieners.com&amp;blog=7436128&amp;post=540&amp;subd=bkiener&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://bkiener.files.wordpress.com/2011/08/mctswcf.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border:0;" title="mctswcf" src="http://bkiener.files.wordpress.com/2011/08/mctswcf_thumb.png?w=673&#038;h=470" alt="mctswcf" width="673" height="470" border="0" /></a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/bkiener.wordpress.com/540/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/bkiener.wordpress.com/540/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/bkiener.wordpress.com/540/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/bkiener.wordpress.com/540/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/bkiener.wordpress.com/540/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/bkiener.wordpress.com/540/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/bkiener.wordpress.com/540/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/bkiener.wordpress.com/540/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/bkiener.wordpress.com/540/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/bkiener.wordpress.com/540/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/bkiener.wordpress.com/540/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/bkiener.wordpress.com/540/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/bkiener.wordpress.com/540/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/bkiener.wordpress.com/540/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.thekieners.com&amp;blog=7436128&amp;post=540&amp;subd=bkiener&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.thekieners.com/2011/07/29/passed-windows-communication-foundation-exam/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/bbdffd0b655e44e12898217ff1973ad3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">beatkiener</media:title>
		</media:content>

		<media:content url="http://bkiener.files.wordpress.com/2011/08/mctswcf_thumb.png" medium="image">
			<media:title type="html">mctswcf</media:title>
		</media:content>
	</item>
		<item>
		<title>Using Google&#8217;s LibPhoneNumber in Microsoft.NET with C#</title>
		<link>http://blog.thekieners.com/2011/06/06/using-googles-libphonenumber-in-microsoft-net-with-c/</link>
		<comments>http://blog.thekieners.com/2011/06/06/using-googles-libphonenumber-in-microsoft-net-with-c/#comments</comments>
		<pubDate>Mon, 06 Jun 2011 05:09:03 +0000</pubDate>
		<dc:creator>beatkiener</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[libphonenumber]]></category>

		<guid isPermaLink="false">https://bkiener.wordpress.com/2011/06/06/using-googles-libphonenumber-in-microsoft-net-with-c/</guid>
		<description><![CDATA[LibPhoneNumber from Google is an awesome library. LibPhoneNumber is a Java, C++ and Javascript library for parsing, formatting, storing and validating international phone numbers. You can input any phone number from over the world and the lib is telling you if the phone number might be valid, from which country the phone number is and [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.thekieners.com&amp;blog=7436128&amp;post=532&amp;subd=bkiener&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://libphonenumber.googlecode.com" target="_blank">LibPhoneNumber</a> from Google is an awesome library. LibPhoneNumber is a Java, C++ and Javascript library for parsing, formatting, storing and validating international phone numbers. You can input any phone number from over the world and the lib is telling you if the phone number might be valid, from which country the phone number is and the number format which is common for the number type and region.</p>
<p>&#160;</p>
<p><a href="http://bkiener.files.wordpress.com/2011/06/libphonenrresultsmsmsmssm.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="libphonenrresultsmsmsmssm" border="0" alt="libphonenrresultsmsmsmssm" src="http://bkiener.files.wordpress.com/2011/06/libphonenrresultsmsmsmssm_thumb.png?w=576&#038;h=288" width="576" height="288" /></a></p>
<p>&#160;</p>
<p>Well, I was looking for such functionality, because our CRM users have to enter phone numbers from all over the world and we want to format and validate the phone number. Unfortunately there is no C# or VB.NET version available from this great Google library so I ended in doing some tests to integrate them into Microsoft.NET environment.</p>
<p>&#160;</p>
<h2>The first try</h2>
<p>I&#8217;ve build my own JavaScript function the get the needed functionality running (region code, number formatting) in my own html site. Then I merged all related Google JS files from the <a href="http://code.google.com/intl/de-CH/closure/library" target="_blank">closure-libaray</a> into one single file with help of the Google <a href="http://code.google.com/intl/de-CH/closure/library/docs/closurebuilder.html" target="_blank">closurebuilder.py</a>. This task is very good documented by Google.</p>
<p>So, after that I was looking for a JavaScript engine running in .NET, so that I can execute JS-code in managed .NET runtime. I thought the DLR support of .NET would be the best environment to do this. Unfortunately there is no official JS engine from Microsoft so far. So I ended in trying some engines found on <a href="www.codeplex.com" target="_blank">codeplex.com</a>. <a href="http://javascriptdotnet.codeplex.com/" target="_blank">javascriptdotnet.codeplex.com</a> did the job. This engine can interpret the Google JS file (which has a size of ~500kb and is quite big) and returns the correct result. I should mention here that other engines did also work but sometimes with a wrong result. But stop, there is still a problem with this JS engine: it does not run under 64bit system. This is because the engine used the v8 engine from Google behind the scenes and the v8 only supports 32bit (x86) architectures. There are some hacks to use v8 under 64bit but these seems to be too much experimental.</p>
<h2>&#160;</h2>
<h2>Second try</h2>
<p>I&#8217;ve tried to convert the Java code into C# manually and by a converter tool. Result: no success, because there are too much of specialties in the code and my java knowledge is somewhat old.</p>
<h2>&#160;</h2>
<h2>Third try</h2>
<p>There is a C++ version available and I thought it should be possible to use it via p/invoke within .NET. But there seems to be a similar issue with 32/64bit systems. So I did not further investigate into this possibility.</p>
<h2>&#160;</h2>
<h2>Last and successful try</h2>
<p>So finally I&#8217;ve tried to use the phone metadata directly within C#. Google&#8217;s metadata behind the Java project is a very well structured XML document written by Google which contains a lot of regex patterns. These patterns build a structure to find out to which country a number belongs and which number format is common for a specific region. </p>
<p>&#160;</p>
<p><a href="http://bkiener.files.wordpress.com/2011/06/phonemetadataxmlofromgooglednmdmdmdm.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="phonemetadataxmlofromgooglednmdmdmdm" border="0" alt="phonemetadataxmlofromgooglednmdmdmdm" src="http://bkiener.files.wordpress.com/2011/06/phonemetadataxmlofromgooglednmdmdmdm_thumb.png?w=750&#038;h=371" width="750" height="371" /></a></p>
<p>&#160;</p>
<p>I was very surprised how easy it was to use this metadata XML in my own code. With just a few lines and within two hours the prototype was working…. well, to finalize the library has cost me another day… </p>
<p>&#160;</p>
<h2>Source</h2>
<p>At the end I thought it is worth to share my code with other C#/VB.NET folks. <a href="http://files.thekieners.com/blogcontent/2011/GlauxSoft.Phone.NumberUtil_revision2477.zip" target="_blank">You can grab the code here.</a> It does not everything the original Google library can do; I just implemented the cases that we need in our project (resolve the region and common format for any phone number). Here is a quick example of the C# code (from the Unit Test project…)</p>
<p>&#160;</p>
<p><a href="http://bkiener.files.wordpress.com/2011/06/phonenumberresultincsharp.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="phonenumberresultincsharp" border="0" alt="phonenumberresultincsharp" src="http://bkiener.files.wordpress.com/2011/06/phonenumberresultincsharp_thumb.png?w=738&#038;h=233" width="738" height="233" /></a></p>
<p>&#160;</p>
<p>Let me see if someone other is interested to use this C# version. If so i can put the code onto codeplex.com or so. Any feedback is highly appreciated.</p>
<p>&#160;</p>
<p>Happy coding</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/bkiener.wordpress.com/532/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/bkiener.wordpress.com/532/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/bkiener.wordpress.com/532/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/bkiener.wordpress.com/532/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/bkiener.wordpress.com/532/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/bkiener.wordpress.com/532/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/bkiener.wordpress.com/532/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/bkiener.wordpress.com/532/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/bkiener.wordpress.com/532/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/bkiener.wordpress.com/532/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/bkiener.wordpress.com/532/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/bkiener.wordpress.com/532/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/bkiener.wordpress.com/532/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/bkiener.wordpress.com/532/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.thekieners.com&amp;blog=7436128&amp;post=532&amp;subd=bkiener&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.thekieners.com/2011/06/06/using-googles-libphonenumber-in-microsoft-net-with-c/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/bbdffd0b655e44e12898217ff1973ad3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">beatkiener</media:title>
		</media:content>

		<media:content url="http://bkiener.files.wordpress.com/2011/06/libphonenrresultsmsmsmssm_thumb.png" medium="image">
			<media:title type="html">libphonenrresultsmsmsmssm</media:title>
		</media:content>

		<media:content url="http://bkiener.files.wordpress.com/2011/06/phonemetadataxmlofromgooglednmdmdmdm_thumb.png" medium="image">
			<media:title type="html">phonemetadataxmlofromgooglednmdmdmdm</media:title>
		</media:content>

		<media:content url="http://bkiener.files.wordpress.com/2011/06/phonenumberresultincsharp_thumb.png" medium="image">
			<media:title type="html">phonenumberresultincsharp</media:title>
		</media:content>
	</item>
		<item>
		<title>Just bought a Mac</title>
		<link>http://blog.thekieners.com/2011/02/11/just-bought-a-mac/</link>
		<comments>http://blog.thekieners.com/2011/02/11/just-bought-a-mac/#comments</comments>
		<pubDate>Fri, 11 Feb 2011 13:21:39 +0000</pubDate>
		<dc:creator>beatkiener</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">https://bkiener.wordpress.com/2011/02/11/just-bought-a-mac/</guid>
		<description><![CDATA[For testing reasons we bought us a new MacBook. We need them mainly to test some web projects in the Safari browser and to check whether our Silverlight client works well on an Apple machine. Nothing special, just a simple MacBook… but my frist ever… …grab the newest Silverlight Plugin… Since that there are no [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.thekieners.com&amp;blog=7436128&amp;post=525&amp;subd=bkiener&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>For testing reasons we bought us a new MacBook. We need them mainly to test some web projects in the Safari browser and to check whether our Silverlight client works well on an Apple machine.</p>
<p><a href="http://bkiener.files.wordpress.com/2011/02/mymac1.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="mymac1" border="0" alt="mymac1" src="http://bkiener.files.wordpress.com/2011/02/mymac1_thumb.png?w=404&#038;h=252" width="404" height="252" /></a></p>
<p><a href="http://bkiener.files.wordpress.com/2011/02/mymac2.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="mymac2" border="0" alt="mymac2" src="http://bkiener.files.wordpress.com/2011/02/mymac2_thumb.png?w=404&#038;h=241" width="404" height="241" /></a></p>
<p>Nothing special, just a simple MacBook… but my frist ever… <img style="border-style:none;" class="wlEmoticon wlEmoticon-smile" alt="Smiley" src="http://bkiener.files.wordpress.com/2011/02/wlemoticon-smile.png?w=500" /></p>
<p><a href="http://bkiener.files.wordpress.com/2011/02/mymac3.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="mymac3" border="0" alt="mymac3" src="http://bkiener.files.wordpress.com/2011/02/mymac3_thumb.png?w=404&#038;h=326" width="404" height="326" /></a></p>
<p>…grab the newest Silverlight Plugin…</p>
<p><a href="http://bkiener.files.wordpress.com/2011/02/img_0326.jpg"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="IMG_0326" border="0" alt="IMG_0326" src="http://bkiener.files.wordpress.com/2011/02/img_0326_thumb.jpg?w=404&#038;h=304" width="404" height="304" /></a></p>
<p>Since that there are no signs that Apple will allow Silverlight on iOS, I decided to start with iPhone and iPad development just for fun and experimental stuff. Recently I&#8217;ve started with learning objective-c and cocoa framework. Fortunately there exists a cross-compiler solution with the MonoTouch framework so that I can use my favorite programming language, C#, on the Mac.</p>
<p><a href="http://bkiener.files.wordpress.com/2011/02/monotouch.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="monotouch" border="0" alt="monotouch" src="http://bkiener.files.wordpress.com/2011/02/monotouch_thumb.png?w=404&#038;h=434" width="404" height="434" /></a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/bkiener.wordpress.com/525/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/bkiener.wordpress.com/525/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/bkiener.wordpress.com/525/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/bkiener.wordpress.com/525/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/bkiener.wordpress.com/525/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/bkiener.wordpress.com/525/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/bkiener.wordpress.com/525/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/bkiener.wordpress.com/525/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/bkiener.wordpress.com/525/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/bkiener.wordpress.com/525/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/bkiener.wordpress.com/525/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/bkiener.wordpress.com/525/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/bkiener.wordpress.com/525/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/bkiener.wordpress.com/525/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.thekieners.com&amp;blog=7436128&amp;post=525&amp;subd=bkiener&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.thekieners.com/2011/02/11/just-bought-a-mac/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/bbdffd0b655e44e12898217ff1973ad3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">beatkiener</media:title>
		</media:content>

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

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

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

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

		<media:content url="http://bkiener.files.wordpress.com/2011/02/img_0326_thumb.jpg" medium="image">
			<media:title type="html">IMG_0326</media:title>
		</media:content>

		<media:content url="http://bkiener.files.wordpress.com/2011/02/monotouch_thumb.png" medium="image">
			<media:title type="html">monotouch</media:title>
		</media:content>
	</item>
		<item>
		<title>Video about my first Windows Phone 7 App in the marketplace</title>
		<link>http://blog.thekieners.com/2010/12/01/video-about-my-first-windows-phone-7-app-in-the-marketplace/</link>
		<comments>http://blog.thekieners.com/2010/12/01/video-about-my-first-windows-phone-7-app-in-the-marketplace/#comments</comments>
		<pubDate>Wed, 01 Dec 2010 21:59:40 +0000</pubDate>
		<dc:creator>beatkiener</dc:creator>
				<category><![CDATA[Phone7]]></category>
		<category><![CDATA[Silverlight]]></category>

		<guid isPermaLink="false">https://bkiener.wordpress.com/2010/12/01/video-about-my-first-windows-phone-7-app-in-the-marketplace/</guid>
		<description><![CDATA[It demonstrates the access to our backend system called “evidence” and allows to browse online through different data objects. Check out the video (put sound on…)<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.thekieners.com&amp;blog=7436128&amp;post=512&amp;subd=bkiener&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>It demonstrates the access to our backend system called “evidence” and allows to browse online through different data objects.</p>
<p>Check out the video (put sound on…)</p>
<p><a href="http://files.thekieners.com/blogcontent/2010/WindowsPhone7"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="VideoWindowsPhone" border="0" alt="VideoWindowsPhone" src="http://bkiener.files.wordpress.com/2010/12/videowindowsphone.png?w=218&#038;h=360" width="218" height="360" /></a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/bkiener.wordpress.com/512/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/bkiener.wordpress.com/512/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/bkiener.wordpress.com/512/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/bkiener.wordpress.com/512/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/bkiener.wordpress.com/512/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/bkiener.wordpress.com/512/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/bkiener.wordpress.com/512/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/bkiener.wordpress.com/512/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/bkiener.wordpress.com/512/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/bkiener.wordpress.com/512/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/bkiener.wordpress.com/512/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/bkiener.wordpress.com/512/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/bkiener.wordpress.com/512/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/bkiener.wordpress.com/512/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.thekieners.com&amp;blog=7436128&amp;post=512&amp;subd=bkiener&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.thekieners.com/2010/12/01/video-about-my-first-windows-phone-7-app-in-the-marketplace/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/bbdffd0b655e44e12898217ff1973ad3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">beatkiener</media:title>
		</media:content>

		<media:content url="http://bkiener.files.wordpress.com/2010/12/videowindowsphone.png" medium="image">
			<media:title type="html">VideoWindowsPhone</media:title>
		</media:content>
	</item>
		<item>
		<title>Expression Blend Samples not working with Silverlight 4 and WPF 4</title>
		<link>http://blog.thekieners.com/2010/11/09/expression-blend-samples-not-working-with-silverlight-4-and-wpf-4/</link>
		<comments>http://blog.thekieners.com/2010/11/09/expression-blend-samples-not-working-with-silverlight-4-and-wpf-4/#comments</comments>
		<pubDate>Tue, 09 Nov 2010 16:00:24 +0000</pubDate>
		<dc:creator>beatkiener</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">https://bkiener.wordpress.com/2010/11/09/expression-blend-samples-not-working-with-silverlight-4-and-wpf-4/</guid>
		<description><![CDATA[This blog post is just to document my experience with the Expression Blend Sample source together with Silverlight 4 or WPF 4.0 If you are using the Expression Blend Samples from codeplex (http://expressionblend.codeplex.com) then you might experience some problems when using the included triggers and behavior within SL4 or WPF4 runtime. The problem is that [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.thekieners.com&amp;blog=7436128&amp;post=507&amp;subd=bkiener&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This blog post is just to document my experience with the Expression Blend Sample source together with Silverlight 4 or WPF 4.0</p>
<p>If you are using the Expression Blend Samples from codeplex (<a href="http://expressionblend.codeplex.com" target="_blank">http://expressionblend.codeplex.com</a>) then you might experience some problems when using the included triggers and behavior within SL4 or WPF4 runtime. The problem is that a dependency property with the type <em>System.Windows.Data.Binding</em> is not set to due to a change in the <em>MS.Internal.Data.DynamicValueConverter</em> class. Since SL4 / WPF4 the <em>DynamicValueConverter</em> uses the value of the binding instead of the binding instance itself. As example, the Command property of the <em>InvokeDataCommand</em> trigger is declared as <em>System.Windows.Data.Binding</em>, but the <em>DynamicValueConverter</em> will return the value of the binding, an ICommand compatible instance, and not the binding instance itself. So, the command property will always be null, because <em>DynamicValueConverter</em> cannot cast the object. And if the command binding cannot be set, the BindingListener, which is used internally, will not work correctly.</p>
<p><a href="http://bkiener.files.wordpress.com/2010/11/image.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="http://bkiener.files.wordpress.com/2010/11/image_thumb.png?w=692&#038;h=465" width="692" height="465" /></a></p>
<p>If we change the binding target from a dependency property to a simple CLR property, then the <em>DynamicValueConverter</em> can set the property and <em>InvokeDataCommand</em> works as before.</p>
<p><a href="http://bkiener.files.wordpress.com/2010/11/image1.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="http://bkiener.files.wordpress.com/2010/11/image_thumb1.png?w=442&#038;h=178" width="442" height="178" /></a></p>
<p>I’ve found that codeplex user <a href="http://www.codeplex.com/site/users/view/AvdMeulen">AvdMeulen</a> changed the whole Expression sample source and submitted a zip package on codeplex. See link below.</p>
<p>&#160;</p>
<p>Let’s go into more details:</p>
<p>Silverlight 3 does not allow using data binding on types which are NOT inherited from class <em>FrameworkElement</em>. That means that the entire Silverlight standard behaviors and triggers do not support data binding, because the Trigger and Behavior classes are directly derived from <em>DepedencyObject</em>. Nevertheless, if you use data-binding with a trigger- or behavior property in Silverlight 3, then the binding system does not execute the binding, but it tries to set the binding instance itself to the property as a value of type <em>System.Windows.Data.Binding</em>. This will be done through the <em>MS.Internal.Data.DynamicValueConverter</em> class. If the target property is not of type <em>System.Windows.Data.Binding</em> it will not work and you get an <em>AG_E_PARSER_BAD_PROPERTY_VALUE</em> exception from the XAML parser. Based on this binding-engine behavior, <a href="http://blois.us/blog/2009/04/datatrigger-bindings-on-non.html" target="_blank">Pete Blois</a> invented the <em>BindingListener</em> class.     <br />His trick was to declare properties on behaviors and triggers as type of <em>System.Windows.Data.Binding</em> in order to get them bindable. The binding is still not executed by the binding system and to bind them he declared a dummy attached dependency property and set the binding instance to the attached dependency property. The result is that the attached dependency property can execute the binding and we can just listen to when the attached dependency property changes. This results in a full functional binding for non-<em>FrameworkElements</em>. All this is encapsulated in the <em>BindingListener</em> class.</p>
<p>But now, why it does not work for SL4 anymore? The answer can be found in the <a href="http://msdn.microsoft.com/en-us/library/cc645049(VS.95).aspx" target="_blank">breaking changes for Silverlight 4</a>.</p>
<p><a href="http://bkiener.files.wordpress.com/2010/11/image2.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="image" border="0" alt="image" src="http://bkiener.files.wordpress.com/2010/11/image_thumb2.png?w=709&#038;h=494" width="709" height="494" /></a></p>
<p>&#160;</p>
<p>With SL4 it&#8217;s now possible to data binding dependency properties on triggers and behavior too, which makes the BindingListener class useless. This is also the reason why the Binding property remains null, because the SL4 binding engine set a BindingExpression and not the Binding itselfs and the BindingExpression tries to set the Command value instead of the Binding instance.</p>
<p>&#160;</p>
<p>Link resources:    <br /><a href="http://expressionblend.codeplex.com/workitem/8148">http://expressionblend.codeplex.com/workitem/8148</a>     <br /><a href="http://www.sztronka.com/2010/01/behaviors-triggers-and-memory-leaks-in.html">http://www.sztronka.com/2010/01/behaviors-triggers-and-memory-leaks-in.html</a>    <br /><a href="http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/2010/03/27/silverlight-4-blend-4-mvvm-binding-dependencyobject.aspx">http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/2010/03/27/silverlight-4-blend-4-mvvm-binding-dependencyobject.aspx</a>    <br /><a href="http://compiledexperience.com/blog/posts/blendable-mvvm-commands-and-behaviors">http://compiledexperience.com/blog/posts/blendable-mvvm-commands-and-behaviors</a>    <br /><a href="http://blois.us/blog/2009/04/datatrigger-bindings-on-non.html">http://blois.us/blog/2009/04/datatrigger-bindings-on-non.html</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/bkiener.wordpress.com/507/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/bkiener.wordpress.com/507/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/bkiener.wordpress.com/507/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/bkiener.wordpress.com/507/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/bkiener.wordpress.com/507/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/bkiener.wordpress.com/507/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/bkiener.wordpress.com/507/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/bkiener.wordpress.com/507/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/bkiener.wordpress.com/507/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/bkiener.wordpress.com/507/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/bkiener.wordpress.com/507/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/bkiener.wordpress.com/507/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/bkiener.wordpress.com/507/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/bkiener.wordpress.com/507/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.thekieners.com&amp;blog=7436128&amp;post=507&amp;subd=bkiener&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.thekieners.com/2010/11/09/expression-blend-samples-not-working-with-silverlight-4-and-wpf-4/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/bbdffd0b655e44e12898217ff1973ad3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">beatkiener</media:title>
		</media:content>

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

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

		<media:content url="http://bkiener.files.wordpress.com/2010/11/image_thumb2.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>RelativeSource Binding with FindAncestor mode in Silverlight</title>
		<link>http://blog.thekieners.com/2010/09/08/relativesource-binding-with-findancestor-mode-in-silverlight/</link>
		<comments>http://blog.thekieners.com/2010/09/08/relativesource-binding-with-findancestor-mode-in-silverlight/#comments</comments>
		<pubDate>Wed, 08 Sep 2010 04:46:27 +0000</pubDate>
		<dc:creator>beatkiener</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[MVVM]]></category>
		<category><![CDATA[Silverlight]]></category>

		<guid isPermaLink="false">https://bkiener.wordpress.com/2010/09/08/relativesource-binding-with-findancestor-mode-in-silverlight/</guid>
		<description><![CDATA[Silverlight 3 introduced the RelativeSource Binding that is well known from WPF. Unfortunately Silverlight only supports the two modes Self and TemplatedParent. &#160; I don’t know why the FindAncestor mode is missing in Silverlight’s RelativeSource binding, but there is a real need for that in Silverlight too. I’m finding me quite often in a dead-end [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.thekieners.com&amp;blog=7436128&amp;post=502&amp;subd=bkiener&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Silverlight 3 introduced the <a href="http://msdn.microsoft.com/en-us/library/system.windows.data.binding.relativesource%28VS.95%29.aspx">RelativeSource</a> Binding that is well known from WPF. Unfortunately Silverlight only supports the two modes <em>Self</em> and <em>TemplatedParent</em>.</p>
<p><a href="http://bkiener.files.wordpress.com/2010/09/image.png"><img style="display:inline;border-width:0;" title="image" border="0" alt="image" src="http://bkiener.files.wordpress.com/2010/09/image_thumb.png?w=624&#038;h=96" width="624" height="96" /></a>&#160;</p>
<p>I don’t know why the <em>FindAncestor</em> mode is missing in Silverlight’s RelativeSource binding, but there is a real need for that in Silverlight too. I’m finding me quite often in a dead-end ifI want to set a binding to a command or value in the view model within a list box item template. The problem in the example below is that the list box item has its own data context set to an item in the items-collection.</p>
<p><a href="http://bkiener.files.wordpress.com/2010/09/image1.png"><img style="display:inline;border-width:0;" title="image" border="0" alt="image" src="http://bkiener.files.wordpress.com/2010/09/image_thumb1.png?w=715&#038;h=265" width="715" height="265" /></a> </p>
<p>In the case above I really need a relative binding to set a binding to the RemoveCommand and to the global Picklist collection as comboxbox source. On solution is to create a bidirectional relationship between the view models behind the scene in order to get a reference to the parent view model within the child view model. But this not the solution I was looking for. </p>
<p>After some googling I found a binding helper written by <a href="http://www.scottlogic.co.uk/blog/colin/2009/02/relativesource-binding-in-silverlight/" target="_blank">Colin Eberhardt</a> which enables it to use a relative binding with help of an attached dependency property. </p>
<p><a href="http://bkiener.files.wordpress.com/2010/09/clip_image0011.png"><img style="display:inline;border-width:0;" title="clip_image001" border="0" alt="clip_image001" src="http://bkiener.files.wordpress.com/2010/09/clip_image001_thumb1.png?w=600&#038;h=113" width="600" height="113" /></a> </p>
<p>Explained in brief: Colin uses an attached property to set his own relative source binding configuration for an specific element. When the attached property becomes attached to the target element it adds a handler for the elements loaded event. Within the event handler, he walks up the visual tree to find the specified ancestor and constructs a binding expression between the source and target properties. </p>
<p>Based on Colin’s idea I’ve created a similar implementation which provides some different behaviors: </p>
<ul>
<li>Support for a list of relative binding. This allows binding more than one property of an element. </li>
<li>It does not use a relay object in the middle of the binding. It is a pure binding without any custom code in between. This gain in a better performance, especially when using a storyboard to animate the data bound value. </li>
<li>I have added some special type of relative binding mode which is called as <i>ParentDataContext</i> mode. In that mode it walks up the visual tree until it finds a new data context. This is very helpful when having templates in an ItemsControl, ListBox or DataGrid. </li>
<li>Support for non-dependency property as source, e.g. direct usage of view model properties. </li>
<li>Support for property path syntax for the source property, e.g. <em>DataContext.Person.Name</em> </li>
<li>The AncestorType allows to set a base class as type criteria instead of the concrete type, e.g. if the concrete element is of type Grid, then the AncestorType can be set to Panel. </li>
<li>Allows to set the relative binding for attached properties too, e.g. to bind TooltipService.Tooltip property. </li>
<li>Allows to use <em>OneWay</em> or <em>OneTime</em> binding mode. </li>
<li>Allows to set any other binding parameter such as <em>ValidatesOnNotifyDataErrors</em>, <em>ValidatesOnExceptions</em>, <em>ValidatesOnDataErrors</em>, <em>NotifyOnValidationError</em> and <em>ConverterCulture.</em> </li>
<li>Enables to set the XAML namespace for controls which are not in the core-control assembly. </li>
</ul>
<h2>How to use</h2>
<p>Let’s have a look at some examples.</p>
<p>1. Simply relative binding with ancestor type </p>
<p><strong></strong></p>
</p>
<pre><span style="color:#0000ff;">&lt;</span><span style="color:#800000;">ComboBox</span><span style="color:#0000ff;">&gt;</span>
    <span style="color:#0000ff;">&lt;</span><span style="color:#c71585;">local</span>:<span style="color:#800000;">BindingHelper.Binding</span><span style="color:#0000ff;">&gt;</span>
            <span style="color:#0000ff;">&lt;</span><span style="color:#c71585;">local</span>:<span style="color:#800000;">RelativeSourceBinding</span> <span style="color:#ff0000;">Path</span>=<span style="color:#0000ff;">&quot;DataContext.Picklist&quot;</span>
                    <span style="color:#ff0000;">TargetProperty</span>=<span style="color:#0000ff;">&quot;ItemsSource&quot;</span> <span style="color:#ff0000;">RelativeMode</span>=<span style="color:#0000ff;">&quot;FindAncestor&quot;</span>
                    <span style="color:#ff0000;">AncestorType</span>=<span style="color:#0000ff;">&quot;UserControl&quot;</span> <span style="color:#0000ff;">/&gt;</span>
    <span style="color:#0000ff;">&lt;/</span><span style="color:#c71585;">local</span>:<span style="color:#800000;">BindingHelper.Binding</span><span style="color:#0000ff;">&gt;</span>
<span style="color:#0000ff;">&lt;/</span><span style="color:#800000;">ComboBox</span><span style="color:#0000ff;">&gt;</span></pre>
<pre>&#160;</pre>
<p>&#160;</p>
<p>2. Bind two or more properties by adding a list of binding definitions</p>
<pre><span style="color:#0000ff;">&lt;</span><span style="color:#800000;">ComboBox</span><span style="color:#0000ff;">&gt;</span>
    <span style="color:#0000ff;">&lt;</span><span style="color:#c71585;">local</span>:<span style="color:#800000;">BindingHelper.Binding</span><span style="color:#0000ff;">&gt;</span>
        <span style="color:#0000ff;">&lt;</span><span style="color:#c71585;">local</span>:<span style="color:#800000;">BindingList</span><span style="color:#0000ff;">&gt;</span>
            <span style="color:#0000ff;">&lt;</span><span style="color:#c71585;">local</span>:<span style="color:#800000;">RelativeSourceBinding</span> <span style="color:#ff0000;">Path</span>=<span style="color:#0000ff;">&quot;DataContext.Picklist&quot;</span>
                    <span style="color:#ff0000;">TargetProperty</span>=<span style="color:#0000ff;">&quot;ItemsSource&quot;</span> <span style="color:#ff0000;">RelativeMode</span>=<span style="color:#0000ff;">&quot;FindAncestor&quot;</span>
                    <span style="color:#ff0000;">AncestorType</span>=<span style="color:#0000ff;">&quot;UserControl&quot;</span> <span style="color:#0000ff;">/&gt;</span>
            <span style="color:#0000ff;">&lt;</span><span style="color:#c71585;">local</span>:<span style="color:#800000;">RelativeSourceBinding</span> <span style="color:#ff0000;">Path</span>=<span style="color:#0000ff;">&quot;DataContext.Tooltip&quot;</span>
                    <span style="color:#ff0000;">TargetProperty</span>=<span style="color:#0000ff;">&quot;(ToolTipService.ToolTip)&quot;</span> <span style="color:#ff0000;">RelativeMode</span>=<span style="color:#0000ff;">&quot;FindAncestor&quot;</span>
                    <span style="color:#ff0000;">AncestorType</span>=<span style="color:#0000ff;">&quot;UserControl&quot;</span> <span style="color:#0000ff;">/&gt;</span>
        <span style="color:#0000ff;">&lt;/</span><span style="color:#c71585;">local</span>:<span style="color:#800000;">BindingList</span><span style="color:#0000ff;">&gt;</span>
    <span style="color:#0000ff;">&lt;/</span><span style="color:#c71585;">local</span>:<span style="color:#800000;">BindingHelper.Binding</span><span style="color:#0000ff;">&gt;</span>
<span style="color:#0000ff;">&lt;/</span><span style="color:#800000;">ComboBox</span><span style="color:#0000ff;">&gt;</span></pre>
<p>&#160;</p>
<p>&#160;</p>
<p>3. Bind any attached dependency property</p>
<pre><span style="color:#0000ff;">&lt;</span><span style="color:#c71585;">local</span>:<span style="color:#800000;">RelativeSourceBinding</span> <span style="color:#ff0000;">Path</span>=<span style="color:#0000ff;">&quot;DataContext.Tooltip&quot;</span>
        <span style="color:#ff0000;">TargetProperty</span>=<span style="color:#0000ff;">&quot;(ToolTipService.ToolTip)&quot;</span> <span style="color:#ff0000;">RelativeMode</span>=<span style="color:#0000ff;">&quot;FindAncestor&quot;</span>
        <span style="color:#ff0000;">AncestorType</span>=<span style="color:#0000ff;">&quot;UserControl&quot;</span> <span style="color:#0000ff;">/&gt;</span></pre>
<p>&#160;</p>
<p>&#160;</p>
<p>4. Bind an attached dependency property from any assembly. Just specify the XAML namespace as in the example below</p>
<pre><span style="color:#0000ff;">&lt;</span><span style="color:#c71585;">local</span>:<span style="color:#800000;">RelativeSourceBinding</span> <span style="color:#ff0000;">Path</span>=<span style="color:#0000ff;">&quot;DataContext.Tooltip&quot;</span>
        <span style="color:#ff0000;">TargetProperty</span>=<span style="color:#0000ff;">&quot;(DemoAttachedElement.Value)&quot;</span>
        <span style="color:#ff0000;">TargetNamespace</span>=<span style="color:#0000ff;">&quot;clr-namespace:RelativeSourceBindingDemo;assembly=RelativeSourceBindingDemo&quot;</span>
        <span style="color:#ff0000;">RelativeMode</span>=<span style="color:#0000ff;">&quot;FindAncestor&quot;</span> <span style="color:#ff0000;">AncestorType</span>=<span style="color:#0000ff;">&quot;UserControl&quot;</span> <span style="color:#0000ff;">/&gt;</span></pre>
<p>&#160;</p>
<p>&#160;</p>
<p>5. Use the parent data context instead an ancestor type</p>
<pre><span style="color:#0000ff;">&lt;</span><span style="color:#c71585;">local</span>:<span style="color:#800000;">RelativeSourceBinding</span> <span style="color:#ff0000;">Path</span>=<span style="color:#0000ff;">&quot;RemoveCommand&quot;</span> <span style="color:#ff0000;">TargetProperty</span>=<span style="color:#0000ff;">&quot;Command&quot;</span>
        <span style="color:#ff0000;">RelativeMode</span>=<span style="color:#0000ff;">&quot;ParentDataContext&quot;</span> <span style="color:#0000ff;">/&gt;</span></pre>
<p>&#160;</p>
<p>&#160;</p>
<p>6. The mode <em>ParentDataContext</em> is set as default behavior. So in most cases you can just write xaml as following: </p>
<pre><span style="color:#0000ff;">&lt;</span><span style="color:#800000;">Button</span> <span style="color:#ff0000;">Content</span>=<span style="color:#0000ff;">&quot;Remove&quot;</span> <span style="color:#ff0000;">CommandParameter</span>=<span style="color:#0000ff;">&quot;{Binding}&quot;</span><span style="color:#0000ff;">&gt;</span>
    <span style="color:#0000ff;">&lt;</span><span style="color:#c71585;">local</span>:<span style="color:#800000;">BindingHelper.Binding</span><span style="color:#0000ff;">&gt;</span>
        <span style="color:#0000ff;">&lt;</span><span style="color:#c71585;">local</span>:<span style="color:#800000;">RelativeSourceBinding</span> <span style="color:#ff0000;">Path</span>=<span style="color:#0000ff;">&quot;RemoveCommand&quot;</span> <span style="color:#ff0000;">TargetProperty</span>=<span style="color:#0000ff;">&quot;Command&quot;</span> <span style="color:#0000ff;">/&gt;</span>
    <span style="color:#0000ff;">&lt;/</span><span style="color:#c71585;">local</span>:<span style="color:#800000;">BindingHelper.Binding</span><span style="color:#0000ff;">&gt;</span>
<span style="color:#0000ff;">&lt;/</span><span style="color:#800000;">Button</span><span style="color:#0000ff;">&gt;</span>

<span style="color:#0000ff;">&lt;</span><span style="color:#800000;">ComboBox</span> <span style="color:#ff0000;">Grid</span>.<span style="color:#ff0000;">Column</span>=<span style="color:#0000ff;">&quot;1&quot;</span><span style="color:#0000ff;">&gt;</span>
    <span style="color:#0000ff;">&lt;</span><span style="color:#c71585;">local</span>:<span style="color:#800000;">BindingHelper.Binding</span><span style="color:#0000ff;">&gt;</span>
        <span style="color:#0000ff;">&lt;</span><span style="color:#c71585;">local</span>:<span style="color:#800000;">BindingList</span><span style="color:#0000ff;">&gt;</span>
            <span style="color:#0000ff;">&lt;</span><span style="color:#c71585;">local</span>:<span style="color:#800000;">RelativeSourceBinding</span> <span style="color:#ff0000;">Path</span>=<span style="color:#0000ff;">&quot;Picklist&quot;</span> <span style="color:#ff0000;">TargetProperty</span>=<span style="color:#0000ff;">&quot;ItemsSource&quot;</span><span style="color:#0000ff;">/&gt;</span>
            <span style="color:#0000ff;">&lt;</span><span style="color:#c71585;">local</span>:<span style="color:#800000;">RelativeSourceBinding</span> <span style="color:#ff0000;">Path</span>=<span style="color:#0000ff;">&quot;Tooltip&quot;</span> <span style="color:#ff0000;">TargetProperty</span>=<span style="color:#0000ff;">&quot;(ToolTipService.ToolTip)&quot;</span> <span style="color:#0000ff;">/&gt;</span>
        <span style="color:#0000ff;">&lt;/</span><span style="color:#c71585;">local</span>:<span style="color:#800000;">BindingList</span><span style="color:#0000ff;">&gt;</span>
    <span style="color:#0000ff;">&lt;/</span><span style="color:#c71585;">local</span>:<span style="color:#800000;">BindingHelper.Binding</span><span style="color:#0000ff;">&gt;</span>
<span style="color:#0000ff;">&lt;/</span><span style="color:#800000;">ComboBox</span><span style="color:#0000ff;">&gt;</span></pre>
<p>&#160;</p>
<p>&#160;</p>
<p>7. Use a converter and other binding settings</p>
<pre><span style="color:#0000ff;">&lt;</span><span style="color:#c71585;">local</span>:<span style="color:#800000;">RelativeSourceBinding</span> <span style="color:#ff0000;">Path</span>=<span style="color:#0000ff;">&quot;Application.IsEnabled&quot;</span>
        <span style="color:#ff0000;">TargetProperty</span>=<span style="color:#0000ff;">&quot;Visibility&quot;</span> <span style="color:#ff0000;">Converter</span>=<span style="color:#0000ff;">&quot;{StaticResource VisibilityConverter}&quot;</span>
        <span style="color:#ff0000;">ValidatesOnNotifyDataErrors</span>=<span style="color:#0000ff;">&quot;True&quot;</span> <span style="color:#ff0000;">ValidatesOnExceptions</span>=<span style="color:#0000ff;">&quot;True&quot;</span>
        <span style="color:#ff0000;">ValidatesOnDataErrors</span>=<span style="color:#0000ff;">&quot;True&quot;</span> <span style="color:#ff0000;">NotifyOnValidationError</span>=<span style="color:#0000ff;">&quot;True&quot;</span> <span style="color:#0000ff;">/&gt;</span></pre>
<p>&#160;</p>
<h2>Source Code &amp; Demo Project</h2>
<p><a href="http://files.thekieners.com/blogcontent/2010/RelativeSourceBinding.zip" target="_blank">Here you can find the full source code within a demo project.</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/bkiener.wordpress.com/502/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/bkiener.wordpress.com/502/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/bkiener.wordpress.com/502/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/bkiener.wordpress.com/502/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/bkiener.wordpress.com/502/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/bkiener.wordpress.com/502/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/bkiener.wordpress.com/502/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/bkiener.wordpress.com/502/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/bkiener.wordpress.com/502/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/bkiener.wordpress.com/502/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/bkiener.wordpress.com/502/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/bkiener.wordpress.com/502/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/bkiener.wordpress.com/502/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/bkiener.wordpress.com/502/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.thekieners.com&amp;blog=7436128&amp;post=502&amp;subd=bkiener&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.thekieners.com/2010/09/08/relativesource-binding-with-findancestor-mode-in-silverlight/feed/</wfw:commentRss>
		<slash:comments>33</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/bbdffd0b655e44e12898217ff1973ad3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">beatkiener</media:title>
		</media:content>

		<media:content url="http://bkiener.files.wordpress.com/2010/09/image_thumb.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://bkiener.files.wordpress.com/2010/09/image_thumb1.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://bkiener.files.wordpress.com/2010/09/clip_image001_thumb1.png" medium="image">
			<media:title type="html">clip_image001</media:title>
		</media:content>
	</item>
		<item>
		<title>Type.GetType implementation with help of XamlReader</title>
		<link>http://blog.thekieners.com/2010/09/06/type-gettype-implementation-with-help-of-xamlreader/</link>
		<comments>http://blog.thekieners.com/2010/09/06/type-gettype-implementation-with-help-of-xamlreader/#comments</comments>
		<pubDate>Mon, 06 Sep 2010 15:37:57 +0000</pubDate>
		<dc:creator>beatkiener</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Silverlight]]></category>

		<guid isPermaLink="false">https://bkiener.wordpress.com/2010/09/06/type-gettype-implementation-with-help-of-xamlreader/</guid>
		<description><![CDATA[The Type.GetType method is different in Silverlight than in the standard .NET runtime. In Silverlight we must provide the fully qualified assembly name to get a type from an assembly. Only built in controls such as Button, Grid, ListBox, etc. or types in the executing assembly are excluded from this rule. Fully qualified assembly name [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.thekieners.com&amp;blog=7436128&amp;post=495&amp;subd=bkiener&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The Type.GetType method is different in Silverlight than in the standard .NET runtime. In Silverlight we must provide the fully qualified assembly name to get a type from an assembly. Only built in controls such as Button, Grid, ListBox, etc. or types in the executing assembly are excluded from this rule. Fully qualified assembly name means you must provide the version, culture and public key token. That means that the following GetType usage works well, until the target assembly version changes from 1.0 to 1.1.</p>
<pre>Type.GetType(&quot;<span style="color:#8b0000;">MyComponent.MyType, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=4bec85d7bec6698f</span>&quot;)</pre>
<pre>&#160;</pre>
<p>And do we really want to have such Xaml or code behind files?</p>
<pre>&lt;local:MyCustomElement Grid.Row=&quot;<span style="color:#8b0000;">2</span>&quot; Grid.Column=&quot;<span style="color:#8b0000;">1</span>&quot;
   ItemType=&quot;<span style="color:#8b0000;">MyComponent.MyType, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=4bec85d7bec6698f</span>&quot; &gt;
&lt;/local:MyCustomElement&gt;</pre>
<p><font face="Courier New"></font></p>
<p>&#160;</p>
<h2>Iterate over Assembly Parts</h2>
<p>One option to load a type just by its type-name and assembly-name is to iterate over all loaded assemblies. The method <em>AppDomain.CurrentDomain.GetAssemblies()</em> does not exist in Silverlight, but we can iterate over all assembly parts that are included in the deployment, e.g. all assemblies that are in the XAP file. I’ve found a <a href="http://inquisitorjax.blogspot.com/2009/10/gettype-from-referenced-assembly-in.html" target="_blank">blog post from Malcolm Jack</a> in which he describes how to iterate over the parts to find a type by its name.</p>
<p>An this is how it works in brief: loop through each assembly part, getting the assembly, then use assembly.GetType to load the type.</p>
<p>This is the code this short explanation:</p>
<pre><span style="color:#0000ff;">public</span> <span style="color:#0000ff;">static</span> Type GetAssemblyType(<span style="color:#0000ff;">string</span> assemblyName, <span style="color:#0000ff;">string</span> className)
{
    StreamResourceInfo info = Application.GetResourceStream(<span style="color:#0000ff;">new</span> Uri(assemblyName, UriKind.Relative));
    Assembly assembly = <span style="color:#0000ff;">new</span> AssemblyPart().Load(info.Stream);
    Type type = assembly.GetType(className);
    <span style="color:#0000ff;">return</span> type;
}

<span style="color:#0000ff;">public</span> <span style="color:#0000ff;">static</span> Type GetAssemblyType(<span style="color:#0000ff;">string</span> className)
{
    Type type = <span style="color:#0000ff;">null</span>;
    <span style="color:#0000ff;">foreach</span> (AssemblyPart part <span style="color:#0000ff;">in</span> Deployment.Current.Parts)
    {
        type = GetAssemblyType(part.Source, className);
        <span style="color:#0000ff;">if</span> (type != <span style="color:#0000ff;">null</span>)
            <span style="color:#0000ff;">break</span>;
    }
    <span style="color:#0000ff;">return</span> type;
}</pre>
<p>&#160;</p>
<p>Unfortunately this solution has two drawbacks: </p>
<p>1. Dynamic loaded assemblies downloaded with help of a web client instance are not part of the deployment, e.g. the code cannot find types in those assemblies. You can add an additional part to the collection after each downloaded dll, but you do not have a guarantee this will be done.</p>
<pre>AssemblyPart part = <span style="color:#0000ff;">new</span> AssemblyPart();
Assembly assm = part.Load(e.Result);
Deployment.Current.Parts.Add(part);</pre>
<p>&#160;</p>
<p>2. The second issue is when using application library caching to reduce the XAP size. </p>
<p><a href="http://bkiener.files.wordpress.com/2010/09/clip_image001.png"><img style="display:inline;border-width:0;" title="clip_image001" border="0" alt="clip_image001" src="http://bkiener.files.wordpress.com/2010/09/clip_image001_thumb.png?w=305&#038;h=30" width="305" height="30" /></a> </p>
<p>If this option is enabled, it will change the application manifest and the XAP no longer includes those assemblies which do support assembly caching. See <a href="http://timheuer.com/blog/archive/2009/07/13/silverlight-3-cached-assembly-feature.aspx">Tim Heuer’s posts</a> to get more detail how it works. </p>
<p>The cached assemblies are now declared as external parts as you can see in the manifest file (AppManifest.xml):</p>
<pre>&lt;Deployment ... &gt;
  &lt;Deployment.Parts&gt;
     ...
  &lt;/Deployment.Parts&gt;
  &lt;Deployment.ExternalParts&gt;
    &lt;ExtensionPart Source=&quot;<span style="color:#8b0000;">System.Windows.Controls.Input.Toolkit.zip</span>&quot; /&gt;
    &lt;ExtensionPart Source=&quot;<span style="color:#8b0000;">System.Xml.Linq.zip</span>&quot; /&gt;
    &lt;ExtensionPart Source=&quot;<span style="color:#8b0000;">System.Windows.Controls.zip</span>&quot; /&gt;
    &lt;ExtensionPart Source=&quot;<span style="color:#8b0000;">System.Windows.Controls.Toolkit.zip</span>&quot; /&gt;
  &lt;/Deployment.ExternalParts&gt;
&lt;/Deployment&gt;</pre>
<p>&#160;</p>
<p>In the end when the application starts those external assemblies will still be downloaded before the main form is added to the visual tree.</p>
<p><a href="http://bkiener.files.wordpress.com/2010/09/clip_image002.png"><img style="display:inline;border-width:0;" title="clip_image002" border="0" alt="clip_image002" src="http://bkiener.files.wordpress.com/2010/09/clip_image002_thumb.png?w=572&#038;h=154" width="572" height="154" /></a> </p>
<p>Iterating over all external parts is not that easy as iterating over all assembly parts, because it needs to download the source again and this is an asynchron operation. </p>
<p>&#160; </p>
<h2>The Solution: Using the XamlReader</h2>
<p>I’ve found a solution by using the XamlReader to resolve types during parsing a xaml string. Unfortunately there is no StringToTypeConverter in Silverlight and the Xaml parser uses some hard coded logic to resolve System.Type properties only for certain type like Style and ControlTemplate. However, we can use a Style or ControlTemplate class and use the TargetType property to retrieve the type information. And these lines of code show how it works:</p>
<pre><span style="color:#008000;">// create xaml with a simply Style element and set the TargetType property with the provided type name</span>
<span style="color:#0000ff;">string</span> xaml = &quot;<span style="color:#8b0000;">&lt;Style xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation' </span>&quot;;

<span style="color:#008000;">// set the xaml namesapce if provided</span>
<span style="color:#0000ff;">if</span> (!<span style="color:#0000ff;">string</span>.IsNullOrWhiteSpace(xamlNamespace))
{
    xaml += <span style="color:#0000ff;">string</span>.Format(&quot;<span style="color:#8b0000;">xmlns:tmp='{0}' TargetType='tmp:{1}' /&gt;</span>&quot;, xamlNamespace, className);
}
<span style="color:#0000ff;">else</span>
{
    <span style="color:#008000;">// Core controls such as Button, Grid, ListBox, etc do not need a namespace</span>
    xaml += <span style="color:#0000ff;">string</span>.Format(&quot;<span style="color:#8b0000;">TargetType='{0}' /&gt;</span>&quot;, className);
}

<span style="color:#008000;">// let the XamlParser load the type via the TargetType property </span>
Style style = XamlReader.Load(xaml) <span style="color:#0000ff;">as</span> Style;

<span style="color:#0000ff;">if</span> (style != <span style="color:#0000ff;">null</span>)
{
    Type targetType = style.TargetType;
    <span style="color:#0000ff;">return</span> targetType;
}</pre>
<p>&#160;</p>
<p>Xaml parsing is not the fastest way to get a type. Therefore I encapsulated the functionality into a small class which maintains a cache for types which are already parsed. </p>
<p>The class provides four different ways to get a type:</p>
<pre><span style="color:#008000;">// for types in the executing assembly or types in the core-control </span>
<span style="color:#008000;">// assembly such as Button, Grid, etc. Just provide the type name.</span>
TypeLoader.GetType(&quot;<span style="color:#8b0000;">Grid</span>&quot;); 

<span style="color:#008000;">// The type name with its xaml namespace</span>
TypeLoader.GetType(&quot;<span style="color:#8b0000;">Grid</span>&quot;, &quot;<span style="color:#8b0000;">clr-namespace:System.Windows.Controls;assembly=System.Windows</span>&quot;);

<span style="color:#008000;">// Type name, namespace and assembly name as separate parameters</span>
TypeLoader.GetType(&quot;<span style="color:#8b0000;">Grid</span>&quot;, &quot;<span style="color:#8b0000;">System.Windows.Controls</span>&quot;, &quot;<span style="color:#8b0000;">System.Windows</span>&quot;);

<span style="color:#008000;">// Or with the assembly qualified type name, without version, culture and public key token</span>
TypeLoader.GetType(&quot;<span style="color:#8b0000;">System.Windows.Controls.Grid, System.Windows</span>&quot;);</pre>
<p>&#160; </p>
<p>Here are some other examples:</p>
<pre><span style="color:#008000;">// *** toolkit controls ***</span>
<span style="color:#008000;">// returns null, because NumericUpDown is in toolkit and not in core control assembly</span>
<span style="color:#008000;">//TypeLoader.GetType(&quot;NumericUpDown&quot;); </span>
TypeLoader.GetType(&quot;<span style="color:#8b0000;">NumericUpDown</span>&quot;,
               &quot;<span style="color:#8b0000;">clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input.Toolkit</span>&quot;);
TypeLoader.GetType(&quot;<span style="color:#8b0000;">NumericUpDown</span>&quot;,
               &quot;<span style="color:#8b0000;">System.Windows.Controls</span>&quot;, &quot;<span style="color:#8b0000;">System.Windows.Controls.Input.Toolkit</span>&quot;);
TypeLoader.GetType(&quot;<span style="color:#8b0000;">System.Windows.Controls.NumericUpDown, System.Windows.Controls.Input.Toolkit</span>&quot;);

<span style="color:#008000;">// *** main application ***</span>
<span style="color:#008000;">// returns null, because MainPage is not in core-control assembly</span>
<span style="color:#008000;">//Type mainPage1 = TypeLoader.GetType(&quot;MainPage&quot;); </span>
TypeLoader.GetType(&quot;<span style="color:#8b0000;">MainPage</span>&quot;, &quot;<span style="color:#8b0000;">clr-namespace:TypeLoaderDemo;assembly=TypeLoaderDemo</span>&quot;);
TypeLoader.GetType(&quot;<span style="color:#8b0000;">MainPage</span>&quot;, &quot;<span style="color:#8b0000;">TypeLoaderDemo</span>&quot;, &quot;<span style="color:#8b0000;">TypeLoaderDemo</span>&quot;);
TypeLoader.GetType(&quot;<span style="color:#8b0000;">TypeLoaderDemo.MainPage, TypeLoaderDemo</span>&quot;);

<span style="color:#008000;">// *** 3rd party libs ***</span>
TypeLoader.GetType(&quot;<span style="color:#8b0000;">MyButton</span>&quot;, &quot;<span style="color:#8b0000;">clr-namespace:TypeLoaderControlLib;assembly=TypeLoaderControlLib</span>&quot;);
TypeLoader.GetType(&quot;<span style="color:#8b0000;">MyButton</span>&quot;, &quot;<span style="color:#8b0000;">TypeLoaderControlLib</span>&quot;, &quot;<span style="color:#8b0000;">TypeLoaderControlLib</span>&quot;);
TypeLoader.GetType(&quot;<span style="color:#8b0000;">TypeLoaderControlLib.MyButton,TypeLoaderControlLib</span>&quot;);</pre>
<pre>&#160;</pre>
<h2>Demo Project and Source Code</h2>
<pre><font face="Verdana"></font>&#160;</pre>
<p>Here you can find the <a href="http://files.thekieners.com/blogcontent/2010/TypeLoader.cs.txt" target="_blank">TypeLoader implementation</a> or a <a href="http://files.thekieners.com/blogcontent/2010/TypeLoaderDemo.zip" target="_blank">full demo project</a> including TypeLoader source, examples, assembly parts iteration and dynamic assembly loading.</p>
<pre>&#160;</pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/bkiener.wordpress.com/495/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/bkiener.wordpress.com/495/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/bkiener.wordpress.com/495/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/bkiener.wordpress.com/495/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/bkiener.wordpress.com/495/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/bkiener.wordpress.com/495/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/bkiener.wordpress.com/495/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/bkiener.wordpress.com/495/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/bkiener.wordpress.com/495/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/bkiener.wordpress.com/495/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/bkiener.wordpress.com/495/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/bkiener.wordpress.com/495/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/bkiener.wordpress.com/495/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/bkiener.wordpress.com/495/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.thekieners.com&amp;blog=7436128&amp;post=495&amp;subd=bkiener&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.thekieners.com/2010/09/06/type-gettype-implementation-with-help-of-xamlreader/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/bbdffd0b655e44e12898217ff1973ad3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">beatkiener</media:title>
		</media:content>

		<media:content url="http://bkiener.files.wordpress.com/2010/09/clip_image001_thumb.png" medium="image">
			<media:title type="html">clip_image001</media:title>
		</media:content>

		<media:content url="http://bkiener.files.wordpress.com/2010/09/clip_image002_thumb.png" medium="image">
			<media:title type="html">clip_image002</media:title>
		</media:content>
	</item>
		<item>
		<title>Listening to DependencyProperty changes in Silverlight</title>
		<link>http://blog.thekieners.com/2010/08/27/listening-to-dependencyproperty-changes-in-silverlight/</link>
		<comments>http://blog.thekieners.com/2010/08/27/listening-to-dependencyproperty-changes-in-silverlight/#comments</comments>
		<pubDate>Fri, 27 Aug 2010 14:20:59 +0000</pubDate>
		<dc:creator>beatkiener</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Silverlight]]></category>

		<guid isPermaLink="false">https://bkiener.wordpress.com/2010/08/27/listening-to-dependencyproperty-changes-in-silverlight/</guid>
		<description><![CDATA[The dependency property system is a pretty nice concept. Receiving notifications for dependency property changes on an existing object is a very common scenario in order to update my view model or the UI. This is quite easy in WPF: // get the property descriptor DependencyPropertyDescriptor prop = DependencyPropertyDescriptor.FromProperty(TextBox.TextProperty, myTextBox.GetType()); // add change handler prop.AddValueChanged(myTextBox, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.thekieners.com&amp;blog=7436128&amp;post=486&amp;subd=bkiener&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The dependency property system is a pretty nice concept. Receiving notifications for dependency property changes on an existing object is a very common scenario in order to update my view model or the UI.</p>
<p>This is quite easy in WPF:</p>
<pre><span style="color:#008000;">// get the property descriptor</span>
DependencyPropertyDescriptor prop =
         DependencyPropertyDescriptor.FromProperty(TextBox.TextProperty, myTextBox.GetType());
<span style="color:#008000;">// add change handler</span>
prop.AddValueChanged(myTextBox, (sender, args) =&gt;
{

});</pre>
<p>Unfortunately Silverlight has a limited set of meta-data functionality around the dependency property system, because the <em>DependencyPropertyDescriptor</em> does exist in Silverlight.</p>
<p>In order to get a workaround I found a solution in which I get notified with help of the binding system. I simple use a relay object which value property is bound to the source property I want to get notified. The relay object contains a public event which raises when the value changes.</p>
<p><a href="http://bkiener.files.wordpress.com/2010/08/image2.png"><img style="border-bottom:0;border-left:0;display:inline;border-top:0;border-right:0;" title="image" border="0" alt="image" src="http://bkiener.files.wordpress.com/2010/08/image_thumb2.png?w=718&#038;h=254" width="718" height="254" /></a> </p>
<p>&#160;</p>
<p>I’ve put the implementation details into a <em>DependencyPropertyChangedListener </em>class to make it as simple as possible and similar to WPF. The lines below show how simple it is to create the listener and attaching the event.</p>
<pre><span style="color:#0000ff;">private</span> DependencyPropertyChangedListener listener;

<span style="color:#0000ff;">public</span> MainPage()
{
    InitializeComponent();

    listener = DependencyPropertyChangedListener.Create(<span style="color:#0000ff;">this</span>.myTextBox, &quot;<span style="color:#8b0000;">Text</span>&quot;);
    listener.ValueChanged += listener_ValueChanged;
}

<span style="color:#0000ff;">void</span> listener_ValueChanged(<span style="color:#0000ff;">object</span> sender, DependencyPropertyValueChangedEventArgs e)
{
    Debug.WriteLine(e.OldValue + &quot;<span style="color:#8b0000;"> </span>&quot; + e.NewValue);
}

<span style="color:#0000ff;">private</span> <span style="color:#0000ff;">void</span> btnSetValue_Click(<span style="color:#0000ff;">object</span> sender, RoutedEventArgs e)
{
    <span style="color:#0000ff;">this</span>.myTextBox.Text = DateTime.Now.Ticks.ToString();
}</pre>
</p>
<p>The listener provides the method Detach to release the binding.</p>
<pre>listener.Detach();</pre>
<h2>&#160;</h2>
<h2>Known Limitations</h2>
<p>It is not possible to listen for dependency property values which are inherited like the FontSize, DataContext and FontFamily properties so far.</p>
<p>&#160;</p>
<h2>Source code</h2>
<p><a href="http://bkiener.files.wordpress.com/2010/08/image4.png"><img style="border-bottom:0;border-left:0;display:inline;margin-left:0;border-top:0;margin-right:0;border-right:0;" title="image" border="0" alt="image" src="http://bkiener.files.wordpress.com/2010/08/image_thumb4.png?w=61&#038;h=64" width="61" height="64" /></a> </p>
<p><a href="http://files.thekieners.com/blogcontent/2010/DependencyPropertyChangeListener.zip" target="_blank">Here you can find a demo project with full source code.</a></p>
</p>
<p>&#160;</p>
<p><font color="#ffffff" size="1">Keywords: Registering to a Dependency Property Change Event Property OverrideMetadata PropertyDescriptor prop TypeDescriptor GetProperties Receive notifications for dependency properties</font></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/bkiener.wordpress.com/486/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/bkiener.wordpress.com/486/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/bkiener.wordpress.com/486/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/bkiener.wordpress.com/486/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/bkiener.wordpress.com/486/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/bkiener.wordpress.com/486/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/bkiener.wordpress.com/486/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/bkiener.wordpress.com/486/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/bkiener.wordpress.com/486/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/bkiener.wordpress.com/486/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/bkiener.wordpress.com/486/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/bkiener.wordpress.com/486/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/bkiener.wordpress.com/486/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/bkiener.wordpress.com/486/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.thekieners.com&amp;blog=7436128&amp;post=486&amp;subd=bkiener&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.thekieners.com/2010/08/27/listening-to-dependencyproperty-changes-in-silverlight/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/bbdffd0b655e44e12898217ff1973ad3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">beatkiener</media:title>
		</media:content>

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

		<media:content url="http://bkiener.files.wordpress.com/2010/08/image_thumb4.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
	</channel>
</rss>
