<?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>Ratish Philip&#039;s WPF Blog</title>
	<atom:link href="http://wpfspark.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://wpfspark.wordpress.com</link>
	<description>Just another WordPress.com weblog</description>
	<lastBuildDate>Mon, 23 Jan 2012 15:19:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='wpfspark.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Ratish Philip&#039;s WPF Blog</title>
		<link>http://wpfspark.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://wpfspark.wordpress.com/osd.xml" title="Ratish Philip&#039;s WPF Blog" />
	<atom:link rel='hub' href='http://wpfspark.wordpress.com/?pushpress=hub'/>
		<item>
		<title>WPFSpark v1.1 released!</title>
		<link>http://wpfspark.wordpress.com/2012/01/19/wpfspark-v1-1-released/</link>
		<comments>http://wpfspark.wordpress.com/2012/01/19/wpfspark-v1-1-released/#comments</comments>
		<pubDate>Thu, 19 Jan 2012 18:11:31 +0000</pubDate>
		<dc:creator>Ratish Philip</dc:creator>
				<category><![CDATA[WPF]]></category>
		<category><![CDATA[WPFSpark]]></category>

		<guid isPermaLink="false">http://wpfspark.wordpress.com/?p=197</guid>
		<description><![CDATA[WPFSpark v1.1 is now released! WPFSpark v1.1 brings a major revamp of the FluidWrapPanel control. The core logic of FluidWrapPanel class has been rewritten from scratch to make it more robust and usable in various scenarios, resulting in a faster, optimized code. These changes are breaking changes, meaning if you are using the latest WPFSpark library (v1.1) then your old code using the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wpfspark.wordpress.com&amp;blog=8309914&amp;post=197&amp;subd=wpfspark&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>WPFSpark v1.1 is now released!</strong></p>
<p><strong></strong><strong>WPFSpark v1.1</strong> brings a major revamp of the <strong>FluidWrapPanel</strong> control.</p>
<p><a href="http://wpfspark.files.wordpress.com/2012/01/fluidwrappaneldemo.png"><img class="alignnone size-full wp-image-198" title="FluidWrapPanelDemo" src="http://wpfspark.files.wordpress.com/2012/01/fluidwrappaneldemo.png?w=630" alt=""   /></a><br />
The core logic of <strong>FluidWrapPanel</strong> class has been rewritten from scratch to make it more robust and usable in various scenarios, resulting in a faster, optimized code.<br />
These changes are <em>breaking changes</em>, meaning if you are using the latest <strong>WPFSpark</strong> library (<strong>v1.1</strong>) then your old code using the old <strong>FluidWrapPanel</strong> will not compile unless you update it. The interface <strong>IFluidDrag</strong> has been removed. Child elements no longer need to implement the <strong>IFluidDrag</strong> interface to participate in the drag and drop interaction. Instead I have added a new Behavior called <strong>FluidMouseDragBehavior</strong> which would facilitate the child element with drag and drop interaction. Child elements must add this behavior to participate in drag and drop.</p>
<p>Get the latest WPFSpark source code <a title="WPFSpark v1.1" href="http://wpfspark.codeplex.com" target="_blank">here</a>.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/wpfspark.wordpress.com/197/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/wpfspark.wordpress.com/197/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/wpfspark.wordpress.com/197/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/wpfspark.wordpress.com/197/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/wpfspark.wordpress.com/197/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/wpfspark.wordpress.com/197/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/wpfspark.wordpress.com/197/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/wpfspark.wordpress.com/197/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/wpfspark.wordpress.com/197/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/wpfspark.wordpress.com/197/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/wpfspark.wordpress.com/197/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/wpfspark.wordpress.com/197/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/wpfspark.wordpress.com/197/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/wpfspark.wordpress.com/197/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wpfspark.wordpress.com&amp;blog=8309914&amp;post=197&amp;subd=wpfspark&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://wpfspark.wordpress.com/2012/01/19/wpfspark-v1-1-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/78cc63232601b5906038e418391e51bc?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ratishphilip</media:title>
		</media:content>

		<media:content url="http://wpfspark.files.wordpress.com/2012/01/fluidwrappaneldemo.png" medium="image">
			<media:title type="html">FluidWrapPanelDemo</media:title>
		</media:content>
	</item>
		<item>
		<title>Windows 8 First Apps Contest: You are a Finalist!</title>
		<link>http://wpfspark.wordpress.com/2012/01/18/windows-8-first-apps-contest-you-are-a-finalist/</link>
		<comments>http://wpfspark.wordpress.com/2012/01/18/windows-8-first-apps-contest-you-are-a-finalist/#comments</comments>
		<pubDate>Wed, 18 Jan 2012 06:34:49 +0000</pubDate>
		<dc:creator>Ratish Philip</dc:creator>
				<category><![CDATA[Windows 8]]></category>

		<guid isPermaLink="false">http://wpfspark.wordpress.com/?p=191</guid>
		<description><![CDATA[When Microsoft announced Windows 8 in September 2011 during the Build conference, I was very excited about the incorporation of Metro UI in the OS. &#8220;Fast and Fluid&#8220;, truly defined the first impression of Windows 8. I downloaded the Developer Preview and installed it on a virtual machine using VirtualBox. Though I did not succeed [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wpfspark.wordpress.com&amp;blog=8309914&amp;post=191&amp;subd=wpfspark&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>When Microsoft announced <strong>Windows 8</strong> in September 2011 during the <strong>Build</strong> conference, I was very excited about the incorporation of Metro UI in the OS. <strong>&#8220;<em>Fast and Fluid</em>&#8220;</strong>, truly defined the first impression of Windows 8. I downloaded the Developer Preview and installed it on a virtual machine using VirtualBox. Though I did not succeed in installing it for the first time, I was successful the second time (after numerous searches on the web regarding this topic)! On the virtual machine, to be frank, the experience was not so awesome, but ok. The animations were a bit sluggish.</p>
<p>After installing, I played around with the OS for a few days. I created a few sample apps just to get a hang of metro apps. I was eager to create a major Metro App but was lacking the motivation (yeah, I can be lazy sometimes&#8230; <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  ).</p>
<p>Then in December, Microsoft announced the Windows 8 First Apps Contest! The thought of having an app of my own as a part of Windows 8 was very appealing. Besides, it gave me the required motivation to delve into Windows 8 programming.</p>
<p>I had created an app called <strong>FlipSaw</strong>, which is an innovative version of the jigsaw game, in WPF. I was planning to port it to WP7 so that I could release it at the MarketPlace. As the time was short, I decided to port the app to Windows 8 first. The only problem was I had minimal knowledge about Windows 8 programming and I had only 1 week before the deadline of January 8th.</p>
<p>Since the platform is a developer preview, I had a tough time porting the code and getting it to work. I learnt a lot of new things in Windows 8 thanks to the developer community forums. I was able to get the code working only 4 hours before the deadline and couldn&#8217;t polish the app much!. Finally I submitted the app with only 15 mins to spare.</p>
<p>Then it was a week long wait. The Build Contest site mentioned that the finalists will be notified via email by Jan 15. But there was no update till Jan 15th 12:59 pm PST (Jan 16th 1.30pm Indian Time). So I thought I didn&#8217;t make it. In the evening, the site posted a message that the finalists have been selected and the mails have been sent. I checked my mail again but still my inbox showed zero new mails <img src='http://s0.wp.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> . With a heavy heart, I resolved to update my app anyway when the Beta came out and post it in Windows Store when it opened.</p>
<p>The next day morning, as I was checking my mails, I found a new mail waiting for me in the inbox.</p>
<p>To my utter joy, the subject read &#8211; <strong>First Apps Contest: You are a Finalist!</strong></p>
<p>Well, I have two more weeks before the deadline of Round 2 (Feb 3rd). This round will be way tougher than the previous round. Time to smoothen the rough edges of my app.</p>
<p><strong><em>Let&#8217;s FlipSaw!!! </em></strong> <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/wpfspark.wordpress.com/191/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/wpfspark.wordpress.com/191/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/wpfspark.wordpress.com/191/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/wpfspark.wordpress.com/191/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/wpfspark.wordpress.com/191/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/wpfspark.wordpress.com/191/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/wpfspark.wordpress.com/191/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/wpfspark.wordpress.com/191/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/wpfspark.wordpress.com/191/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/wpfspark.wordpress.com/191/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/wpfspark.wordpress.com/191/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/wpfspark.wordpress.com/191/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/wpfspark.wordpress.com/191/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/wpfspark.wordpress.com/191/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wpfspark.wordpress.com&amp;blog=8309914&amp;post=191&amp;subd=wpfspark&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://wpfspark.wordpress.com/2012/01/18/windows-8-first-apps-contest-you-are-a-finalist/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/78cc63232601b5906038e418391e51bc?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ratishphilip</media:title>
		</media:content>
	</item>
		<item>
		<title>WPFSpark v1.0 released</title>
		<link>http://wpfspark.wordpress.com/2012/01/12/wpfspark-v1-0-released/</link>
		<comments>http://wpfspark.wordpress.com/2012/01/12/wpfspark-v1-0-released/#comments</comments>
		<pubDate>Thu, 12 Jan 2012 08:35:29 +0000</pubDate>
		<dc:creator>Ratish Philip</dc:creator>
				<category><![CDATA[WPF]]></category>
		<category><![CDATA[WPFSpark]]></category>

		<guid isPermaLink="false">http://wpfspark.wordpress.com/?p=180</guid>
		<description><![CDATA[Ok, I admit, this post should have been released a few weeks ago, but last few weeks had been pretty hectic and I was unable to post about my pet project WPFSpark which reached the v1.0 milestone last month. Yes, WPFSpark  v1.0  is now released ! I have revamped the CodePlex page to give it a new [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wpfspark.wordpress.com&amp;blog=8309914&amp;post=180&amp;subd=wpfspark&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Ok, I admit, this post should have been released a few weeks ago, but last few weeks had been pretty hectic and I was unable to post about my pet project <strong>WPFSpark</strong> which reached the <strong>v1.0 milestone</strong> last month. Yes, <strong>WPFSpark  v1.0 </strong> is now released !</p>
<p><a href="http://wpfspark.files.wordpress.com/2012/01/wpfspark.png"><img class="alignnone size-full wp-image-185" title="WPFSpark" src="http://wpfspark.files.wordpress.com/2012/01/wpfspark.png?w=630" alt=""   /></a></p>
<p>I have revamped the CodePlex page to give it a new look. You can access it <a title="WPFSpark CodePlex site" href="http://wpfspark.codeplex.com/" target="_blank">here</a>.</p>
<p>This release adds <strong>four</strong> new controls - <strong>SparkWindow</strong>, <strong>FluidPivotPanel</strong>, <strong>FluidProgressBar</strong> and<strong>FluidStatusBar</strong>.</p>
<p>It also brings the following improvements to the existing three controls:</p>
<ul>
<li><strong>SprocketControl</strong>
<ul>
<li>Internal timer stopped when control is no longer visible. It is started only when the control is Visible. This reduces CPU load.</li>
<li>Added the LowestAlpha dependency property which indicates the lowest Opacity value that must be used while rendering the SprocketControl&#8217;s spokes.</li>
<li>Added the AlphaTicksPercentage dependency property which indicates the percentage of total ticks which must be considered for step by step reduction of the alpha value. The remaining ticks remain at the LowestAlpha value.</li>
<li>SprocketControl now implements IDisposable.</li>
</ul>
</li>
<li><strong>ToggleSwitch</strong>
<ul>
<li>Added the IsCheckedLeft dependency property which indicates whether the checked content appears in the left or right side of the ToggleSwitch</li>
<li>Added the CheckedToolTip property which is displayed when the ToggleSwitch is in the Checked state. Set this property to String.Empty( &#8220;&#8221; ) to prevent this tooltip from displaying.</li>
<li>Added the UncheckedToolTip property which is displayed when the ToggleSwitch is in the Unchecked state. Set this property to String.Empty( &#8220;&#8221; ) to prevent this tooltip from displaying.</li>
</ul>
</li>
<li><strong>FluidWrapPanel</strong>
<ul>
<li>Added the ItemSource dependency property which can be bound to an ObservableCollection&lt;UIElement&gt;.</li>
</ul>
</li>
</ul>
<p>Also, I have published articles on CodeProject detailing about the newly added controls . Do check them out. The links are available at the CodePlex site.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/wpfspark.wordpress.com/180/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/wpfspark.wordpress.com/180/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/wpfspark.wordpress.com/180/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/wpfspark.wordpress.com/180/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/wpfspark.wordpress.com/180/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/wpfspark.wordpress.com/180/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/wpfspark.wordpress.com/180/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/wpfspark.wordpress.com/180/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/wpfspark.wordpress.com/180/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/wpfspark.wordpress.com/180/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/wpfspark.wordpress.com/180/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/wpfspark.wordpress.com/180/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/wpfspark.wordpress.com/180/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/wpfspark.wordpress.com/180/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wpfspark.wordpress.com&amp;blog=8309914&amp;post=180&amp;subd=wpfspark&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://wpfspark.wordpress.com/2012/01/12/wpfspark-v1-0-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/78cc63232601b5906038e418391e51bc?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ratishphilip</media:title>
		</media:content>

		<media:content url="http://wpfspark.files.wordpress.com/2012/01/wpfspark.png" medium="image">
			<media:title type="html">WPFSpark</media:title>
		</media:content>
	</item>
		<item>
		<title>HTC Titan &#8211; The latest Windows Phone 7.5 beast!</title>
		<link>http://wpfspark.wordpress.com/2011/09/02/htc-titan-the-latest-windows-phone-7-5-beast/</link>
		<comments>http://wpfspark.wordpress.com/2011/09/02/htc-titan-the-latest-windows-phone-7-5-beast/#comments</comments>
		<pubDate>Fri, 02 Sep 2011 17:28:26 +0000</pubDate>
		<dc:creator>Ratish Philip</dc:creator>
				<category><![CDATA[WP7]]></category>

		<guid isPermaLink="false">http://wpfspark.wordpress.com/?p=165</guid>
		<description><![CDATA[HTC just released their biggest Windows Phone 7.5 smartphone &#8211; the HTC Titan! From the first look, it seemed pretty impressive &#8211; the large 4.7 inch Super LCD screen, the fluid and elegant Windows Phone 7.5 OS, the 8MP camera with dual flash. But a much deeper look into the hardware left me disappointed. Here [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wpfspark.wordpress.com&amp;blog=8309914&amp;post=165&amp;subd=wpfspark&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>HTC</strong> just released their biggest <strong>Windows Phone 7.5</strong> smartphone &#8211; the <a href="http://www.htc.com/www/smartphones/htc-titan/" target="_blank"><strong>HTC Titan</strong></a>! From the first look, it seemed pretty impressive &#8211; the large 4.7 inch Super LCD screen, the fluid and elegant Windows Phone 7.5 OS, the 8MP camera with dual flash.<br />
But a much deeper look into the hardware left me disappointed. Here are a few features I would have liked Titan to have to make it a sure winner in the long run-</p>
<ul>
<li><strong>Higher resolution</strong> &#8211; Having <strong>800&#215;480</strong> on a 4.7&#8243; screen is like watching a 720p movie on an HDTV. A <strong>1280&#215;720</strong> resolution would have been an absolute killer feature.</li>
<li><strong>More RAM</strong> &#8211; Its time we moved from 512MB memory for smartphones to at least 1GB. With multitasking a standard feature in almost all the smartphone OSes, an increased memory would indeed be a blessing.</li>
<li><strong>Front facing camera</strong> &#8211; I expect it to be at least 2-3 MP for a better experience during video calls.</li>
<li><strong>Extensibility</strong> &#8211; the Titan offers no scope of extensibility. An SD slot would have indeed been great.</li>
</ul>
<p>Apart from all the above points, a major put off would be the price. If HTC can deliver a smartphone with great features at a killer price, it would be a surefire winner!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/wpfspark.wordpress.com/165/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/wpfspark.wordpress.com/165/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/wpfspark.wordpress.com/165/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/wpfspark.wordpress.com/165/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/wpfspark.wordpress.com/165/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/wpfspark.wordpress.com/165/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/wpfspark.wordpress.com/165/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/wpfspark.wordpress.com/165/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/wpfspark.wordpress.com/165/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/wpfspark.wordpress.com/165/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/wpfspark.wordpress.com/165/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/wpfspark.wordpress.com/165/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/wpfspark.wordpress.com/165/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/wpfspark.wordpress.com/165/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wpfspark.wordpress.com&amp;blog=8309914&amp;post=165&amp;subd=wpfspark&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://wpfspark.wordpress.com/2011/09/02/htc-titan-the-latest-windows-phone-7-5-beast/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/78cc63232601b5906038e418391e51bc?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ratishphilip</media:title>
		</media:content>
	</item>
		<item>
		<title>WPFSpark : 3 of n : FluidWrapPanel</title>
		<link>http://wpfspark.wordpress.com/2011/08/23/wpfspark-3-of-n-fluidwrappanel/</link>
		<comments>http://wpfspark.wordpress.com/2011/08/23/wpfspark-3-of-n-fluidwrappanel/#comments</comments>
		<pubDate>Tue, 23 Aug 2011 02:11:29 +0000</pubDate>
		<dc:creator>Ratish Philip</dc:creator>
				<category><![CDATA[WPF]]></category>
		<category><![CDATA[WPFSpark]]></category>

		<guid isPermaLink="false">http://wpfspark.wordpress.com/?p=158</guid>
		<description><![CDATA[My third article in the WPFSpark series has been published at the CodeProject site. You can view the article here. WPFSpark is now available at the NuGet gallery. Get the WPFSpark Nuget package.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wpfspark.wordpress.com&amp;blog=8309914&amp;post=158&amp;subd=wpfspark&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>My third article in the <strong>WPFSpark</strong> series has been published at the CodeProject site.</p>
<p><a href="http://wpfspark.files.wordpress.com/2011/08/fluidwrappanel.png"><img class="alignnone size-full wp-image-159" title="FluidWrapPanel" src="http://wpfspark.files.wordpress.com/2011/08/fluidwrappanel.png?w=630&#038;h=147" alt="" width="630" height="147" /></a></p>
<p>You can view the article <a title="FluidWrapPanel" href="http://www.codeproject.com/KB/WPF/WPFSpark_FluidWrapPanel.aspx" target="_blank">here</a>.</p>
<p><strong>WPFSpark</strong> is now available at the <strong>NuGet</strong> gallery. <a title="WPFSpark at NuGet gallery." href="http://nuget.org/List/Packages/WPFSpark" target="_blank">Get the <strong>WPFSpark</strong> Nuget package</a>.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/wpfspark.wordpress.com/158/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/wpfspark.wordpress.com/158/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/wpfspark.wordpress.com/158/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/wpfspark.wordpress.com/158/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/wpfspark.wordpress.com/158/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/wpfspark.wordpress.com/158/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/wpfspark.wordpress.com/158/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/wpfspark.wordpress.com/158/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/wpfspark.wordpress.com/158/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/wpfspark.wordpress.com/158/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/wpfspark.wordpress.com/158/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/wpfspark.wordpress.com/158/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/wpfspark.wordpress.com/158/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/wpfspark.wordpress.com/158/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wpfspark.wordpress.com&amp;blog=8309914&amp;post=158&amp;subd=wpfspark&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://wpfspark.wordpress.com/2011/08/23/wpfspark-3-of-n-fluidwrappanel/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/78cc63232601b5906038e418391e51bc?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ratishphilip</media:title>
		</media:content>

		<media:content url="http://wpfspark.files.wordpress.com/2011/08/fluidwrappanel.png" medium="image">
			<media:title type="html">FluidWrapPanel</media:title>
		</media:content>
	</item>
		<item>
		<title>Get Notified when child is added to a Custom Panel via XAML</title>
		<link>http://wpfspark.wordpress.com/2011/08/02/get-notified-when-child-is-added-to-a-custom-panel-via-xaml/</link>
		<comments>http://wpfspark.wordpress.com/2011/08/02/get-notified-when-child-is-added-to-a-custom-panel-via-xaml/#comments</comments>
		<pubDate>Tue, 02 Aug 2011 16:35:05 +0000</pubDate>
		<dc:creator>Ratish Philip</dc:creator>
				<category><![CDATA[WPF]]></category>
		<category><![CDATA[WPFSpark]]></category>

		<guid isPermaLink="false">http://wpfspark.wordpress.com/?p=142</guid>
		<description><![CDATA[As I was creating the next control for my WPFSpark project &#8211; the FluidWrapPanel, a thought occurred to me. How will the FluidWrapPanel be notified when controls are added as its children via XAML? As of now, FluidWrapPanel had an API called AddChild which would take a UIElement as a parameter. The reason behind this [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wpfspark.wordpress.com&amp;blog=8309914&amp;post=142&amp;subd=wpfspark&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>As I was creating the next control for my <a title="WPFSpark at CodePlex" href="http://wpfspark.codeplex.com/" target="_blank">WPFSpark</a> project &#8211; the <strong>FluidWrapPanel</strong>, a thought occurred to me. How will the <strong>FluidWrapPanel</strong> be notified when controls are added as its children via XAML?</p>
<p>As of now, <strong>FluidWrapPanel</strong> had an API called <strong>AddChild</strong> which would take a <strong>UIElement</strong> as a parameter. The reason behind this was that the <strong>FluidWrapPanel</strong> needs to perform some calculations before adding it to the <strong>InternalChildren</strong>. The <strong>UIElementCollection</strong> does not have a <strong>CollectionChanged</strong> to which we can subscribe to. Search over the internet yielded partial solutions to the problem. This MSDN <a href="http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/d7a41331-b824-45b3-b575-fbf17393eff5/" target="_blank">link</a> provided the initial starting point for my solution.</p>
<p>First, I defined an interface <strong>INotifiableParent</strong> which must be implemented by the Custom Panel requiring <strong>UIElementCollection</strong> change notification.</p>
<pre>namespace WPFSpark
{
    public interface INotifiableParent
    {
        int AddChild(UIElement child);
        void RemoveChild(UIElement child);
    }
}</pre>
<p>Next, I derived a class <strong>NotifiableUIElementCollection</strong> from the <strong>UIElementCollection</strong> class and provided a constructor, overriden methods (<strong>Add</strong> and <strong>Remove</strong>) and private member variable of type <strong>INotifiableParent</strong>.</p>
<pre>namespace WPFSpark
{
    public class NotifiableUIElementCollection : UIElementCollection
    {
        private INotifiableParent parent;

        public NotifiableUIElementCollection(UIElement visualParent, FrameworkElement logicalParent)
            : base(visualParent, logicalParent)
        {
            parent = (INotifiableParent)logicalParent;
        }

        public override int Add(System.Windows.UIElement element)
        {
            if (parent != null)
                return parent.AddChild(element);

            return -1;
        }

        public override void Remove(UIElement element)
        {
            if (parent != null)
                parent.RemoveChild(element);
        }
    }
}</pre>
<p>The <strong>NotifiableUIElementCollection </strong>class does not store the children within itself. Instead it delegates the work to the <strong>INotifiableParent</strong> member.</p>
<p>Now, the following must be done in the Custom Panel code -</p>
<ul>
<li>Add a member variable of type <strong>NotifiableUIElementCollection </strong>(<em>this member must be initialized in the constructor!</em>)</li>
<li>Add A read-only property of type <strong>NotifiableUIElementCollection</strong> which returns the private member.</li>
<li>The <strong>ContentPropertyAttribute</strong> must be added to the CustomPanel class with the read-only Property name as the argument.</li>
<li>Implement the <strong>INotifiableParent</strong> interface.</li>
</ul>
<p>The <strong><a title="ContentPropertyAttribute" href="http://msdn.microsoft.com/en-us/library/system.windows.markup.contentpropertyattribute.aspx" target="_blank">ContentPropertyAttribute</a> </strong>indicates which property of a type is the XAML content property.</p>
<p><strong>Important: In the implementation of the AddChild method, you must add the child to the Children property of the CustomPanel otherwise it will not be rendered on the panel.</strong></p>
<p>Here in the sample panel below, I am expecting that TextBoxes will be added to it via XAML and I am assigning a value to the <strong>Text</strong> property of the TextBlock.</p>
<pre>namespace CustomPanelSample
{
    [ContentProperty("NotifiableChildren")]
    class CustomPanel : Canvas, INotifiableParent
    {
        int count = 1;

        private NotifiableUIElementCollection notifiableChildren;

        public NotifiableUIElementCollection NotifiableChildren
        {
            get
            {
                return notifiableChildren;
            }
        }

        public CustomPanel()
        {
	    // Initialize the NotifiableUIElementCollection
            notifiableChildren = new NotifiableUIElementCollection(this, this);
        }

        #region INotifiableParent Members

        public int AddChild(System.Windows.UIElement child)
        {
            // Add your custom code here
            TextBlock tb = child as TextBlock;

            if (tb != null)
            {
                tb.Text = count++.ToString();
            }

	    // Add the child to the InternalChildren
            return this.Children.Add(child);
        }

        public void RemoveChild(System.Windows.UIElement child)
        {
            this.Children.Remove(child);
        }

        #endregion
    }
}</pre>
<p>Here is how the CustomPanel will be used</p>
<pre>&lt;Window x:Class="CustomPanelSample.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow"
        Height="350"
        Width="525"
        xmlns:my="clr-namespace:CustomPanelSample"&gt;
    &lt;Grid&gt;
        &lt;my:CustomPanel HorizontalAlignment="Stretch"
                        Margin="15"
                        x:Name="customPanel1"
                        VerticalAlignment="Stretch"&gt;
            &lt;TextBlock Width="100"
                       Height="30"
                       Canvas.Left="200"
                       Canvas.Top="10"
                       Foreground="Black"
                       Background="Orchid"
                       FontSize="20"
                       TextAlignment="Center"&gt;&lt;/TextBlock&gt;
            &lt;TextBlock Width="100"
                       Height="30"
                       Canvas.Left="200"
                       Canvas.Top="50"
                       Foreground="Black"
                       Background="Orchid"
                       FontSize="20"
                       TextAlignment="Center"&gt;&lt;/TextBlock&gt;
            &lt;TextBlock Width="100"
                       Height="30"
                       Canvas.Left="200"
                       Canvas.Top="90"
                       Foreground="Black"
                       Background="Orchid"
                       FontSize="20"
                       TextAlignment="Center"&gt;&lt;/TextBlock&gt;
            &lt;TextBlock Width="100"
                       Height="30"
                       Canvas.Left="200"
                       Canvas.Top="130"
                       Foreground="Black"
                       Background="Orchid"
                       FontSize="20"
                       TextAlignment="Center"&gt;&lt;/TextBlock&gt;
            &lt;TextBlock Width="100"
                       Height="30"
                       Canvas.Left="200"
                       Canvas.Top="170"
                       Foreground="Black"
                       Background="Orchid"
                       FontSize="20"
                       TextAlignment="Center"&gt;&lt;/TextBlock&gt;
            &lt;TextBlock Width="100"
                       Height="30"
                       Canvas.Left="200"
                       Canvas.Top="210"
                       Foreground="Black"
                       Background="Orchid"
                       FontSize="20"
                       TextAlignment="Center"&gt;&lt;/TextBlock&gt;
            &lt;TextBlock Width="100"
                       Height="30"
                       Canvas.Left="200"
                       Canvas.Top="250"
                       Foreground="Black"
                       Background="Orchid"
                       FontSize="20"
                       TextAlignment="Center"&gt;&lt;/TextBlock&gt;
        &lt;/my:CustomPanel&gt;
    &lt;/Grid&gt;
&lt;/Window&gt;</pre>
<p>Upon executing this, the following output is shown.</p>
<p><a href="http://wpfspark.files.wordpress.com/2011/08/output.png"><img class="alignnone size-full wp-image-145" title="Output" src="http://wpfspark.files.wordpress.com/2011/08/output.png?w=630" alt=""   /></a></p>
<p>In the <strong>NotifiableUIElementCollection</strong>, you can also implement the remaining overridable methods available in the<strong> UIElementCollection. </strong>In that case you must also expand the <strong>INotifiableParent</strong> interface to accommodate those methods.<strong><br />
</strong></p>
<p>Hope this solution comes handy!</p>
<p>Happy coding! <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/wpfspark.wordpress.com/142/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/wpfspark.wordpress.com/142/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/wpfspark.wordpress.com/142/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/wpfspark.wordpress.com/142/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/wpfspark.wordpress.com/142/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/wpfspark.wordpress.com/142/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/wpfspark.wordpress.com/142/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/wpfspark.wordpress.com/142/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/wpfspark.wordpress.com/142/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/wpfspark.wordpress.com/142/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/wpfspark.wordpress.com/142/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/wpfspark.wordpress.com/142/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/wpfspark.wordpress.com/142/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/wpfspark.wordpress.com/142/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wpfspark.wordpress.com&amp;blog=8309914&amp;post=142&amp;subd=wpfspark&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://wpfspark.wordpress.com/2011/08/02/get-notified-when-child-is-added-to-a-custom-panel-via-xaml/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/78cc63232601b5906038e418391e51bc?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ratishphilip</media:title>
		</media:content>

		<media:content url="http://wpfspark.files.wordpress.com/2011/08/output.png" medium="image">
			<media:title type="html">Output</media:title>
		</media:content>
	</item>
		<item>
		<title>WPFSpark : 2 of n : ToggleSwitch</title>
		<link>http://wpfspark.wordpress.com/2011/07/31/wpfspark-2-of-n-toggleswitch/</link>
		<comments>http://wpfspark.wordpress.com/2011/07/31/wpfspark-2-of-n-toggleswitch/#comments</comments>
		<pubDate>Sun, 31 Jul 2011 02:24:16 +0000</pubDate>
		<dc:creator>Ratish Philip</dc:creator>
				<category><![CDATA[WPF]]></category>
		<category><![CDATA[WPFSpark]]></category>

		<guid isPermaLink="false">http://wpfspark.wordpress.com/?p=136</guid>
		<description><![CDATA[My second article in the WPFSpark series is out. I have added a new control called ToggleSwitch to the WPFSpark library. You can access it here. I&#8217;m currently finalizing the next control for the WPFSpark library. It is called FluidWrapPanel. You can catch a glimpse of it in my codeplex site.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wpfspark.wordpress.com&amp;blog=8309914&amp;post=136&amp;subd=wpfspark&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>My second article in the <strong>WPFSpark</strong> series is out. I have added a new control called <strong>ToggleSwitch</strong> to the <strong>WPFSpark</strong> library.</p>
<p><a href="http://wpfspark.files.wordpress.com/2011/07/toggleswitch2.png"><img class="alignnone size-full wp-image-138" title="ToggleSwitch" src="http://wpfspark.files.wordpress.com/2011/07/toggleswitch2.png?w=630" alt=""   /></a></p>
<p>You can access it <a title="ToggleSwitch" href="http://www.codeproject.com/KB/WPF/WPFSpark_ToggleSwitch.aspx" target="_blank">here</a>.</p>
<p>I&#8217;m currently finalizing the next control for the <strong>WPFSpark</strong> library. It is called <strong>FluidWrapPanel</strong>. You can catch a glimpse of it in my<a title="WPFSpark at CodePlex" href="http://wpfspark.codeplex.com/" target="_blank"> codeplex site</a>.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/wpfspark.wordpress.com/136/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/wpfspark.wordpress.com/136/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/wpfspark.wordpress.com/136/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/wpfspark.wordpress.com/136/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/wpfspark.wordpress.com/136/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/wpfspark.wordpress.com/136/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/wpfspark.wordpress.com/136/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/wpfspark.wordpress.com/136/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/wpfspark.wordpress.com/136/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/wpfspark.wordpress.com/136/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/wpfspark.wordpress.com/136/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/wpfspark.wordpress.com/136/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/wpfspark.wordpress.com/136/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/wpfspark.wordpress.com/136/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wpfspark.wordpress.com&amp;blog=8309914&amp;post=136&amp;subd=wpfspark&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://wpfspark.wordpress.com/2011/07/31/wpfspark-2-of-n-toggleswitch/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/78cc63232601b5906038e418391e51bc?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ratishphilip</media:title>
		</media:content>

		<media:content url="http://wpfspark.files.wordpress.com/2011/07/toggleswitch2.png" medium="image">
			<media:title type="html">ToggleSwitch</media:title>
		</media:content>
	</item>
		<item>
		<title>ClipBorder: A WPF Border that clips</title>
		<link>http://wpfspark.wordpress.com/2011/06/08/clipborder-a-wpf-border-that-clips/</link>
		<comments>http://wpfspark.wordpress.com/2011/06/08/clipborder-a-wpf-border-that-clips/#comments</comments>
		<pubDate>Wed, 08 Jun 2011 02:15:30 +0000</pubDate>
		<dc:creator>Ratish Philip</dc:creator>
				<category><![CDATA[WPF]]></category>
		<category><![CDATA[WPFSpark]]></category>

		<guid isPermaLink="false">http://wpfspark.wordpress.com/?p=127</guid>
		<description><![CDATA[While creating the next control for my WPFSpark project, I had the requirement of a WPF Grid with rounded corners. Since the Grid does not have the CornerRadius property, the other option I had was to encapsulate the Grid within a Border and set the ClipToBounds property of the Border to true. Then I found [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wpfspark.wordpress.com&amp;blog=8309914&amp;post=127&amp;subd=wpfspark&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>While creating the next control for my <strong>WPFSpark</strong> project, I had the requirement of a WPF Grid with rounded corners. Since the Grid does not have the <strong>CornerRadius</strong> property, the other option I had was to encapsulate the Grid within a Border and set the <strong>ClipToBounds</strong> property of the Border to <strong>true</strong>. Then I found out that<em> Border (and all decorators) do not perform the clipping even though the ClipToBounds is set to true</em>.</p>
<p>The <a href="http://social.msdn.microsoft.com/forums/en-US/wpf/thread/3364bdd1-0e74-41cb-9cb9-d91f02443ceb/" target="_blank">MSDN Forum</a> provided an excellent solution on how to derive from the Border class and implement the clipping on your own. The <strong>ClippingBorder</strong> class mentioned in this site has a <strong> _clipRect</strong> field (of type <strong>RectangleGeometry</strong>) which is set as the <strong>Clip</strong> property of the ClippingBorder&#8217;s <strong>Child</strong>. But in this case the corner radius of the RectangleGeometry is same for all corners. What if you have a border with different corner radius for each corner and you want it to act as a clipping border?</p>
<p>I modified the ClippingBorder class to create the <strong>ClipBorder</strong> class which will take into account the above mentioned issue. Instead of a RectangleGeometry field, the ClipBorder class uses a <strong>PathGeometry</strong> to define the clipping Geometry. For this purpose I have used the <strong>GeometryHelper</strong> class (mentioned in my previous <a title="GeometryHelper class" href="http://wpfspark.wordpress.com/2011/06/04/handling-the-cornerradius-for-a-roundedrectangle-geometry-in-wpf/" target="_blank">post</a>) to obtain the <strong>RoundedRectangleGeometry</strong>. I have modified the GeometryHelper code further to take into account the <strong>BorderThickness</strong> of the ClipBorder.</p>
<p>Here is the code for <strong>ClipBorder</strong>:</p>
<pre>namespace WPFSpark
{
    /// &lt;summary&gt;
    /// Border which allows Clipping to its border.
    /// Useful especially when you need to clip to round corners.
    /// &lt;/summary&gt;
    public class ClipBorder : Border
    {
        protected override void OnRender(DrawingContext dc)
        {
            OnApplyChildClip();
            base.OnRender(dc);
        }

        public override UIElement Child
        {
            get
            {
                return base.Child;
            }
            set
            {
                if (this.Child != value)
                {
                    if (this.Child != null)
                    {
                        // Restore original clipping of the old child
                        this.Child.SetValue(UIElement.ClipProperty, oldClip);
                    }

                    if (value != null)
                    {
                        // Store the current clipping of the new child
                        oldClip = value.ReadLocalValue(UIElement.ClipProperty);
                    }
                    else
                    {
                        // If we dont set it to null we could leak a Geometry object
                        oldClip = null;
                    }

                    base.Child = value;
                }
            }
        }

        protected virtual void OnApplyChildClip()
        {
            UIElement child = this.Child;
            if (child != null)
            {
                // Get the geometry of a rounded rectangle border based on the BorderThickness and CornerRadius
                clipGeometry = GeometryHelper.GetRoundRectangle(new Rect(Child.RenderSize), this.BorderThickness, this.CornerRadius);
                child.Clip = clipGeometry;
            }
        }

        private Geometry clipGeometry = null;
        private object oldClip;
    }
}</pre>
<p><strong>Update</strong>: There was a small error in the calculation of the <strong>RoundedRectangle</strong> <strong>Geometry</strong> when the <strong>BorderThickness</strong> was <strong>1</strong> pixel. I have rectified it and updated the code. Thanks to <strong>Gene</strong> for pointing it out. <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Here is the updated code for the modified <strong>GeometryHelper</strong>:</p>
<pre>public static Geometry GetRoundRectangle(Rect baseRect, Thickness thickness, CornerRadius cornerRadius)
{
    // Normalizing the corner radius
    if (cornerRadius.TopLeft &lt; Double.Epsilon)
        cornerRadius.TopLeft = 0.0;
    if (cornerRadius.TopRight &lt; Double.Epsilon)
        cornerRadius.TopRight = 0.0;
    if (cornerRadius.BottomLeft &lt; Double.Epsilon)
        cornerRadius.BottomLeft = 0.0;
    if (cornerRadius.BottomRight &lt; Double.Epsilon)
        cornerRadius.BottomRight = 0.0;

    // Taking the border thickness into account
    double leftHalf = thickness.Left * 0.5;
    if (leftHalf &lt; Double.Epsilon)
        leftHalf = 0.0;
    double topHalf = thickness.Top * 0.5;
    if (topHalf &lt; Double.Epsilon)
        topHalf = 0.0;
    double rightHalf = thickness.Right * 0.5;
    if (rightHalf &lt; Double.Epsilon)
        rightHalf = 0.0;
    double bottomHalf = thickness.Bottom * 0.5;
    if (bottomHalf &lt; Double.Epsilon)
        bottomHalf = 0.0;

    // Create the rectangles for the corners that needs to be curved in the base rectangle
    // TopLeft Rectangle
    Rect topLeftRect = new Rect(baseRect.Location.X,
                                baseRect.Location.Y,
                                Math.Max(0.0, cornerRadius.TopLeft - leftHalf),
                                Math.Max(0.0, cornerRadius.TopLeft - rightHalf));
    // TopRight Rectangle
    Rect topRightRect = new Rect(baseRect.Location.X + baseRect.Width - cornerRadius.TopRight + rightHalf,
                                 baseRect.Location.Y,
                                 Math.Max(0.0, cornerRadius.TopRight - rightHalf),
                                 Math.Max(0.0, cornerRadius.TopRight - topHalf));
    // BottomRight Rectangle
    Rect bottomRightRect = new Rect(baseRect.Location.X + baseRect.Width - cornerRadius.BottomRight + rightHalf,
                                    baseRect.Location.Y + baseRect.Height - cornerRadius.BottomRight + bottomHalf,
                                    Math.Max(0.0, cornerRadius.BottomRight - rightHalf),
                                    Math.Max(0.0, cornerRadius.BottomRight - bottomHalf));
    // BottomLeft Rectangle
    Rect bottomLeftRect = new Rect(baseRect.Location.X,
                                   baseRect.Location.Y + baseRect.Height - cornerRadius.BottomLeft + bottomHalf,
                                   Math.Max(0.0, cornerRadius.BottomLeft - leftHalf),
                                   Math.Max(0.0, cornerRadius.BottomLeft - bottomHalf)); 

    // Adjust the width of the TopLeft and TopRight rectangles so that they are proportional to the width of the baseRect
    if (topLeftRect.Right &gt; topRightRect.Left)
    {
        double newWidth = (topLeftRect.Width / (topLeftRect.Width + topRightRect.Width)) * baseRect.Width;
        topLeftRect = new Rect(topLeftRect.Location.X, topLeftRect.Location.Y, newWidth, topLeftRect.Height);
        topRightRect = new Rect(baseRect.Left + newWidth, topRightRect.Location.Y, Math.Max(0.0, baseRect.Width - newWidth), topRightRect.Height);
    }

    // Adjust the height of the TopRight and BottomRight rectangles so that they are proportional to the height of the baseRect
    if (topRightRect.Bottom &gt; bottomRightRect.Top)
    {
        double newHeight = (topRightRect.Height / (topRightRect.Height + bottomRightRect.Height)) * baseRect.Height;
        topRightRect = new Rect(topRightRect.Location.X, topRightRect.Location.Y, topRightRect.Width, newHeight);
        bottomRightRect = new Rect(bottomRightRect.Location.X, baseRect.Top + newHeight, bottomRightRect.Width, Math.Max(0.0, baseRect.Height - newHeight));
    }

    // Adjust the width of the BottomLeft and BottomRight rectangles so that they are proportional to the width of the baseRect
    if (bottomRightRect.Left &lt; bottomLeftRect.Right)
    {
        double newWidth = (bottomLeftRect.Width / (bottomLeftRect.Width + bottomRightRect.Width)) * baseRect.Width;
        bottomLeftRect = new Rect(bottomLeftRect.Location.X, bottomLeftRect.Location.Y, newWidth, bottomLeftRect.Height);
        bottomRightRect = new Rect(baseRect.Left + newWidth, bottomRightRect.Location.Y, Math.Max(0.0, baseRect.Width - newWidth), bottomRightRect.Height);
    }

    // Adjust the height of the TopLeft and BottomLeft rectangles so that they are proportional to the height of the baseRect
    if (bottomLeftRect.Top &lt; topLeftRect.Bottom)
    {
        double newHeight = (topLeftRect.Height / (topLeftRect.Height + bottomLeftRect.Height)) * baseRect.Height;
        topLeftRect = new Rect(topLeftRect.Location.X, topLeftRect.Location.Y, topLeftRect.Width, newHeight);
        bottomLeftRect = new Rect(bottomLeftRect.Location.X, baseRect.Top + newHeight, bottomLeftRect.Width, Math.Max(0.0, baseRect.Height - newHeight));
    }

    StreamGeometry roundedRectGeometry = new StreamGeometry();

    using (StreamGeometryContext context = roundedRectGeometry.Open())
    {
        // Begin from the Bottom of the TopLeft Arc and proceed clockwise
        context.BeginFigure(topLeftRect.BottomLeft, true, true);
        // TopLeft Arc
        context.ArcTo(topLeftRect.TopRight, topLeftRect.Size, 0, false, SweepDirection.Clockwise, true, true);
        // Top Line
        context.LineTo(topRightRect.TopLeft, true, true);
        // TopRight Arc
        context.ArcTo(topRightRect.BottomRight, topRightRect.Size, 0, false, SweepDirection.Clockwise, true, true);
        // Right Line
        context.LineTo(bottomRightRect.TopRight, true, true);
        // BottomRight Arc
        context.ArcTo(bottomRightRect.BottomLeft, bottomRightRect.Size, 0, false, SweepDirection.Clockwise, true, true);
        // Bottom Line
        context.LineTo(bottomLeftRect.BottomRight, true, true);
        // BottomLeft Arc
        context.ArcTo(bottomLeftRect.TopLeft, bottomLeftRect.Size, 0, false, SweepDirection.Clockwise, true, true);
    }

    return roundedRectGeometry;
}</pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/wpfspark.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/wpfspark.wordpress.com/127/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/wpfspark.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/wpfspark.wordpress.com/127/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/wpfspark.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/wpfspark.wordpress.com/127/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/wpfspark.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/wpfspark.wordpress.com/127/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/wpfspark.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/wpfspark.wordpress.com/127/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/wpfspark.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/wpfspark.wordpress.com/127/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/wpfspark.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/wpfspark.wordpress.com/127/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wpfspark.wordpress.com&amp;blog=8309914&amp;post=127&amp;subd=wpfspark&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://wpfspark.wordpress.com/2011/06/08/clipborder-a-wpf-border-that-clips/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/78cc63232601b5906038e418391e51bc?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ratishphilip</media:title>
		</media:content>
	</item>
		<item>
		<title>Handling the CornerRadius for a RoundedRectangle Geometry in WPF</title>
		<link>http://wpfspark.wordpress.com/2011/06/04/handling-the-cornerradius-for-a-roundedrectangle-geometry-in-wpf/</link>
		<comments>http://wpfspark.wordpress.com/2011/06/04/handling-the-cornerradius-for-a-roundedrectangle-geometry-in-wpf/#comments</comments>
		<pubDate>Sat, 04 Jun 2011 15:17:34 +0000</pubDate>
		<dc:creator>Ratish Philip</dc:creator>
				<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://wpfspark.wordpress.com/?p=109</guid>
		<description><![CDATA[Recently I was pondering on how to create a RoundedRectangle Geometry in WPF. WPF does provide a RectangleGeometry class which has the RadiusX and RadiusY properties which allow you to curve the RectangleGeometry at the corners.  Each of the corners have the same curvature. But what if you need a different corner radius at each [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wpfspark.wordpress.com&amp;blog=8309914&amp;post=109&amp;subd=wpfspark&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Recently I was pondering on how to create a RoundedRectangle Geometry in WPF. WPF does provide a <strong>RectangleGeometry</strong> class which has the <strong>RadiusX</strong> and <strong>RadiusY</strong> properties which allow you to curve the RectangleGeometry at the corners.  Each of the corners have the same curvature. But what if you need a different corner radius at each of the corners?</p>
<p><a href="http://wpfspark.files.wordpress.com/2011/06/border1.png"><img class="alignnone size-full wp-image-113" title="border" src="http://wpfspark.files.wordpress.com/2011/06/border1.png?w=630" alt=""   /></a></p>
<p>If you look closely at a border with rounded corners, it can be split into 4 straight lines and 4 curves.</p>
<p><a href="http://wpfspark.files.wordpress.com/2011/06/bordersplit1.png"><img class="alignnone size-full wp-image-114" title="borderSplit" src="http://wpfspark.files.wordpress.com/2011/06/bordersplit1.png?w=630" alt=""   /></a></p>
<p>Thus to create the RoundedRectangleGeometry you require <strong><em>four</em></strong> <strong>LineSegments</strong> and <strong><em>four</em></strong> <strong>ArcSegments</strong>. To determine the end points of the Arcs you need to calculate the rectangles that enclose them at each corner. The <strong>LineSegments</strong> will be drawn between the EndPoint of an <strong>ArcSegment</strong> and the StartPoint of the next <strong>ArcSegment</strong>.</p>
<p><a href="http://wpfspark.files.wordpress.com/2011/06/borderrect.png"><img class="alignnone size-full wp-image-112" title="borderRect" src="http://wpfspark.files.wordpress.com/2011/06/borderrect.png?w=630" alt=""   /></a></p>
<p>The next question that comes to mind is what happens if the rectangles enclosing the ArcSegments overlap (i.e. the corner radius is larger than half of the width or height of the Rounded Rectangle). The sample program which I created to test it gave me the following output when the TopLeft and TopRight corner radii were large.</p>
<p><a href="http://wpfspark.files.wordpress.com/2011/06/largecornerradius.png"><img class="alignnone size-full wp-image-115" title="largeCornerRadius" src="http://wpfspark.files.wordpress.com/2011/06/largecornerradius.png?w=630" alt=""   /></a></p>
<p>Then I looked into how the Border class handles this situation and I found out that in such scenarios the width and height of the corner rectangles were recalculated in such a way that they were in proportion to each other with respect with to the width and height of the base Rounded Rectangle.</p>
<p><a href="http://wpfspark.files.wordpress.com/2011/06/bordercalculation.png"><img class="alignnone size-full wp-image-117" title="BorderCalculation" src="http://wpfspark.files.wordpress.com/2011/06/bordercalculation.png?w=630" alt=""   /></a></p>
<p>Here is the code for the class <strong>GeometryHelper</strong> which generates a <strong>PathGeometry</strong> for a RoundedRectangle based on the given BaseRect size and CornerRadius.</p>
<pre>namespace WPFSpark
{
    public static class GeometryHelper
    {
        public static Geometry GetRoundRectangleGeometry(Rect baseRect, CornerRadius cornerRadius)
        {
            if (cornerRadius.TopLeft &lt; Double.Epsilon)
                cornerRadius.TopLeft = 0.0;
            if (cornerRadius.TopRight &lt; Double.Epsilon)
                cornerRadius.TopRight = 0.0;
            if (cornerRadius.BottomLeft &lt; Double.Epsilon)
                cornerRadius.BottomLeft = 0.0;
            if (cornerRadius.BottomRight &lt; Double.Epsilon)
                cornerRadius.BottomRight = 0.0;                          

            // Create the rectangles for the corners that needs to be curved in the base rectangle
            // TopLeft Rectangle
            Rect topLeftRect = new Rect(baseRect.Location.X,
                                        baseRect.Location.Y,
                                        cornerRadius.TopLeft,
                                        cornerRadius.TopLeft);
            // TopRight Rectangle
            Rect topRightRect = new Rect(baseRect.Location.X + baseRect.Width - cornerRadius.TopRight,
                                         baseRect.Location.Y,
                                         cornerRadius.TopRight,
                                         cornerRadius.TopRight);
            // BottomRight Rectangle
            Rect bottomRightRect = new Rect(baseRect.Location.X + baseRect.Width - cornerRadius.BottomRight,
                                            baseRect.Location.Y + baseRect.Height - cornerRadius.BottomRight,
                                            cornerRadius.BottomRight,
                                            cornerRadius.BottomRight);
            // BottomLeft Rectangle
            Rect bottomLeftRect = new Rect(baseRect.Location.X,
                                           baseRect.Location.Y + baseRect.Height - cornerRadius.BottomLeft,
                                           cornerRadius.BottomLeft,
                                           cornerRadius.BottomLeft);             

            // Adjust the width of the TopLeft and TopRight rectangles so that they are proportional to the width of the baseRect
            if (topLeftRect.Right &gt; topRightRect.Left)
            {
                double newWidth = (topLeftRect.Width / (topLeftRect.Width + topRightRect.Width)) * baseRect.Width;
                topLeftRect = new Rect(topLeftRect.Location.X, topLeftRect.Location.Y, newWidth, topLeftRect.Height);
                topRightRect = new Rect(baseRect.Left + newWidth, topRightRect.Location.Y, Math.Max(0.0, baseRect.Width - newWidth), topRightRect.Height);
            }

            // Adjust the height of the TopRight and BottomRight rectangles so that they are proportional to the height of the baseRect
            if (topRightRect.Bottom &gt; bottomRightRect.Top)
            {
                double newHeight = (topRightRect.Height / (topRightRect.Height + bottomRightRect.Height)) * baseRect.Height;
                topRightRect = new Rect(topRightRect.Location.X, topRightRect.Location.Y, topRightRect.Width, newHeight);
                bottomRightRect = new Rect(bottomRightRect.Location.X, baseRect.Top + newHeight, bottomRightRect.Width, Math.Max(0.0, baseRect.Height - newHeight));
            }

            // Adjust the width of the BottomLeft and BottomRight rectangles so that they are proportional to the width of the baseRect
            if (bottomRightRect.Left &lt; bottomLeftRect.Right)
            {
                double newWidth = (bottomLeftRect.Width / (bottomLeftRect.Width + bottomRightRect.Width)) * baseRect.Width;
                bottomLeftRect = new Rect(bottomLeftRect.Location.X, bottomLeftRect.Location.Y, newWidth, bottomLeftRect.Height);
                bottomRightRect = new Rect(baseRect.Left + newWidth, bottomRightRect.Location.Y, Math.Max(0.0, baseRect.Width - newWidth), bottomRightRect.Height);
            }

            // Adjust the height of the TopLeft and BottomLeft rectangles so that they are proportional to the height of the baseRect
            if (bottomLeftRect.Top &lt; topLeftRect.Bottom)
            {
                double newHeight = (topLeftRect.Height / (topLeftRect.Height + bottomLeftRect.Height)) * baseRect.Height;
                topLeftRect = new Rect(topLeftRect.Location.X, topLeftRect.Location.Y, topLeftRect.Width, newHeight);
                bottomLeftRect = new Rect(bottomLeftRect.Location.X, baseRect.Top + newHeight, bottomLeftRect.Width, Math.Max(0.0, baseRect.Height - newHeight));
            }

            StreamGeometry roundedRectGeometry = new StreamGeometry();

            using (StreamGeometryContext context = roundedRectGeometry.Open())
            {
                // Begin from the Bottom of the TopLeft Arc and proceed clockwise
                context.BeginFigure(topLeftRect.BottomLeft, true, true);
                // TopLeft Arc
                context.ArcTo(topLeftRect.TopRight, topLeftRect.Size, 0, false, SweepDirection.Clockwise, true, true);
                // Top Line
                context.LineTo(topRightRect.TopLeft, true, true);
                // TopRight Arc
                context.ArcTo(topRightRect.BottomRight, topRightRect.Size, 0, false, SweepDirection.Clockwise, true, true);
                // Right Line
                context.LineTo(bottomRightRect.TopRight, true, true);
                // BottomRight Arc
                context.ArcTo(bottomRightRect.BottomLeft, bottomRightRect.Size, 0, false, SweepDirection.Clockwise, true, true);
                // Bottom Line
                context.LineTo(bottomLeftRect.BottomRight, true, true);
                // BottomLeft Arc
                context.ArcTo(bottomLeftRect.TopLeft, bottomLeftRect.Size, 0, false, SweepDirection.Clockwise, true, true);

                context.Close();
            }

            return roundedRectGeometry;
        }
    }
}</pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/wpfspark.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/wpfspark.wordpress.com/109/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/wpfspark.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/wpfspark.wordpress.com/109/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/wpfspark.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/wpfspark.wordpress.com/109/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/wpfspark.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/wpfspark.wordpress.com/109/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/wpfspark.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/wpfspark.wordpress.com/109/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/wpfspark.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/wpfspark.wordpress.com/109/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/wpfspark.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/wpfspark.wordpress.com/109/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wpfspark.wordpress.com&amp;blog=8309914&amp;post=109&amp;subd=wpfspark&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://wpfspark.wordpress.com/2011/06/04/handling-the-cornerradius-for-a-roundedrectangle-geometry-in-wpf/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/78cc63232601b5906038e418391e51bc?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ratishphilip</media:title>
		</media:content>

		<media:content url="http://wpfspark.files.wordpress.com/2011/06/border1.png" medium="image">
			<media:title type="html">border</media:title>
		</media:content>

		<media:content url="http://wpfspark.files.wordpress.com/2011/06/bordersplit1.png" medium="image">
			<media:title type="html">borderSplit</media:title>
		</media:content>

		<media:content url="http://wpfspark.files.wordpress.com/2011/06/borderrect.png" medium="image">
			<media:title type="html">borderRect</media:title>
		</media:content>

		<media:content url="http://wpfspark.files.wordpress.com/2011/06/largecornerradius.png" medium="image">
			<media:title type="html">largeCornerRadius</media:title>
		</media:content>

		<media:content url="http://wpfspark.files.wordpress.com/2011/06/bordercalculation.png" medium="image">
			<media:title type="html">BorderCalculation</media:title>
		</media:content>
	</item>
		<item>
		<title>Preventing Silverlight applications from Scaling during resolution change</title>
		<link>http://wpfspark.wordpress.com/2011/06/03/preventing-silverlight-applications-from-scaling-during-resolution-change/</link>
		<comments>http://wpfspark.wordpress.com/2011/06/03/preventing-silverlight-applications-from-scaling-during-resolution-change/#comments</comments>
		<pubDate>Fri, 03 Jun 2011 15:49:05 +0000</pubDate>
		<dc:creator>Ratish Philip</dc:creator>
				<category><![CDATA[Silverlight]]></category>

		<guid isPermaLink="false">http://wpfspark.wordpress.com/?p=97</guid>
		<description><![CDATA[One of the problems faced by Silverlight applications is when the monitor resolution is not set to the native resolution. At a lower resolution, the application scales up and it can throw the layout calculations for your application into a tizzy! In order to solve this, I thought of calculating the monitor&#8217;s maximum and current [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wpfspark.wordpress.com&amp;blog=8309914&amp;post=97&amp;subd=wpfspark&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>One of the problems faced by Silverlight applications is when the monitor resolution is not set to the native resolution. At a lower resolution, the application scales up and it can throw the layout calculations for your application into a tizzy!</p>
<p>In order to solve this, I thought of calculating the monitor&#8217;s maximum and current resolution and based on that scale the main page of the application. The search for getting the monitor resolution in silverlight led me <a title="Determine screen resolution in Silverlight" href="http://www.pitorque.de/MisterGoodcat/post/Determine-screen-resolution-in-Silverlight-OOB.aspx" target="_blank">here</a>. It is a really nice article where the author describes of the various ways how to get the monitor resolution. I tried out the code to find that the code gives the current monitor resolution. There was no way I could find the maximum resolution of a given monitor.</p>
<p>Then I thought of getting the current DPI of the monitor and comparing it with 96 DPI to calculate the amount of scaling required to make the page look as if it was in native resolution.</p>
<p>The search to get the DPI led me to a <a title="High DPI setting" href="http://blogs.ugidotnet.org/corrado/archive/2011/04/29/silverlight-applications-on-high-dpi-setting.aspx" target="_blank">site </a>which provided the solution to the entire problem in just a single line!</p>
<p>Just add the following line in the <strong>Loaded</strong> event of the MainPage of your Silverlight application.</p>
<p><span style="color:#0000ff;"><code>Application.Current.Host.Settings.EnableAutoZoom = false;</code></span></p>
<p>This solves the problem of scaling! No extra calculations required.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/wpfspark.wordpress.com/97/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/wpfspark.wordpress.com/97/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/wpfspark.wordpress.com/97/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/wpfspark.wordpress.com/97/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/wpfspark.wordpress.com/97/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/wpfspark.wordpress.com/97/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/wpfspark.wordpress.com/97/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/wpfspark.wordpress.com/97/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/wpfspark.wordpress.com/97/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/wpfspark.wordpress.com/97/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/wpfspark.wordpress.com/97/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/wpfspark.wordpress.com/97/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/wpfspark.wordpress.com/97/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/wpfspark.wordpress.com/97/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wpfspark.wordpress.com&amp;blog=8309914&amp;post=97&amp;subd=wpfspark&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://wpfspark.wordpress.com/2011/06/03/preventing-silverlight-applications-from-scaling-during-resolution-change/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/78cc63232601b5906038e418391e51bc?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ratishphilip</media:title>
		</media:content>
	</item>
	</channel>
</rss>
