<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.3.3" -->
<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/"
	>

<channel>
	<title>Silverlighter's Blog &#60;beta/&#62;</title>
	<link>http://silverlighters.org/blog</link>
	<description>Everything Silverlight, and more!</description>
	<pubDate>Fri, 18 Jul 2008 23:11:24 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.3</generator>
	<language>en</language>
			<item>
		<title>SCREENCAST: Rendering Polygons from SQL Server 2008 on Virtual Earth</title>
		<link>http://blogs.msdn.com/publicsector/archive/2008/07/18/screencast-rendering-polygons-from-sql-server-2008-on-virtual-earth.aspx</link>
		<comments>http://blogs.msdn.com/publicsector/archive/2008/07/18/screencast-rendering-polygons-from-sql-server-2008-on-virtual-earth.aspx#comments</comments>
		<pubDate>Fri, 18 Jul 2008 23:11:24 +0000</pubDate>
		<dc:creator>Public Sector DPE Team</dc:creator>
		
		<category><![CDATA[silverlighters.org (Syndicated Content)]]></category>

		<guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8752119</guid>
		<description><![CDATA[<p>In this screencast, I build off of the concepts shown <a href="http://blogs.msdn.com/devkeydet/archive/2008/07/18/screencast-saving-virtual-earth-polygons-to-sql-server-2008.aspx">in my previous screencast</a> and show you how to render a polygon on a Virtual Earth map using REST, Windows Communication Foundation (WCF), LINQ to SQL, and the new geography data type in SQL Server 2008.</p>  <p>To learn more about the GeoRSS utility library, visit:    <br /><a href="http://blogs.msdn.com/eugeniop/archive/2008/07/01/simple-georss-utility-library-released.aspx">http://blogs.msdn.com/eugeniop/archive/2008/07/01/simple-georss-utility-library-released.aspx</a></p>  <p>A big thanks to <a href="http://blogs.msdn.com/eugeniop">Eugenio Pace </a>for letting me use it as part of my sample!</p>  <p>Screencast: </p>  <p><a title="http://channel9.msdn.com/posts/keydet/Rendering-Polygons-from-SQL-Server-2008-on-Virtual-Earth/" href="http://channel9.msdn.com/posts/keydet/Rendering-Polygons-from-SQL-Server-2008-on-Virtual-Earth/">http://channel9.msdn.com/posts/keydet/Rendering-Polygons-from-SQL-Server-2008-on-Virtual-Earth/</a></p>  <p>Code: </p>  <p></p>  <p>-<a href="http://devkeydet.com">Marc</a></p>  <div>Technorati Tags: <a href="http://technorati.com/tags/virtual%20earth" rel="tag">virtual earth</a>,<a href="http://technorati.com/tags/asp.net" rel="tag">asp.net</a>,<a href="http://technorati.com/tags/ajax" rel="tag">ajax</a>,<a href="http://technorati.com/tags/wcf" rel="tag">wcf</a>,<a href="http://technorati.com/tags/linq" rel="tag">linq</a>,<a href="http://technorati.com/tags/sql%20server%202008" rel="tag">sql server 2008</a></div><img src="http://blogs.msdn.com/aggbug.aspx?PostID=8752119" width="1" height="1">]]></description>
			<content:encoded><![CDATA[<p>In this screencast, I build off of the concepts shown <a href="http://blogs.msdn.com/devkeydet/archive/2008/07/18/screencast-saving-virtual-earth-polygons-to-sql-server-2008.aspx">in my previous screencast</a> and show you how to render a polygon on a Virtual Earth map using REST, Windows Communication Foundation (WCF), LINQ to SQL, and the new geography data type in SQL Server 2008.</p>  <p>To learn more about the GeoRSS utility library, visit:    <br /><a href="http://blogs.msdn.com/eugeniop/archive/2008/07/01/simple-georss-utility-library-released.aspx">http://blogs.msdn.com/eugeniop/archive/2008/07/01/simple-georss-utility-library-released.aspx</a></p>  <p>A big thanks to <a href="http://blogs.msdn.com/eugeniop">Eugenio Pace </a>for letting me use it as part of my sample!</p>  <p>Screencast: </p>  <p><a title="http://channel9.msdn.com/posts/keydet/Rendering-Polygons-from-SQL-Server-2008-on-Virtual-Earth/" href="http://channel9.msdn.com/posts/keydet/Rendering-Polygons-from-SQL-Server-2008-on-Virtual-Earth/">http://channel9.msdn.com/posts/keydet/Rendering-Polygons-from-SQL-Server-2008-on-Virtual-Earth/</a></p>  <p>Code: </p>  <p></p>  <p>-<a href="http://devkeydet.com">Marc</a></p>  <div>Technorati Tags: <a href="http://technorati.com/tags/virtual%20earth" rel="tag">virtual earth</a>,<a href="http://technorati.com/tags/asp.net" rel="tag">asp.net</a>,<a href="http://technorati.com/tags/ajax" rel="tag">ajax</a>,<a href="http://technorati.com/tags/wcf" rel="tag">wcf</a>,<a href="http://technorati.com/tags/linq" rel="tag">linq</a>,<a href="http://technorati.com/tags/sql%20server%202008" rel="tag">sql server 2008</a></div><img src="http://blogs.msdn.com/aggbug.aspx?PostID=8752119" width="1" height="1">]]></content:encoded>
			<wfw:commentRss>http://blogs.msdn.com/publicsector/archive/2008/07/18/screencast-rendering-polygons-from-sql-server-2008-on-virtual-earth.aspx/feed/</wfw:commentRss>
		</item>
		<item>
		<title>SCREENCAST: Saving Virtual Earth Polygons to SQL Server 2008</title>
		<link>http://blogs.msdn.com/publicsector/archive/2008/07/18/screencast-saving-virtual-earth-polygons-to-sql-server-2008.aspx</link>
		<comments>http://blogs.msdn.com/publicsector/archive/2008/07/18/screencast-saving-virtual-earth-polygons-to-sql-server-2008.aspx#comments</comments>
		<pubDate>Fri, 18 Jul 2008 22:16:06 +0000</pubDate>
		<dc:creator>Public Sector DPE Team</dc:creator>
		
		<category><![CDATA[silverlighters.org (Syndicated Content)]]></category>

		<guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8751832</guid>
		<description><![CDATA[<p>In this screencast, I show you how to draw a polygon on a Virtual Earth map and save it using ASP.NET AJAX, Windows Communication Foundation (WCF), LINQ to SQL, and the new geography data type in SQL Server 2008.</p>  <p>Screencast: </p>  <p><a title="http://channel9.msdn.com/posts/keydet/Saving-Virtual-Earth-Polygons-to-SQL-Server-2008/" href="http://channel9.msdn.com/posts/keydet/Saving-Virtual-Earth-Polygons-to-SQL-Server-2008/">http://channel9.msdn.com/posts/keydet/Saving-Virtual-Earth-Polygons-to-SQL-Server-2008/</a></p>  <p>Code: </p>  <p></p>  <p>-<a href="http://devkeydet.com">Marc</a></p>  <div>Technorati Tags: <a href="http://technorati.com/tags/virtual%20earth" rel="tag">virtual earth</a>,<a href="http://technorati.com/tags/asp.net" rel="tag">asp.net</a>,<a href="http://technorati.com/tags/ajax" rel="tag">ajax</a>,<a href="http://technorati.com/tags/wcf" rel="tag">wcf</a>,<a href="http://technorati.com/tags/linq" rel="tag">linq</a>,<a href="http://technorati.com/tags/sql%20server%202008" rel="tag">sql server 2008</a></div><img src="http://blogs.msdn.com/aggbug.aspx?PostID=8751832" width="1" height="1">]]></description>
			<content:encoded><![CDATA[<p>In this screencast, I show you how to draw a polygon on a Virtual Earth map and save it using ASP.NET AJAX, Windows Communication Foundation (WCF), LINQ to SQL, and the new geography data type in SQL Server 2008.</p>  <p>Screencast: </p>  <p><a title="http://channel9.msdn.com/posts/keydet/Saving-Virtual-Earth-Polygons-to-SQL-Server-2008/" href="http://channel9.msdn.com/posts/keydet/Saving-Virtual-Earth-Polygons-to-SQL-Server-2008/">http://channel9.msdn.com/posts/keydet/Saving-Virtual-Earth-Polygons-to-SQL-Server-2008/</a></p>  <p>Code: </p>  <p></p>  <p>-<a href="http://devkeydet.com">Marc</a></p>  <div>Technorati Tags: <a href="http://technorati.com/tags/virtual%20earth" rel="tag">virtual earth</a>,<a href="http://technorati.com/tags/asp.net" rel="tag">asp.net</a>,<a href="http://technorati.com/tags/ajax" rel="tag">ajax</a>,<a href="http://technorati.com/tags/wcf" rel="tag">wcf</a>,<a href="http://technorati.com/tags/linq" rel="tag">linq</a>,<a href="http://technorati.com/tags/sql%20server%202008" rel="tag">sql server 2008</a></div><img src="http://blogs.msdn.com/aggbug.aspx?PostID=8751832" width="1" height="1">]]></content:encoded>
			<wfw:commentRss>http://blogs.msdn.com/publicsector/archive/2008/07/18/screencast-saving-virtual-earth-polygons-to-sql-server-2008.aspx/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Webcast schedule has been updated</title>
		<link>http://feeds.feedburner.com/~r/JesseLiberty-SilverlightGeek/~3/339072964/webcast-schedule-has-been-updated.aspx</link>
		<comments>http://feeds.feedburner.com/~r/JesseLiberty-SilverlightGeek/~3/339072964/webcast-schedule-has-been-updated.aspx#comments</comments>
		<pubDate>Fri, 18 Jul 2008 14:42:40 +0000</pubDate>
		<dc:creator>jesseliberty</dc:creator>
		
		<category><![CDATA[silverlighters.org (Syndicated Content)]]></category>

		<guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:72568</guid>
		<description><![CDATA[<p>The Webcast schedule has been updated slightly. You can find it <a href="http://71.248.178.27/Pages/WebCastScheduleRevised.html">here</a>. You can always find it in the sidebar as well:</p>  <p><a href="http://silverlight.net/blogs/jesseliberty/WindowsLiveWriter/Webcastschedulehasbeenupdated_9625/WebcastSidebar_2.jpg"><img height="280" alt="WebcastSidebar" src="http://silverlight.net/blogs/jesseliberty/WindowsLiveWriter/Webcastschedulehasbeenupdated_9625/WebcastSidebar_thumb.jpg" width="328" border="0" /></a> </p>  <h3>The key change is this</h3>  <p><strong>September 10 </strong> <a href="http://msevents.microsoft.com/CUI/WebCastEventDetails.aspx?culture=en-US&#38;EventID=1032381758">Silverlight Animation and Expression Blend</a></p><img src="http://silverlight.net/aggbug.aspx?PostID=72568" width="1" height="1"><div>
<a href="http://feeds.feedburner.com/~f/JesseLiberty-SilverlightGeek?a=R4ZeAJ"><img src="http://feeds.feedburner.com/~f/JesseLiberty-SilverlightGeek?i=R4ZeAJ" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/JesseLiberty-SilverlightGeek?a=p5rWmJ"><img src="http://feeds.feedburner.com/~f/JesseLiberty-SilverlightGeek?i=p5rWmJ" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/JesseLiberty-SilverlightGeek?a=DLBHfj"><img src="http://feeds.feedburner.com/~f/JesseLiberty-SilverlightGeek?i=DLBHfj" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/JesseLiberty-SilverlightGeek?a=NN7FZj"><img src="http://feeds.feedburner.com/~f/JesseLiberty-SilverlightGeek?i=NN7FZj" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/JesseLiberty-SilverlightGeek?a=VUHiAJ"><img src="http://feeds.feedburner.com/~f/JesseLiberty-SilverlightGeek?i=VUHiAJ" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/JesseLiberty-SilverlightGeek?a=dlE5Tj"><img src="http://feeds.feedburner.com/~f/JesseLiberty-SilverlightGeek?i=dlE5Tj" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/JesseLiberty-SilverlightGeek/~4/339072964" height="1">]]></description>
			<content:encoded><![CDATA[<p>The Webcast schedule has been updated slightly. You can find it <a href="http://71.248.178.27/Pages/WebCastScheduleRevised.html">here</a>. You can always find it in the sidebar as well:</p>  <p><a href="http://silverlight.net/blogs/jesseliberty/WindowsLiveWriter/Webcastschedulehasbeenupdated_9625/WebcastSidebar_2.jpg"><img height="280" alt="WebcastSidebar" src="http://silverlight.net/blogs/jesseliberty/WindowsLiveWriter/Webcastschedulehasbeenupdated_9625/WebcastSidebar_thumb.jpg" width="328" border="0" /></a> </p>  <h3>The key change is this</h3>  <p><strong>September 10 </strong> <a href="http://msevents.microsoft.com/CUI/WebCastEventDetails.aspx?culture=en-US&amp;EventID=1032381758">Silverlight Animation and Expression Blend</a></p><img src="http://silverlight.net/aggbug.aspx?PostID=72568" width="1" height="1"><div>
<a href="http://feeds.feedburner.com/~f/JesseLiberty-SilverlightGeek?a=R4ZeAJ"><img src="http://feeds.feedburner.com/~f/JesseLiberty-SilverlightGeek?i=R4ZeAJ" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/JesseLiberty-SilverlightGeek?a=p5rWmJ"><img src="http://feeds.feedburner.com/~f/JesseLiberty-SilverlightGeek?i=p5rWmJ" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/JesseLiberty-SilverlightGeek?a=DLBHfj"><img src="http://feeds.feedburner.com/~f/JesseLiberty-SilverlightGeek?i=DLBHfj" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/JesseLiberty-SilverlightGeek?a=NN7FZj"><img src="http://feeds.feedburner.com/~f/JesseLiberty-SilverlightGeek?i=NN7FZj" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/JesseLiberty-SilverlightGeek?a=VUHiAJ"><img src="http://feeds.feedburner.com/~f/JesseLiberty-SilverlightGeek?i=VUHiAJ" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/JesseLiberty-SilverlightGeek?a=dlE5Tj"><img src="http://feeds.feedburner.com/~f/JesseLiberty-SilverlightGeek?i=dlE5Tj" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/JesseLiberty-SilverlightGeek/~4/339072964" height="1">]]></content:encoded>
			<wfw:commentRss>http://feeds.feedburner.com/~r/JesseLiberty-SilverlightGeek/~3/339072964/webcast-schedule-has-been-updated.aspx/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Silverlight Cream for July 17 - 2 &#8212; #328</title>
		<link>http://geekswithblogs.net/WynApseTechnicalMusings/archive/2008/07/17/123868.aspx</link>
		<comments>http://geekswithblogs.net/WynApseTechnicalMusings/archive/2008/07/17/123868.aspx#comments</comments>
		<pubDate>Fri, 18 Jul 2008 06:33:39 +0000</pubDate>
		<dc:creator>Dave Campbell</dc:creator>
		
		<category><![CDATA[silverlighters.org (Syndicated Content)]]></category>

		<guid isPermaLink="false">http://geekswithblogs.net/WynApseTechnicalMusings/archive/2008/07/17/123868.aspx</guid>
		<description><![CDATA[<font face="tahoma">Tamir Khason on bidirectional support, Page Brooks with a Save File Dialog, Mike Snow on Increasing Isolated Storage, Dave Relyea with an Animatable WrapPanel, and Karen Corby using Dave Relyea's WrapPanel. <br />
<br />
<a href="http://adamkinney.com/blog/347/default.aspx"><u>Adam Kinney has a blog post</u></a> on the Yosemite DeepZoom project being live and has some great pictures. I've not successfully opened the page, but maybe they're getting hammered because the video they had up last week was awesome... wait it out and keep checking... it'll be worth it... there's currently 45 GigaPixels in the current image! <br />
<br />
<hr width="50%" />
From <a href="http://www.silverlightcream.com"><u>SilverlightCream.com</u></a>: <dl><dt><a href="http://blogs.microsoft.co.il/blogs/tamir/archive/2008/07/17/arabic-and-hebrew-languages-bidirectional-support-for-silverlight-2-0-beta-2.aspx"><u>Arabic and Hebrew languages bidirectional support for Silverlight 2.0 beta 2 </u></a></dt><dd>Tamir Khason is working with Arabic and Hebrew and is asking for opinions and other comments... check out what he's doing... let him know how good a job it is! </dd><dt><a href="http://pagebrooks.com/archive/2008/07/16/save-file-dialog-in-silverlight.aspx"><u>Save File Dialog in Silverlight </u></a></dt><dd>Page Brooks put together a blog post about a File Save dialog in SL in response to a query in the forums... cool ideas to expand upon I think!... just the kind of posts I like :) </dd><dt><a href="http://silverlight.net/blogs/msnow/archive/2008/07/17/tip-of-the-day-20-how-to-increase-the-isolated-storage-quota-for-your-app.aspx"><u>Tip of the Day #20 – How to Increase the Isolated Storage Quota for your App. </u></a></dt><dd>Mike Snow continues his Isolated Storage posts with this one about increasing the storage. </dd><dt><a href="http://blogs.msdn.com/devdave/archive/2008/07/17/layout-transitions-an-animatable-wrappanel.aspx"><u>Layout Transitions - An Animatable WrapPanel </u></a></dt><dd>Dave Relyea produced a very nice 'Animatable' WrapPanel ... you gotta see this... very cool... oh... grab the source while you're there! and see the next post. </dd><dt><a href="http://scorbs.com/2008/07/17/flickrviewr-using-devdaves-animatingwrappanel/"><u>FlickrViewr Using DevDave’s AnimatingWrapPanel </u></a></dt><dd>Filed under "when do people find the time...", Karen Corby reacted to Dave Relyea's post and updated her FlickrViewr again, using Dave's Animatable WrapPanel ... how cool is that?? </dd></dl><br />
<font color="#0000ff"><strong>Stay in the 'Light!</strong></font><br />
<hr width="50%" />
<a href="http://twitter.com/SilverlightNews"><u>Twitter SLNews</u></a> &#124; <a href="http://tech.groups.yahoo.com/group/SilverlightCream/join"><u>Join me @ SilverlightCream</u></a> &#124; <a href="http://www.wynapse.com/TagContent.aspx?Tag=Silverlight"><u>SL Web Articles</u></a> &#124; <a href="http://www.wynapse.com/TagContent.aspx?Tag=Silverlight2"><u>SL2 Web Articles</u></a> &#124; <a href="http://www.wynapse.com/Silverlight.aspx"><u>My Articles</u></a> &#124; <a href="http://www.wynapse.com/Silverlight_Tutorials.aspx"><u>My Tutorials</u></a> &#124; <a href="http://www.wynapse.com/Silverlight_Tooltips.aspx"><u>My Tooltips</u></a> &#124; <a href="http://www.wynapse.com/Silverlight2.aspx"><u>My SL2 Articles</u></a> &#124; <a href="http://www.wynapse.com/Silverlight2_Tooltips.aspx"><u>My SL2 ToolTips</u></a> &#124; <a href="http://www.silverlightcream.com"><u>SilverlightCream</u></a><br />
</font><p><a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&#38;u=123868"><img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&#38;u=123868"></a></p>

<a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&#38;Task=Click&#38;Mode=HTML&#38;SiteID=1&#38;PageID=31016">
<img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&#38;Task=Get&#38;Mode=HTML&#38;SiteID=1&#38;PageID=31016" width="1" height="1" border="0" alt=""></a>


<img src="http://geekswithblogs.net/WynApseTechnicalMusings/aggbug/123868.aspx" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<font face="tahoma">Tamir Khason on bidirectional support, Page Brooks with a Save File Dialog, Mike Snow on Increasing Isolated Storage, Dave Relyea with an Animatable WrapPanel, and Karen Corby using Dave Relyea's WrapPanel. <br />
<br />
<a href="http://adamkinney.com/blog/347/default.aspx"><u>Adam Kinney has a blog post</u></a> on the Yosemite DeepZoom project being live and has some great pictures. I've not successfully opened the page, but maybe they're getting hammered because the video they had up last week was awesome... wait it out and keep checking... it'll be worth it... there's currently 45 GigaPixels in the current image! <br />
<br />
<hr width="50%" />
From <a href="http://www.silverlightcream.com"><u>SilverlightCream.com</u></a>: <dl><dt><a href="http://blogs.microsoft.co.il/blogs/tamir/archive/2008/07/17/arabic-and-hebrew-languages-bidirectional-support-for-silverlight-2-0-beta-2.aspx"><u>Arabic and Hebrew languages bidirectional support for Silverlight 2.0 beta 2 </u></a></dt><dd>Tamir Khason is working with Arabic and Hebrew and is asking for opinions and other comments... check out what he's doing... let him know how good a job it is! </dd><dt><a href="http://pagebrooks.com/archive/2008/07/16/save-file-dialog-in-silverlight.aspx"><u>Save File Dialog in Silverlight </u></a></dt><dd>Page Brooks put together a blog post about a File Save dialog in SL in response to a query in the forums... cool ideas to expand upon I think!... just the kind of posts I like :) </dd><dt><a href="http://silverlight.net/blogs/msnow/archive/2008/07/17/tip-of-the-day-20-how-to-increase-the-isolated-storage-quota-for-your-app.aspx"><u>Tip of the Day #20 – How to Increase the Isolated Storage Quota for your App. </u></a></dt><dd>Mike Snow continues his Isolated Storage posts with this one about increasing the storage. </dd><dt><a href="http://blogs.msdn.com/devdave/archive/2008/07/17/layout-transitions-an-animatable-wrappanel.aspx"><u>Layout Transitions - An Animatable WrapPanel </u></a></dt><dd>Dave Relyea produced a very nice 'Animatable' WrapPanel ... you gotta see this... very cool... oh... grab the source while you're there! and see the next post. </dd><dt><a href="http://scorbs.com/2008/07/17/flickrviewr-using-devdaves-animatingwrappanel/"><u>FlickrViewr Using DevDave’s AnimatingWrapPanel </u></a></dt><dd>Filed under "when do people find the time...", Karen Corby reacted to Dave Relyea's post and updated her FlickrViewr again, using Dave's Animatable WrapPanel ... how cool is that?? </dd></dl><br />
<font color="#0000ff"><strong>Stay in the 'Light!</strong></font><br />
<hr width="50%" />
<a href="http://twitter.com/SilverlightNews"><u>Twitter SLNews</u></a> | <a href="http://tech.groups.yahoo.com/group/SilverlightCream/join"><u>Join me @ SilverlightCream</u></a> | <a href="http://www.wynapse.com/TagContent.aspx?Tag=Silverlight"><u>SL Web Articles</u></a> | <a href="http://www.wynapse.com/TagContent.aspx?Tag=Silverlight2"><u>SL2 Web Articles</u></a> | <a href="http://www.wynapse.com/Silverlight.aspx"><u>My Articles</u></a> | <a href="http://www.wynapse.com/Silverlight_Tutorials.aspx"><u>My Tutorials</u></a> | <a href="http://www.wynapse.com/Silverlight_Tooltips.aspx"><u>My Tooltips</u></a> | <a href="http://www.wynapse.com/Silverlight2.aspx"><u>My SL2 Articles</u></a> | <a href="http://www.wynapse.com/Silverlight2_Tooltips.aspx"><u>My SL2 ToolTips</u></a> | <a href="http://www.silverlightcream.com"><u>SilverlightCream</u></a><br />
</font><p><a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=123868"><img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=123868"></a></p>

<a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;Task=Click&amp;Mode=HTML&amp;SiteID=1&amp;PageID=31016">
<img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;Task=Get&amp;Mode=HTML&amp;SiteID=1&amp;PageID=31016" width="1" height="1" border="0" alt=""></a>


<img src="http://geekswithblogs.net/WynApseTechnicalMusings/aggbug/123868.aspx" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://geekswithblogs.net/WynApseTechnicalMusings/archive/2008/07/17/123868.aspx/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Animating Brushes with ObjectAnimationUsingKeyFrames</title>
		<link>http://wildermuth.com/2008/07/18/Animating_Brushes_with_ObjectAnimationUsingKeyFrames</link>
		<comments>http://wildermuth.com/2008/07/18/Animating_Brushes_with_ObjectAnimationUsingKeyFrames#comments</comments>
		<pubDate>Fri, 18 Jul 2008 03:51:46 +0000</pubDate>
		<dc:creator>Shawn Wildermuth</dc:creator>
		
		<category><![CDATA[silverlighters.org (Syndicated Content)]]></category>

		<guid isPermaLink="false">http://wildermuth.com/2008/07/18/Animating_Brushes_with_ObjectAnimationUsingKeyFrames</guid>
		<description><![CDATA[<div><strong>URL</strong>: <a href='http://wildermuth.com/downloads/StateBrushes.zip'>http://wildermuth.com/downloads/StateBrushes.zip</a></div><br /><A href="http://www.silverlight-tour.com"><IMG alt="Silverlight Logo" src="http://wildermuth.com/images/silverlightlogo100.jpg"></A> 
<P>In my recent class I had a student ask me about animating a brush. I quickly dove into how to animation a *color* in a brush and he indicated that isn't what he wanted.&#160; He had a resource-based brush that he wanted to switch out in the Visual State Manager.&#160; In Blend when he was setting the Brush during the animation recording of the MouseOver event but that wasn't creating a storyboard but changing the natural brush of the control. To solve this we had to dive into the <a href='http://msdn2.microsoft.com/en-us/library/ms752059.aspx'>XAML</a> as Blend doesn't seem to know about the <STRONG>ObjectAnimationUsingKeyFrames</STRONG> animation type.</P>
<P>First a small discussion about animations.&#160; Normally animations will take a value and transition between the values.&#160; For example a <STRONG>DoubleAnimation </STRONG>that is set up to change the Opacity of a visual element from zero to one, will interpolate the values to create a smooth transition from invisible to visible. Keyframed animations support several types of interpolation including linear (the default), spline and discrete.&#160; Linear keyframes simply create a smooth transition between values.&#160; Spline keyframes allow you to shape the interpolation between the values to ease-in or ease-out the transition.&#160; Lastly, the Discrete keyframes set a value at the time of the keyframe without any interpolation. </P>
<P>The <STRONG>ObjectAnimationUsingKeyFrames </STRONG>animation allows you to use object instead of primitive values for your animation keyframes. The only type of keyframe allowed in the <STRONG>ObjectAnimationUsingKeyFrames </STRONG>animation are Discrete keyframes.&#160; The reason is that there is no good way to interpolate between object values. So back to our original problem, animation a Brush.&#160; In the <STRONG>MouseOver</STRONG> state, the student wanted to change the Fill of a rectangle from one resource-based Brush to another.&#160; For example, here are the brushes defined in the Resources section:</P><PRE>&#60;UserControl.Resources&#62;
  &#60;LinearGradientBrush x:Key="<STRONG>backBrush</STRONG>"
                       EndPoint="0.5,1"
                       StartPoint="0.5,0"&#62;
    &#60;GradientStop Color="#FFFF0000" /&#62;
    &#60;GradientStop Color="#FFE50000"
                  Offset="1" /&#62;
  &#60;/LinearGradientBrush&#62;
  &#60;LinearGradientBrush x:Key="<STRONG>mouseOverBackBrush</STRONG>"
                       EndPoint="0.5,1"
                       StartPoint="0.5,0"&#62;
    &#60;GradientStop Color="#FF006DFF" /&#62;
    &#60;GradientStop Color="#FF0064E9"
                  Offset="1" /&#62;
  &#60;/LinearGradientBrush&#62;
  
  ...</PRE>
<P>The student had set the <STRONG>backBrush</STRONG> to the Rectangle's fill during the design phase and wanted to set the <STRONG>mouseOverBackBrush</STRONG> during the Visual State Manager's <STRONG>MouseOver</STRONG> state. Since Blend wouldn't let us do it, we had to write the <STRONG>ObjectAnimationUsingKeyFrames</STRONG> <a href='http://msdn2.microsoft.com/en-us/library/ms752059.aspx'>XAML</a> ourselves.</P>
<P>To do this, we created a <STRONG>Storyboard</STRONG> and an <STRONG>ObjectAnimationUsingKeyFrames</STRONG> element inside the <STRONG>MouseOver</STRONG> state (of the Visual State Manager for our Button's <STRONG>ControlTemplate</STRONG>).&#160; In the new element we specified the Storyboard.<STRONG>TargetName</STRONG> and <STRONG>Storyboard</STRONG>.<STRONG>TargetProperty</STRONG> to "<STRONG>theBack</STRONG>" and "<STRONG>Fill</STRONG>". Inside the animation, we created a DiscreteObjectKeyFrame for our one value.&#160; We just wanted to change it to the since new brush so we only needed one.&#160; We set the <STRONG>Keytime</STRONG> to "0:0:0" to specify that this should happen immediately. &#160;Lastly, we specified the <STRONG>StaticResource</STRONG> for the <STRONG>mouseOverBackBrush</STRONG> as the <STRONG>Value</STRONG>. Here's the entire MouseOver state XAML:</P><PRE>...
&#60;VisualState x:Name="MouseOver"&#62;
  &#60;Storyboard&#62;
    &#60;ObjectAnimationUsingKeyFrames Storyboard.TargetName="theBack"
                                   Storyboard.TargetProperty="Fill"&#62;
      &#60;DiscreteObjectKeyFrame KeyTime="0:0:0"
                              Value="{StaticResource mouseOverBackBrush}" /&#62;
    &#60;/ObjectAnimationUsingKeyFrames&#62;
  &#60;/Storyboard&#62;
&#60;/VisualState&#62;
...</PRE>
<P>We didn't need to specify another animation in the Normal state the Visual State Manager automatically handles the resetting of our value back to the original state. It just works.&#160; Here's two pictures of the button before and after the mouse over:</P>
<P><IMG src="http://wildermuth.com/images/brushanifig1.png"><IMG src="http://wildermuth.com/images/brushanifig2.png"></P>
<P>You can download the example <A href="http://wildermuth.com/downloads/statebrushes.zip">here</A>.</P><p>&#169; 2008 Shawn Wildermuth. All Rights Reserved.<br /><a href='http://wildermuth.com/2008/07/18/Animating_Brushes_with_ObjectAnimationUsingKeyFrames'>Add Comment</a> &#124; <a href='http://digg.com/submit?phase=2&#38;url=http%3a%2f%2fwildermuth.com%2f2008%2f07%2f18%2fAnimating_Brushes_with_ObjectAnimationUsingKeyFrames&#38;title=Animating+Brushes+with+ObjectAnimationUsingKeyFrames'>digg this</a></p><div></div>
<p><a href="http://feeds.feedburner.com/~a/ShawnWildermuth?a=2epKEC"><img src="http://feeds.feedburner.com/~a/ShawnWildermuth?i=2epKEC" border="0"></img></a></p><img src="http://feeds.feedburner.com/~r/ShawnWildermuth/~4/338840293" height="1">]]></description>
			<content:encoded><![CDATA[<div><strong>URL</strong>: <a href='http://wildermuth.com/downloads/StateBrushes.zip'>http://wildermuth.com/downloads/StateBrushes.zip</a></div><br><A href="http://www.silverlight-tour.com"><IMG alt="Silverlight Logo" src="http://wildermuth.com/images/silverlightlogo100.jpg"></A> 
<P>In my recent class I had a student ask me about animating a brush. I quickly dove into how to animation a *color* in a brush and he indicated that isn't what he wanted.&nbsp; He had a resource-based brush that he wanted to switch out in the Visual State Manager.&nbsp; In Blend when he was setting the Brush during the animation recording of the MouseOver event but that wasn't creating a storyboard but changing the natural brush of the control. To solve this we had to dive into the <a href='http://msdn2.microsoft.com/en-us/library/ms752059.aspx'>XAML</a> as Blend doesn't seem to know about the <STRONG>ObjectAnimationUsingKeyFrames</STRONG> animation type.</P>
<P>First a small discussion about animations.&nbsp; Normally animations will take a value and transition between the values.&nbsp; For example a <STRONG>DoubleAnimation </STRONG>that is set up to change the Opacity of a visual element from zero to one, will interpolate the values to create a smooth transition from invisible to visible. Keyframed animations support several types of interpolation including linear (the default), spline and discrete.&nbsp; Linear keyframes simply create a smooth transition between values.&nbsp; Spline keyframes allow you to shape the interpolation between the values to ease-in or ease-out the transition.&nbsp; Lastly, the Discrete keyframes set a value at the time of the keyframe without any interpolation. </P>
<P>The <STRONG>ObjectAnimationUsingKeyFrames </STRONG>animation allows you to use object instead of primitive values for your animation keyframes. The only type of keyframe allowed in the <STRONG>ObjectAnimationUsingKeyFrames </STRONG>animation are Discrete keyframes.&nbsp; The reason is that there is no good way to interpolate between object values. So back to our original problem, animation a Brush.&nbsp; In the <STRONG>MouseOver</STRONG> state, the student wanted to change the Fill of a rectangle from one resource-based Brush to another.&nbsp; For example, here are the brushes defined in the Resources section:</P><PRE>&lt;UserControl.Resources&gt;
  &lt;LinearGradientBrush x:Key="<STRONG>backBrush</STRONG>"
                       EndPoint="0.5,1"
                       StartPoint="0.5,0"&gt;
    &lt;GradientStop Color="#FFFF0000" /&gt;
    &lt;GradientStop Color="#FFE50000"
                  Offset="1" /&gt;
  &lt;/LinearGradientBrush&gt;
  &lt;LinearGradientBrush x:Key="<STRONG>mouseOverBackBrush</STRONG>"
                       EndPoint="0.5,1"
                       StartPoint="0.5,0"&gt;
    &lt;GradientStop Color="#FF006DFF" /&gt;
    &lt;GradientStop Color="#FF0064E9"
                  Offset="1" /&gt;
  &lt;/LinearGradientBrush&gt;
  
  ...</PRE>
<P>The student had set the <STRONG>backBrush</STRONG> to the Rectangle's fill during the design phase and wanted to set the <STRONG>mouseOverBackBrush</STRONG> during the Visual State Manager's <STRONG>MouseOver</STRONG> state. Since Blend wouldn't let us do it, we had to write the <STRONG>ObjectAnimationUsingKeyFrames</STRONG> <a href='http://msdn2.microsoft.com/en-us/library/ms752059.aspx'>XAML</a> ourselves.</P>
<P>To do this, we created a <STRONG>Storyboard</STRONG> and an <STRONG>ObjectAnimationUsingKeyFrames</STRONG> element inside the <STRONG>MouseOver</STRONG> state (of the Visual State Manager for our Button's <STRONG>ControlTemplate</STRONG>).&nbsp; In the new element we specified the Storyboard.<STRONG>TargetName</STRONG> and <STRONG>Storyboard</STRONG>.<STRONG>TargetProperty</STRONG> to "<STRONG>theBack</STRONG>" and "<STRONG>Fill</STRONG>". Inside the animation, we created a DiscreteObjectKeyFrame for our one value.&nbsp; We just wanted to change it to the since new brush so we only needed one.&nbsp; We set the <STRONG>Keytime</STRONG> to "0:0:0" to specify that this should happen immediately. &nbsp;Lastly, we specified the <STRONG>StaticResource</STRONG> for the <STRONG>mouseOverBackBrush</STRONG> as the <STRONG>Value</STRONG>. Here's the entire MouseOver state XAML:</P><PRE>...
&lt;VisualState x:Name="MouseOver"&gt;
  &lt;Storyboard&gt;
    &lt;ObjectAnimationUsingKeyFrames Storyboard.TargetName="theBack"
                                   Storyboard.TargetProperty="Fill"&gt;
      &lt;DiscreteObjectKeyFrame KeyTime="0:0:0"
                              Value="{StaticResource mouseOverBackBrush}" /&gt;
    &lt;/ObjectAnimationUsingKeyFrames&gt;
  &lt;/Storyboard&gt;
&lt;/VisualState&gt;
...</PRE>
<P>We didn't need to specify another animation in the Normal state the Visual State Manager automatically handles the resetting of our value back to the original state. It just works.&nbsp; Here's two pictures of the button before and after the mouse over:</P>
<P><IMG src="http://wildermuth.com/images/brushanifig1.png"><IMG src="http://wildermuth.com/images/brushanifig2.png"></P>
<P>You can download the example <A href="http://wildermuth.com/downloads/statebrushes.zip">here</A>.</P><p>&copy; 2008 Shawn Wildermuth. All Rights Reserved.<br><a href='http://wildermuth.com/2008/07/18/Animating_Brushes_with_ObjectAnimationUsingKeyFrames'>Add Comment</a> | <a href='http://digg.com/submit?phase=2&amp;url=http%3a%2f%2fwildermuth.com%2f2008%2f07%2f18%2fAnimating_Brushes_with_ObjectAnimationUsingKeyFrames&amp;title=Animating+Brushes+with+ObjectAnimationUsingKeyFrames'>digg this</a></p><div></div>
<p><a href="http://feeds.feedburner.com/~a/ShawnWildermuth?a=2epKEC"><img src="http://feeds.feedburner.com/~a/ShawnWildermuth?i=2epKEC" border="0"></img></a></p><img src="http://feeds.feedburner.com/~r/ShawnWildermuth/~4/338840293" height="1">]]></content:encoded>
			<wfw:commentRss>http://wildermuth.com/2008/07/18/Animating_Brushes_with_ObjectAnimationUsingKeyFrames/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Three New Videos On Data Binding</title>
		<link>http://feeds.feedburner.com/~r/JesseLiberty-SilverlightGeek/~3/338584367/three-new-videos-on-data-binding.aspx</link>
		<comments>http://feeds.feedburner.com/~r/JesseLiberty-SilverlightGeek/~3/338584367/three-new-videos-on-data-binding.aspx#comments</comments>
		<pubDate>Fri, 18 Jul 2008 01:47:00 +0000</pubDate>
		<dc:creator>jesseliberty</dc:creator>
		
		<category><![CDATA[silverlighters.org (Syndicated Content)]]></category>

		<guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:72342</guid>
		<description><![CDATA[<p>I’m pleased to announce that we’ve posted three new videos on DataBinding and on DataTemplates (creating templates that control the display of a collection of data in a list control such as a list box)</p>
<p><a href="http://silverlight.net/blogs/jesseliberty/WindowsLiveWriter/3NewVideosOnDataBinding_1309B/ThreeDataVids_2.jpg"><img height="232" alt="ThreeDataVids" src="http://silverlight.net/blogs/jesseliberty/WindowsLiveWriter/3NewVideosOnDataBinding_1309B/ThreeDataVids_thumb.jpg" width="529" border="0" /></a> </p>
<p>Unfortunately, we swapped the images for the Blend video and the Xaml video which is a bit confusing but we’ll get that fixed. And, while the three videos do stand alone, watching them in the order 37 –&#62;39 -&#62; 38 will make a good bit more sense &#60;smile&#62;.</p>
<p>In any case, I hope you find them interesting and useful. The first, An Overview… explains the fundamental concepts of DataBinding and ListTemplates. The “second”, <em>DataBinding and DataTemplates in Xaml</em> shows how to bind the properties of business objects to Silverlight controls in Xaml and how to create DataTemplates by hand. </p>
<p>Finally, the “third”, <em>DataBidning and DataTemplates With Expression Blend</em> recreates that same work using Expresion Blend (and note that it is 9 minutes vs. 22!). </p><img src="http://silverlight.net/aggbug.aspx?PostID=72342" width="1" height="1"><div>
<a href="http://feeds.feedburner.com/~f/JesseLiberty-SilverlightGeek?a=PuhVEJ"><img src="http://feeds.feedburner.com/~f/JesseLiberty-SilverlightGeek?i=PuhVEJ" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/JesseLiberty-SilverlightGeek?a=nxpu6J"><img src="http://feeds.feedburner.com/~f/JesseLiberty-SilverlightGeek?i=nxpu6J" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/JesseLiberty-SilverlightGeek?a=1KoJlj"><img src="http://feeds.feedburner.com/~f/JesseLiberty-SilverlightGeek?i=1KoJlj" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/JesseLiberty-SilverlightGeek?a=UWJZij"><img src="http://feeds.feedburner.com/~f/JesseLiberty-SilverlightGeek?i=UWJZij" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/JesseLiberty-SilverlightGeek?a=EJ91mJ"><img src="http://feeds.feedburner.com/~f/JesseLiberty-SilverlightGeek?i=EJ91mJ" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/JesseLiberty-SilverlightGeek?a=hkDRZj"><img src="http://feeds.feedburner.com/~f/JesseLiberty-SilverlightGeek?i=hkDRZj" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/JesseLiberty-SilverlightGeek/~4/338584367" height="1">]]></description>
			<content:encoded><![CDATA[<p>I’m pleased to announce that we’ve posted three new videos on DataBinding and on DataTemplates (creating templates that control the display of a collection of data in a list control such as a list box)</p>
<p><a href="http://silverlight.net/blogs/jesseliberty/WindowsLiveWriter/3NewVideosOnDataBinding_1309B/ThreeDataVids_2.jpg"><img height="232" alt="ThreeDataVids" src="http://silverlight.net/blogs/jesseliberty/WindowsLiveWriter/3NewVideosOnDataBinding_1309B/ThreeDataVids_thumb.jpg" width="529" border="0" /></a> </p>
<p>Unfortunately, we swapped the images for the Blend video and the Xaml video which is a bit confusing but we’ll get that fixed. And, while the three videos do stand alone, watching them in the order 37 –&gt;39 -&gt; 38 will make a good bit more sense &lt;smile&gt;.</p>
<p>In any case, I hope you find them interesting and useful. The first, An Overview… explains the fundamental concepts of DataBinding and ListTemplates. The “second”, <em>DataBinding and DataTemplates in Xaml</em> shows how to bind the properties of business objects to Silverlight controls in Xaml and how to create DataTemplates by hand. </p>
<p>Finally, the “third”, <em>DataBidning and DataTemplates With Expression Blend</em> recreates that same work using Expresion Blend (and note that it is 9 minutes vs. 22!). </p><img src="http://silverlight.net/aggbug.aspx?PostID=72342" width="1" height="1"><div>
<a href="http://feeds.feedburner.com/~f/JesseLiberty-SilverlightGeek?a=PuhVEJ"><img src="http://feeds.feedburner.com/~f/JesseLiberty-SilverlightGeek?i=PuhVEJ" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/JesseLiberty-SilverlightGeek?a=nxpu6J"><img src="http://feeds.feedburner.com/~f/JesseLiberty-SilverlightGeek?i=nxpu6J" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/JesseLiberty-SilverlightGeek?a=1KoJlj"><img src="http://feeds.feedburner.com/~f/JesseLiberty-SilverlightGeek?i=1KoJlj" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/JesseLiberty-SilverlightGeek?a=UWJZij"><img src="http://feeds.feedburner.com/~f/JesseLiberty-SilverlightGeek?i=UWJZij" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/JesseLiberty-SilverlightGeek?a=EJ91mJ"><img src="http://feeds.feedburner.com/~f/JesseLiberty-SilverlightGeek?i=EJ91mJ" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/JesseLiberty-SilverlightGeek?a=hkDRZj"><img src="http://feeds.feedburner.com/~f/JesseLiberty-SilverlightGeek?i=hkDRZj" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/JesseLiberty-SilverlightGeek/~4/338584367" height="1">]]></content:encoded>
			<wfw:commentRss>http://feeds.feedburner.com/~r/JesseLiberty-SilverlightGeek/~3/338584367/three-new-videos-on-data-binding.aspx/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Silverlight Cream for July 17, 2008 &#8212; #327</title>
		<link>http://geekswithblogs.net/WynApseTechnicalMusings/archive/2008/07/17/123857.aspx</link>
		<comments>http://geekswithblogs.net/WynApseTechnicalMusings/archive/2008/07/17/123857.aspx#comments</comments>
		<pubDate>Thu, 17 Jul 2008 18:31:31 +0000</pubDate>
		<dc:creator>Dave Campbell</dc:creator>
		
		<category><![CDATA[silverlighters.org (Syndicated Content)]]></category>

		<guid isPermaLink="false">http://geekswithblogs.net/WynApseTechnicalMusings/archive/2008/07/17/123857.aspx</guid>
		<description><![CDATA[<font face="tahoma">Denislav Savkov on VSM, Mino with a SL PhotoGallery, Alex Golesh on app performance, Avi Pilosof with "War on Terrier", Michael Schwarz reports SL2B2 update, Alex Knight on VSM, Peter McGrattan on initialization via SL server control, Lee on DataGrids and ListBoxes, and David Anson on shrinking XAPs. <br />
<br />
Open notice to <strong>Tim Heuer</strong>, <strong>Brad Abrams</strong>, and <strong>Karen Corby</strong> just to name a few ... you should send email to xclusivesalman at yahoo dot com (Mashook Talpur - 26-167 cantt bazar, Karachi Sind, Pakistan) because he's directly stealing your work on silverlightarticles dot com ... aggregators <strong>please</strong> pay attention to who is getting credit on your site! <hr width="50%" />
From <a href="http://www.silverlightcream.com"><u>SilverlightCream.com</u></a>: <dl><dt><a href="http://www.silverlightshow.net/items/Custom-ContentControl-using-VisualStateManager.aspx"><u>Custom ContentControl using VisualStateManager </u></a></dt><dd>Denislav Savkov has a great tutorial on creating a control using VSM and Parts/States ... anyone not yet working on something for the <a href="http://gosilverlight.org/Default.aspx"><u>ControlBuilder Contest</u></a>... pay attention and read this! </dd><dt><a href="http://www.silverlight-blog.it/ontheroad/photogallery/index.html"><u>Silverlight PhotoGallery </u></a></dt><dd>Mino has a xap that you can use directly to put a PhotoGallery on your site ... with sample xml file for the pictures, and instructions for modifying to use your pictures. </dd><dt><a href="http://blogs.microsoft.co.il/blogs/alex_golesh/archive/2008/07/17/silverlight-application-performance-refresh-rate-amp-cpu-usage.aspx"><u>Silverlight application performance - refresh rate &#38; CPU usage </u></a></dt><dd>Alex Golesh has another blog post up, this one on performance and refresh rate in SL apps. He has some good examples and tips on how to improve things... </dd><dt><a href="http://blogs.msdn.com/avip/archive/2008/07/17/the-global-war-on-terrier.aspx"><u>[The Global] War On Terrier </u></a></dt><dd>Avi Pilosof posted to me, and I've added him to the list of bloggers. The first one from him is a game that if you're not interested in the game, hey... he's providing all the code, guys!! ... plus he's got a bunch of other goodness on his site that I'll try to catch up with, but you can go look at as well! </dd><dt><a href="http://weblogs.asp.net/mschwarz/archive/2008/07/17/silverlight-2-beta-2-update-kb955011.aspx"><u>Silverlight 2 Beta 2 Update - kb955011 </u></a></dt><dd>When I saw this the first time this morning, I thought it was a post from Scott Guthrie, but it was Michael Schwarz blogging about a SL2B2 update ... good to see that, Michael, and everyone should read the info and check out the links he provided. </dd><dt><a href="http://agkdesign.wordpress.com/2008/07/16/visual-state-manager-how-to/"><u>Visual State Manager - How to: </u></a></dt><dd>Alex Knight has a VSM "How To" post on his blog... he's got some Blend screenshots, and discussion is centered around a very nice demo that seems to be Alex' trademark... good info and great demo! </dd><dt><a href="http://petermcg.wordpress.com/2008/07/16/silverlight-initialization-via-the-silverlight-server-control/"><u>Silverlight Initialization via the ASP.NET Silverlight Server Control </u></a></dt><dd>I thought I'd posted this one from Peter McGrattan, but alas, I had not... Peter has a discussion of what the heck gets added to your page when the server control kicks in ... definitely things you want to be aware of. </dd><dt><a href="http://leeontech.wordpress.com/2008/07/15/customizing-itemcontainerstyle-in-listbox/"><u>Customizing ListBoxItem template in ListBox </u></a></dt><dd>This post from Lee is another I thought I'd already posted. He's out there splashing around in VSM and changing the LisBoxItem template... very cool! </dd><dt><a href="http://leeontech.wordpress.com/2008/07/17/verticalalignment-of-header-in-datagrid/"><u>VerticalAlignment of header in DataGrid </u></a></dt><dd>In the latest post from Lee, he figures out a (long) way to align header info with the bottom of the header... lots of code... but good! </dd><dt><a href="http://blogs.msdn.com/delay/archive/2008/07/16/smaller-is-better-a-simple-step-to-shrink-the-download-size-of-silverlight-2-applications.aspx"><u>A simple step to shrink the download size of Silverlight 2 applications </u></a></dt><dd>David Anson took a hard look at the xap, and thought he could do a better job of compression. Not only has he, but he's provided a way for all of us to do so as well! ... can you say 22% savings?? </dd></dl><br />
<font color="#0000ff"><strong>Stay in the 'Light!</strong></font><br />
<hr width="50%" />
<a href="http://twitter.com/SilverlightNews"><u>Twitter SLNews</u></a> &#124; <a href="http://tech.groups.yahoo.com/group/SilverlightCream/join"><u>Join me @ SilverlightCream</u></a> &#124; <a href="http://www.wynapse.com/TagContent.aspx?Tag=Silverlight"><u>SL Web Articles</u></a> &#124; <a href="http://www.wynapse.com/TagContent.aspx?Tag=Silverlight2"><u>SL2 Web Articles</u></a> &#124; <a href="http://www.wynapse.com/Silverlight.aspx"><u>My Articles</u></a> &#124; <a href="http://www.wynapse.com/Silverlight_Tutorials.aspx"><u>My Tutorials</u></a> &#124; <a href="http://www.wynapse.com/Silverlight_Tooltips.aspx"><u>My Tooltips</u></a> &#124; <a href="http://www.wynapse.com/Silverlight2.aspx"><u>My SL2 Articles</u></a> &#124; <a href="http://www.wynapse.com/Silverlight2_Tooltips.aspx"><u>My SL2 ToolTips</u></a> &#124; <a href="http://www.silverlightcream.com"><u>SilverlightCream</u></a><br />
</font><p><a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&#38;u=123857"><img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&#38;u=123857"></a></p>

<a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&#38;Task=Click&#38;Mode=HTML&#38;SiteID=1&#38;PageID=31016">
<img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&#38;Task=Get&#38;Mode=HTML&#38;SiteID=1&#38;PageID=31016" width="1" height="1" border="0" alt=""></a>


<img src="http://geekswithblogs.net/WynApseTechnicalMusings/aggbug/123857.aspx" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<font face="tahoma">Denislav Savkov on VSM, Mino with a SL PhotoGallery, Alex Golesh on app performance, Avi Pilosof with "War on Terrier", Michael Schwarz reports SL2B2 update, Alex Knight on VSM, Peter McGrattan on initialization via SL server control, Lee on DataGrids and ListBoxes, and David Anson on shrinking XAPs. <br />
<br />
Open notice to <strong>Tim Heuer</strong>, <strong>Brad Abrams</strong>, and <strong>Karen Corby</strong> just to name a few ... you should send email to xclusivesalman at yahoo dot com (Mashook Talpur - 26-167 cantt bazar, Karachi Sind, Pakistan) because he's directly stealing your work on silverlightarticles dot com ... aggregators <strong>please</strong> pay attention to who is getting credit on your site! <hr width="50%" />
From <a href="http://www.silverlightcream.com"><u>SilverlightCream.com</u></a>: <dl><dt><a href="http://www.silverlightshow.net/items/Custom-ContentControl-using-VisualStateManager.aspx"><u>Custom ContentControl using VisualStateManager </u></a></dt><dd>Denislav Savkov has a great tutorial on creating a control using VSM and Parts/States ... anyone not yet working on something for the <a href="http://gosilverlight.org/Default.aspx"><u>ControlBuilder Contest</u></a>... pay attention and read this! </dd><dt><a href="http://www.silverlight-blog.it/ontheroad/photogallery/index.html"><u>Silverlight PhotoGallery </u></a></dt><dd>Mino has a xap that you can use directly to put a PhotoGallery on your site ... with sample xml file for the pictures, and instructions for modifying to use your pictures. </dd><dt><a href="http://blogs.microsoft.co.il/blogs/alex_golesh/archive/2008/07/17/silverlight-application-performance-refresh-rate-amp-cpu-usage.aspx"><u>Silverlight application performance - refresh rate &amp; CPU usage </u></a></dt><dd>Alex Golesh has another blog post up, this one on performance and refresh rate in SL apps. He has some good examples and tips on how to improve things... </dd><dt><a href="http://blogs.msdn.com/avip/archive/2008/07/17/the-global-war-on-terrier.aspx"><u>[The Global] War On Terrier </u></a></dt><dd>Avi Pilosof posted to me, and I've added him to the list of bloggers. The first one from him is a game that if you're not interested in the game, hey... he's providing all the code, guys!! ... plus he's got a bunch of other goodness on his site that I'll try to catch up with, but you can go look at as well! </dd><dt><a href="http://weblogs.asp.net/mschwarz/archive/2008/07/17/silverlight-2-beta-2-update-kb955011.aspx"><u>Silverlight 2 Beta 2 Update - kb955011 </u></a></dt><dd>When I saw this the first time this morning, I thought it was a post from Scott Guthrie, but it was Michael Schwarz blogging about a SL2B2 update ... good to see that, Michael, and everyone should read the info and check out the links he provided. </dd><dt><a href="http://agkdesign.wordpress.com/2008/07/16/visual-state-manager-how-to/"><u>Visual State Manager - How to: </u></a></dt><dd>Alex Knight has a VSM "How To" post on his blog... he's got some Blend screenshots, and discussion is centered around a very nice demo that seems to be Alex' trademark... good info and great demo! </dd><dt><a href="http://petermcg.wordpress.com/2008/07/16/silverlight-initialization-via-the-silverlight-server-control/"><u>Silverlight Initialization via the ASP.NET Silverlight Server Control </u></a></dt><dd>I thought I'd posted this one from Peter McGrattan, but alas, I had not... Peter has a discussion of what the heck gets added to your page when the server control kicks in ... definitely things you want to be aware of. </dd><dt><a href="http://leeontech.wordpress.com/2008/07/15/customizing-itemcontainerstyle-in-listbox/"><u>Customizing ListBoxItem template in ListBox </u></a></dt><dd>This post from Lee is another I thought I'd already posted. He's out there splashing around in VSM and changing the LisBoxItem template... very cool! </dd><dt><a href="http://leeontech.wordpress.com/2008/07/17/verticalalignment-of-header-in-datagrid/"><u>VerticalAlignment of header in DataGrid </u></a></dt><dd>In the latest post from Lee, he figures out a (long) way to align header info with the bottom of the header... lots of code... but good! </dd><dt><a href="http://blogs.msdn.com/delay/archive/2008/07/16/smaller-is-better-a-simple-step-to-shrink-the-download-size-of-silverlight-2-applications.aspx"><u>A simple step to shrink the download size of Silverlight 2 applications </u></a></dt><dd>David Anson took a hard look at the xap, and thought he could do a better job of compression. Not only has he, but he's provided a way for all of us to do so as well! ... can you say 22% savings?? </dd></dl><br />
<font color="#0000ff"><strong>Stay in the 'Light!</strong></font><br />
<hr width="50%" />
<a href="http://twitter.com/SilverlightNews"><u>Twitter SLNews</u></a> | <a href="http://tech.groups.yahoo.com/group/SilverlightCream/join"><u>Join me @ SilverlightCream</u></a> | <a href="http://www.wynapse.com/TagContent.aspx?Tag=Silverlight"><u>SL Web Articles</u></a> | <a href="http://www.wynapse.com/TagContent.aspx?Tag=Silverlight2"><u>SL2 Web Articles</u></a> | <a href="http://www.wynapse.com/Silverlight.aspx"><u>My Articles</u></a> | <a href="http://www.wynapse.com/Silverlight_Tutorials.aspx"><u>My Tutorials</u></a> | <a href="http://www.wynapse.com/Silverlight_Tooltips.aspx"><u>My Tooltips</u></a> | <a href="http://www.wynapse.com/Silverlight2.aspx"><u>My SL2 Articles</u></a> | <a href="http://www.wynapse.com/Silverlight2_Tooltips.aspx"><u>My SL2 ToolTips</u></a> | <a href="http://www.silverlightcream.com"><u>SilverlightCream</u></a><br />
</font><p><a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=123857"><img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=123857"></a></p>

<a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;Task=Click&amp;Mode=HTML&amp;SiteID=1&amp;PageID=31016">
<img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;Task=Get&amp;Mode=HTML&amp;SiteID=1&amp;PageID=31016" width="1" height="1" border="0" alt=""></a>


<img src="http://geekswithblogs.net/WynApseTechnicalMusings/aggbug/123857.aspx" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://geekswithblogs.net/WynApseTechnicalMusings/archive/2008/07/17/123857.aspx/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Layout Transitions - An Animatable WrapPanel</title>
		<link>http://blogs.msdn.com/devdave/archive/2008/07/17/layout-transitions-an-animatable-wrappanel.aspx</link>
		<comments>http://blogs.msdn.com/devdave/archive/2008/07/17/layout-transitions-an-animatable-wrappanel.aspx#comments</comments>
		<pubDate>Thu, 17 Jul 2008 15:37:00 +0000</pubDate>
		<dc:creator>Dave Relyea</dc:creator>
		
		<category><![CDATA[silverlighters.org (Syndicated Content)]]></category>

		<guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8742093</guid>
		<description><![CDATA[<P>&#160;<A href="http://blogs.msdn.com/photos/devdave/images/8742079/original.aspx"><IMG src="http://blogs.msdn.com/photos/devdave/images/8742079/500x316.aspx" border="0"></A><A href="http://blogs.msdn.com/photos/devdave/picture8742079.aspx"></A></P>
<P>I've been playing around with RenderTransforms and decorators and such to make layout transitions,&#160;but for this WrapPanel, my goal was to introduce no additional UI elements, animations&#160;or transforms. I also wanted to use some easing equations to do some cool transitions, and separate that logic from the WrapPanel. I wanted the elements the be "live" while they were on the screen, and I wanted them to enter the screen in a nice fashion. I also wanted each element to animate individually. One of my earlier versions of this kept track of a single starting time for all animations, and it wasn't cool enough. Sometimes, it is important to be cool.</P>
<P><STRONG>WrapPanels</STRONG></P>
<P>A WrapPanel is a layout container that places its&#160;elements&#160;in rows. It fills up one row, then moves on to the next one. The logic isn't all that tough. What I wanted to do was to make the items move smoothly when the WrapPanel was resized, and also enter the WrapPanel from the upper left and move to their new position.</P>
<P>Below are some of the interesting bits of the panel.</P>
<P><STRONG>Using a zero-duration Storyboard to simulate a per-frame callback</STRONG></P>
<P>Not using animations was one of my requirements, since I wanted to use something other than linear interpolation. The AnimateableWrapPanel uses a zero-duration Storyboard to simulate a per-frame callback.&#160;Here's how that is done. In the constructor,&#160;an empty&#160;Storyboard is created and started.</P>
<P>public AnimatedWrapPanel()</P>
<P>{</P>
<P>&#160;&#160;&#160; // This sets up the per-frame callback that we use for animation.</P>
<P>&#160;</P>
<P>&#160;&#160;&#160; _tick = new Storyboard();</P>
<P>&#160;&#160;&#160; _tick.Duration = new Duration(TimeSpan.Zero);</P>
<P>&#160;&#160;&#160; _tick.Completed += Tick;</P>
<P>&#160;&#160;&#160; _tick.Begin();</P>
<P>}</P>
<P>The Tick method&#160;does whatever I want to do each frame, and restarts the Storyboard.</P>
<P>/// &#60;summary&#62;</P>
<P>/// This tells the layout system to call Arrange on the Panel if there are any elements that</P>
<P>/// must be moved.</P>
<P>/// &#60;/summary&#62;</P>
<P>private void Tick(object sender, EventArgs e)</P>
<P>{</P>
<P>&#160;&#160;&#160; // If there are still elements to be animated, make sure that ArrangeOverride will</P>
<P>&#160;&#160;&#160; // get called. Note that the InvalidateArrange may already have been called due to</P>
<P>&#160;&#160;&#160; // other operations, but calling it again does not hurt, and all of the work will</P>
<P>&#160;&#160;&#160; // be done in ArrangeOverride regardless of where the invalidation came from.</P>
<P>&#160;</P>
<P>&#160;&#160;&#160; if (_animatingElements &#62; 0)</P>
<P>&#160;&#160;&#160; {</P>
<P>&#160;&#160;&#160;&#160;&#160;&#160;&#160; InvalidateArrange();</P>
<P>&#160;&#160;&#160; }</P>
<P>&#160;</P>
<P>&#160;&#160;&#160; // Restart the storyboard so we get called back on the next frame.</P>
<P>&#160;&#160;&#160; _tick.Begin();</P>
<P>}</P>
<P>This technique does not guarantee smooth animations. It is possible to overload the panel with too many elements for the framewrate to animate 100% smoothly, or maybe the rest of the app&#160;is doing so much work that the framerate slows down,&#160;but since I use the elapsed time to figure out where to put the elements, the animations will take the same amount of time on all machines. If there is too much going on in the panel and the app, on a low-end machine, the animation might be choppy, but will still finish in the specified time, or one frame longer if the timing is just off.</P>
<P><STRONG>Using&#160;layout to "animate" the elements</STRONG></P>
<P>I'm a little conflicted about this technique, but I have seen other people use it, so I thought I'd try it. It is a two stage process. The MeasureOverride call figures out where everything should go, and is the only place where the animations are started. This works because MeasureOverride will be called if the AnimatedWrapPanel changes size, or any of its children change size, or children are added or removed. So size changes, adding items etc. kicks off the animations. In ArrangeOverride, any element that is not where it is supposed to be is moved in that direction according to how much it should be done, and the interpolations. Here's what the ArrangeOverride looks like:</P>
<P>/// &#60;summary&#62;</P>
<P>/// A "normal" ArrangeOverride would just put things where they belong. What this one does</P>
<P>/// is to move the children towards their destinations according to the virtual animation</P>
<P>/// data that has been attached to each element. When they get there, the virtual animation</P>
<P>/// is turned off.</P>
<P>/// &#60;/summary&#62;</P>
<P>protected override Size ArrangeOverride(Size finalSize)</P>
<P>{</P>
<P>&#160;&#160;&#160; DateTime now = DateTime.Now;</P>
<P>&#160;</P>
<P>&#160;&#160;&#160; foreach (UIElement child in Children)</P>
<P>&#160;&#160;&#160; {</P>
<P>&#160;&#160;&#160;&#160;&#160;&#160;&#160; AnimatedWrapPanelAttachedData data = GetAnimatedWrapPanelAttachedData(child);</P>
<P>&#160;</P>
<P>&#160;&#160;&#160;&#160;&#160;&#160;&#160; TimeSpan elapsed = data.GetElapsed(now);</P>
<P>&#160;</P>
<P>&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (elapsed &#60; Duration &#124;&#124; data.TargetPosition != data.CurrentPosition)</P>
<P>&#160;&#160;&#160;&#160;&#160;&#160;&#160; {</P>
<P>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; // The virtual animation is not done yet, so figure out how far along it is...</P>
<P>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; double progress = (Duration.TimeSpan != TimeSpan.Zero) ? Math.Min(elapsed.TotalMilliseconds / Duration.TimeSpan.TotalMilliseconds, 1.0) : 1;</P>
<P>&#160;</P>
<P>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; // ...and what the next position is.</P>
<P>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Point newPosition = BlendPoint(_interpolation, data.StartPosition, data.TargetPosition, progress);</P>
<P>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; child.Arrange(new Rect(newPosition.X, newPosition.Y, child.DesiredSize.Width, _rowHeights[data.Row]));</P>
<P>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; data.CurrentPosition = newPosition;</P>
<P>&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</P>
<P>&#160;&#160;&#160;&#160;&#160;&#160;&#160; else</P>
<P>&#160;&#160;&#160;&#160;&#160;&#160;&#160; {</P>
<P>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; // This element is not animating, but it might have become invalid on its own, so it still</P>
<P>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; // needs to be arranged. The layout system will do as little as possible.</P>
<P>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; child.Arrange(new Rect(data.CurrentPosition.X, data.CurrentPosition.Y, child.DesiredSize.Width, _rowHeights[data.Row]));</P>
<P>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (data.IsAnimating)</P>
<P>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {</P>
<P>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; --_animatingElements;</P>
<P>&#160;</P>
<P>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; // This is the only place where IsAnimating is set to false. This turns off the virtual animation.</P>
<P>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; data.IsAnimating = false;</P>
<P>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</P>
<P>&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</P>
<P>&#160;&#160;&#160; }</P>
<P>&#160;</P>
<P>&#160;&#160;&#160; return finalSize;</P>
<P>}</P>
<P><STRONG>Attached&#160;property bag</STRONG></P>
<P>Rather than have a bunch of hash tables or something in the&#160;panel itself, I wanted to keep all of the state that I needed on the elements, which sounded like a job for attached DependencyProperties. However, I got tired of creating and modifying them as I changed my mind, and decided that it would be easier at design-time and more efficient at run-time if I had a single attached property that was actually a class that had a bunch of properties--an attached property bag. This would be efficient because I always used all of the properties for each element.</P>
<P><STRONG>Interpolations using easing equations</STRONG></P>
<P>Rather then hard-coding animations into the panel, or using a simple linear interpolation, I wanted to use pluggable interpolations. The interpolations take a double that indicates progress, where zero is "just starting" and one is "completed". They return a number (alpha) where zero refers to the start position, and one refers to the end position, although the number may be less than zero or greater than one. The general equation is:</P>
<P>alpha = fn(progress)</P>
<P>The linear interpolation is the simplest: it just gives returns the progress, i.e. alpha = progress.</P>
<P>In practice, the interpolations are used to blend the starting and target positions. Here's how the intermediate points are arrived at:</P>
<P>/// &#60;summary&#62;</P>
<P>/// Given an interpolation, the starting and ending positions and a number from 0-1 that represents how</P>
<P>/// far along the virtual animation is, calculate the new position.</P>
<P>/// &#60;/summary&#62;</P>
<P>Point BlendPoint(Interpolation interpolation, Point from, Point to, double progress)</P>
<P>{</P>
<P>&#160;&#160;&#160; Point p = new Point();</P>
<P>&#160;&#160;&#160; double alpha = interpolation.GetAlpha(progress);</P>
<P>&#160;&#160;&#160; p.X = from.X + alpha * (to.X - from.X);</P>
<P>&#160;&#160;&#160; p.Y = from.Y + alpha * (to.Y - from.Y);</P>
<P>&#160;&#160;&#160; return p;</P>
<P>}</P>
<P>I used&#160;some standard interpolations, but it is possibly and easy to define your own, and then just plug them into the panel. I set up the interpolations with some default values that I thought looked nice, but it is possible to get quite creative.&#160;</P>
<P><STRONG>Using the demo app</STRONG></P>
<P>This should be pretty self-explanatory, but you can add pretty, randomly-colored Rectangles, text and image thumbnails. Clicking on a Rectangle deletes it from the panel. You can also change the size of all of the children, select the duration of the animations, and the interpolation that will be used. Resize the browser to watch the UI move around. I had wanted to have UI to modify the interpolation parameters, but at some point, you have to stop polishing and move one. Shipping is the art of stopping. So that bit of UI is left as an exercise for the developer.</P>
<P>&#160;</P>
<P>&#160;</P><img src="http://blogs.msdn.com/aggbug.aspx?PostID=8742093" width="1" height="1">]]></description>
			<content:encoded><![CDATA[<P>&nbsp;<A href="http://blogs.msdn.com/photos/devdave/images/8742079/original.aspx"><IMG src="http://blogs.msdn.com/photos/devdave/images/8742079/500x316.aspx" border="0"></A><A href="http://blogs.msdn.com/photos/devdave/picture8742079.aspx"></A></P>
<P>I've been playing around with RenderTransforms and decorators and such to make layout transitions,&nbsp;but for this WrapPanel, my goal was to introduce no additional UI elements, animations&nbsp;or transforms. I also wanted to use some easing equations to do some cool transitions, and separate that logic from the WrapPanel. I wanted the elements the be "live" while they were on the screen, and I wanted them to enter the screen in a nice fashion. I also wanted each element to animate individually. One of my earlier versions of this kept track of a single starting time for all animations, and it wasn't cool enough. Sometimes, it is important to be cool.</P>
<P><STRONG>WrapPanels</STRONG></P>
<P>A WrapPanel is a layout container that places its&nbsp;elements&nbsp;in rows. It fills up one row, then moves on to the next one. The logic isn't all that tough. What I wanted to do was to make the items move smoothly when the WrapPanel was resized, and also enter the WrapPanel from the upper left and move to their new position.</P>
<P>Below are some of the interesting bits of the panel.</P>
<P><STRONG>Using a zero-duration Storyboard to simulate a per-frame callback</STRONG></P>
<P>Not using animations was one of my requirements, since I wanted to use something other than linear interpolation. The AnimateableWrapPanel uses a zero-duration Storyboard to simulate a per-frame callback.&nbsp;Here's how that is done. In the constructor,&nbsp;an empty&nbsp;Storyboard is created and started.</P>
<P>public AnimatedWrapPanel()</P>
<P>{</P>
<P>&nbsp;&nbsp;&nbsp; // This sets up the per-frame callback that we use for animation.</P>
<P>&nbsp;</P>
<P>&nbsp;&nbsp;&nbsp; _tick = new Storyboard();</P>
<P>&nbsp;&nbsp;&nbsp; _tick.Duration = new Duration(TimeSpan.Zero);</P>
<P>&nbsp;&nbsp;&nbsp; _tick.Completed += Tick;</P>
<P>&nbsp;&nbsp;&nbsp; _tick.Begin();</P>
<P>}</P>
<P>The Tick method&nbsp;does whatever I want to do each frame, and restarts the Storyboard.</P>
<P>/// &lt;summary&gt;</P>
<P>/// This tells the layout system to call Arrange on the Panel if there are any elements that</P>
<P>/// must be moved.</P>
<P>/// &lt;/summary&gt;</P>
<P>private void Tick(object sender, EventArgs e)</P>
<P>{</P>
<P>&nbsp;&nbsp;&nbsp; // If there are still elements to be animated, make sure that ArrangeOverride will</P>
<P>&nbsp;&nbsp;&nbsp; // get called. Note that the InvalidateArrange may already have been called due to</P>
<P>&nbsp;&nbsp;&nbsp; // other operations, but calling it again does not hurt, and all of the work will</P>
<P>&nbsp;&nbsp;&nbsp; // be done in ArrangeOverride regardless of where the invalidation came from.</P>
<P>&nbsp;</P>
<P>&nbsp;&nbsp;&nbsp; if (_animatingElements &gt; 0)</P>
<P>&nbsp;&nbsp;&nbsp; {</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; InvalidateArrange();</P>
<P>&nbsp;&nbsp;&nbsp; }</P>
<P>&nbsp;</P>
<P>&nbsp;&nbsp;&nbsp; // Restart the storyboard so we get called back on the next frame.</P>
<P>&nbsp;&nbsp;&nbsp; _tick.Begin();</P>
<P>}</P>
<P>This technique does not guarantee smooth animations. It is possible to overload the panel with too many elements for the framewrate to animate 100% smoothly, or maybe the rest of the app&nbsp;is doing so much work that the framerate slows down,&nbsp;but since I use the elapsed time to figure out where to put the elements, the animations will take the same amount of time on all machines. If there is too much going on in the panel and the app, on a low-end machine, the animation might be choppy, but will still finish in the specified time, or one frame longer if the timing is just off.</P>
<P><STRONG>Using&nbsp;layout to "animate" the elements</STRONG></P>
<P>I'm a little conflicted about this technique, but I have seen other people use it, so I thought I'd try it. It is a two stage process. The MeasureOverride call figures out where everything should go, and is the only place where the animations are started. This works because MeasureOverride will be called if the AnimatedWrapPanel changes size, or any of its children change size, or children are added or removed. So size changes, adding items etc. kicks off the animations. In ArrangeOverride, any element that is not where it is supposed to be is moved in that direction according to how much it should be done, and the interpolations. Here's what the ArrangeOverride looks like:</P>
<P>/// &lt;summary&gt;</P>
<P>/// A "normal" ArrangeOverride would just put things where they belong. What this one does</P>
<P>/// is to move the children towards their destinations according to the virtual animation</P>
<P>/// data that has been attached to each element. When they get there, the virtual animation</P>
<P>/// is turned off.</P>
<P>/// &lt;/summary&gt;</P>
<P>protected override Size ArrangeOverride(Size finalSize)</P>
<P>{</P>
<P>&nbsp;&nbsp;&nbsp; DateTime now = DateTime.Now;</P>
<P>&nbsp;</P>
<P>&nbsp;&nbsp;&nbsp; foreach (UIElement child in Children)</P>
<P>&nbsp;&nbsp;&nbsp; {</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AnimatedWrapPanelAttachedData data = GetAnimatedWrapPanelAttachedData(child);</P>
<P>&nbsp;</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TimeSpan elapsed = data.GetElapsed(now);</P>
<P>&nbsp;</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (elapsed &lt; Duration || data.TargetPosition != data.CurrentPosition)</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // The virtual animation is not done yet, so figure out how far along it is...</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; double progress = (Duration.TimeSpan != TimeSpan.Zero) ? Math.Min(elapsed.TotalMilliseconds / Duration.TimeSpan.TotalMilliseconds, 1.0) : 1;</P>
<P>&nbsp;</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // ...and what the next position is.</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Point newPosition = BlendPoint(_interpolation, data.StartPosition, data.TargetPosition, progress);</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; child.Arrange(new Rect(newPosition.X, newPosition.Y, child.DesiredSize.Width, _rowHeights[data.Row]));</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; data.CurrentPosition = newPosition;</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // This element is not animating, but it might have become invalid on its own, so it still</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // needs to be arranged. The layout system will do as little as possible.</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; child.Arrange(new Rect(data.CurrentPosition.X, data.CurrentPosition.Y, child.DesiredSize.Width, _rowHeights[data.Row]));</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (data.IsAnimating)</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; --_animatingElements;</P>
<P>&nbsp;</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // This is the only place where IsAnimating is set to false. This turns off the virtual animation.</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; data.IsAnimating = false;</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</P>
<P>&nbsp;&nbsp;&nbsp; }</P>
<P>&nbsp;</P>
<P>&nbsp;&nbsp;&nbsp; return finalSize;</P>
<P>}</P>
<P><STRONG>Attached&nbsp;property bag</STRONG></P>
<P>Rather than have a bunch of hash tables or something in the&nbsp;panel itself, I wanted to keep all of the state that I needed on the elements, which sounded like a job for attached DependencyProperties. However, I got tired of creating and modifying them as I changed my mind, and decided that it would be easier at design-time and more efficient at run-time if I had a single attached property that was actually a class that had a bunch of properties--an attached property bag. This would be efficient because I always used all of the properties for each element.</P>
<P><STRONG>Interpolations using easing equations</STRONG></P>
<P>Rather then hard-coding animations into the panel, or using a simple linear interpolation, I wanted to use pluggable interpolations. The interpolations take a double that indicates progress, where zero is "just starting" and one is "completed". They return a number (alpha) where zero refers to the start position, and one refers to the end position, although the number may be less than zero or greater than one. The general equation is:</P>
<P>alpha = fn(progress)</P>
<P>The linear interpolation is the simplest: it just gives returns the progress, i.e. alpha = progress.</P>
<P>In practice, the interpolations are used to blend the starting and target positions. Here's how the intermediate points are arrived at:</P>
<P>/// &lt;summary&gt;</P>
<P>/// Given an interpolation, the starting and ending positions and a number from 0-1 that represents how</P>
<P>/// far along the virtual animation is, calculate the new position.</P>
<P>/// &lt;/summary&gt;</P>
<P>Point BlendPoint(Interpolation interpolation, Point from, Point to, double progress)</P>
<P>{</P>
<P>&nbsp;&nbsp;&nbsp; Point p = new Point();</P>
<P>&nbsp;&nbsp;&nbsp; double alpha = interpolation.GetAlpha(progress);</P>
<P>&nbsp;&nbsp;&nbsp; p.X = from.X + alpha * (to.X - from.X);</P>
<P>&nbsp;&nbsp;&nbsp; p.Y = from.Y + alpha * (to.Y - from.Y);</P>
<P>&nbsp;&nbsp;&nbsp; return p;</P>
<P>}</P>
<P>I used&nbsp;some standard interpolations, but it is possibly and easy to define your own, and then just plug them into the panel. I set up the interpolations with some default values that I thought looked nice, but it is possible to get quite creative.&nbsp;</P>
<P><STRONG>Using the demo app</STRONG></P>
<P>This should be pretty self-explanatory, but you can add pretty, randomly-colored Rectangles, text and image thumbnails. Clicking on a Rectangle deletes it from the panel. You can also change the size of all of the children, select the duration of the animations, and the interpolation that will be used. Resize the browser to watch the UI move around. I had wanted to have UI to modify the interpolation parameters, but at some point, you have to stop polishing and move one. Shipping is the art of stopping. So that bit of UI is left as an exercise for the developer.</P>
<P>&nbsp;</P>
<P>&nbsp;</P><img src="http://blogs.msdn.com/aggbug.aspx?PostID=8742093" width="1" height="1">]]></content:encoded>
			<wfw:commentRss>http://blogs.msdn.com/devdave/archive/2008/07/17/layout-transitions-an-animatable-wrappanel.aspx/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Smaller is better! [A simple step to shrink the download size of Silverlight 2 applications]</title>
		<link>http://blogs.msdn.com/delay/archive/2008/07/16/smaller-is-better-a-simple-step-to-shrink-the-download-size-of-silverlight-2-applications.aspx</link>
		<comments>http://blogs.msdn.com/delay/archive/2008/07/16/smaller-is-better-a-simple-step-to-shrink-the-download-size-of-silverlight-2-applications.aspx#comments</comments>
		<pubDate>Thu, 17 Jul 2008 05:47:00 +0000</pubDate>
		<dc:creator>Delay</dc:creator>
		
		<category><![CDATA[silverlighters.org (Syndicated Content)]]></category>

		<guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8742291</guid>
		<description><![CDATA[<DIV>
<P>When putting content on the web, it's important to get that content to the user as quickly as possible. In general, reducing the amount of data users need to download is a big step in the right direction. As such, the <A href="http://blogs.msdn.com/katriend/archive/2008/03/16/silverlight-2-structure-of-the-new-xap-file-silverlight-packaged-application.aspx">XAP packaging format</A> used by Silverlight 2 wraps everything in a single, compressed archive file that's browser-friendly. At the moment, the compression for XAP files in Beta 2 is not as efficient as it could be, and XAP files tend to be a bit larger than necessary. Until this is addressed in a future release of the Silverlight tools, here is something that's almost as good. :) </P>
<P>XAP files are really just <A href="http://en.wikipedia.org/wiki/ZIP_%28file_format%29">standard ZIP files</A> with a different extension, so we can use ZIP-file tools to improve the XAP situation quite easily. I wrote a simple <A href="http://en.wikipedia.org/wiki/Batch_file">batch file</A> named XapReZip.cmd (contents below) that can be added to a Visual Studio 2008 Silverlight project to automatically re-compress the project's XAP file more efficiently. All you need to do is add a single command to your project's post-build events (detailed below) and from then on all your XAP files will be even smaller and quicker to download! </P>
<P>To demonstrate its effectiveness, I've run XapReZip against three test applications, two simple demonstration applications of mine, and the current version of two professional-grade applications you're probably already familiar with. The table below shows the starting XAP file size, the size after running XapReZip, the difference between the two, and the percent difference. (All sizes are in bytes.) </P>
<TABLE cellSpacing="2" cellPadding="2">

<COL>
<COL>
<COL>
<COL>
<COL>
<TBODY>
<TR>
<TD>Scenario</TD>
<TD>Starting Size</TD>
<TD>After XapReZip</TD>
<TD>Difference</TD>
<TD>Reduction</TD></TR>
<TR>
<TD>New Silverlight Project</TD>
<TD>3,980</TD>
<TD>3,202</TD>
<TD>778</TD>
<TD>20%</TD></TR>
<TR>
<TD>... with DatePicker</TD>
<TD>73,228</TD>
<TD>56,513</TD>
<TD>16,715</TD>
<TD>23%</TD></TR>
<TR>
<TD>... and DataGrid</TD>
<TD>194,452</TD>
<TD>151,646</TD>
<TD>42,806</TD>
<TD>22%</TD></TR>
<TR>
<TD><A href="http://blogs.msdn.com/delay/archive/2008/06/11/again-with-the-support-for-simple-html-display-in-silverlight-htmltextblock-sample-updated-for-silverlight-2-beta-2.aspx">HtmlTextBlock</A></TD>
<TD>12,360</TD>
<TD>10,312</TD>
<TD>2,048</TD>
<TD>17%</TD></TR>
<TR>
<TD><A href="http://blogs.msdn.com/delay/archive/2008/06/13/proof-of-concept-silverlight-xps-reader-comes-to-beta-2-simplesilverlightxpsviewer-sample-updated-for-silverlight-2-beta-2.aspx">SimpleSilverlightXpsViewer</A></TD>
<TD>13,879</TD>
<TD>11,408</TD>
<TD>2,471</TD>
<TD>18%</TD></TR>
<TR>
<TD><A href="http://www.nbcolympics.com/video/">NBC Olympics Video Player</A></TD>
<TD>789,523</TD>
<TD>615,239</TD>
<TD>174,284</TD>
<TD>22%</TD></TR>
<TR>
<TD><A href="http://linerider.com/">Line Rider</A></TD>
<TD>789,496</TD>
<TD>538,784</TD>
<TD>250,712</TD>
<TD>32%</TD></TR></TBODY></TABLE>
<P>Basically, you can expect to see about a 22% reduction in size for XAP files in general - slightly less for code-intensive XAPs and potentially much more for larger, richer XAPs. For example, it looks like Line Rider could shave a quarter of a megabyte off its download size without breaking a sweat - which is even more compelling given how easy it would be! :) </P>
<P>The complete code for XapReZip.cmd is below. As written, XapReZip assumes that Zip.exe and UnZip.exe will be located in the same directory as XapReZip.cmd (this is easy to change) and that all of the files that are part of the XAP are available in the same directory as the XAP file itself (which just happens to be true after compiling with Visual Studio or MSBuild). For the purposes of this demonstration, I've used Zip 2.32 and UnZip 5.52 from the <A href="http://www.info-zip.org/">Info-ZIP group</A> because they're free and have a nice license. Of course, you can use whatever tools you're most comfortable with. </P><PRE>@REM XapReZip - Recompresses XAP files smaller

@REM Invoke as a VS post-build event like so:
@REM C:\XapReZip\XapReZip.cmd $(TargetName).xap

@echo off
setlocal

REM Define paths to zip.exe and unzip.exe
set ZIPEXE="%~p0zip.exe"
set UNZIPEXE="%~p0unzip.exe"

REM Define paths for intermediate files
set XAP=%1
set XAPDIR=%~p1
set XAPBAK=%1.bak
set XAPZIP=%1.zip

REM Output a banner message
echo XapReZip: %XAP%

REM Change to XAP file directory
pushd %XAPDIR%

REM Create new XAP file with maximum compression
%UNZIPEXE% -Z -1 %XAP% &#124; %ZIPEXE% -@ -9 -X %XAPZIP%

REM Abort if something went wrong
if ERRORLEVEL 1 goto :DONE

REM Replace original XAP file with smaller one
copy /y %XAP% %XAPBAK% &#62; NUL
copy /y %XAPZIP% %XAP% &#62; NUL
del %XAPZIP%

REM Output a success message
echo XapReZip: Success

:DONE

REM Restore previous directory
popd

endlocal</PRE>
<P>Adding XapReZip to a Silverlight Project in Visual Studio is easy. Just go to the Project menu, choose Properties (it's the last item), switch to the Build Events tab, and set a post-build event command line like this: <CODE>C:\XapReZip\XapReZip.cmd $(TargetName).xap</CODE>. Here's what it looks like in Visual Studio: </P><IMG height="558" alt="Configuring XapReZip as a post-build event in Visual Studio" src="http://blogs.msdn.com/blogfiles/delay/XapReZip.png" width="566"> 
<P>After you've set that one command, you can forget about it - XapReZip will go to work every time you recompile the application and you'll be able to run and debug it just like always. Except a little smaller. :) </P>
<P>So if you're eager to keep your Silverlight applications as lean as possible, consider adding XapReZip to your project. It'll probably be the easiest 22% savings you get all day! </P></DIV><img src="http://blogs.msdn.com/aggbug.aspx?PostID=8742291" width="1" height="1">]]></description>
			<content:encoded><![CDATA[<DIV>
<P>When putting content on the web, it's important to get that content to the user as quickly as possible. In general, reducing the amount of data users need to download is a big step in the right direction. As such, the <A href="http://blogs.msdn.com/katriend/archive/2008/03/16/silverlight-2-structure-of-the-new-xap-file-silverlight-packaged-application.aspx">XAP packaging format</A> used by Silverlight 2 wraps everything in a single, compressed archive file that's browser-friendly. At the moment, the compression for XAP files in Beta 2 is not as efficient as it could be, and XAP files tend to be a bit larger than necessary. Until this is addressed in a future release of the Silverlight tools, here is something that's almost as good. :) </P>
<P>XAP files are really just <A href="http://en.wikipedia.org/wiki/ZIP_%28file_format%29">standard ZIP files</A> with a different extension, so we can use ZIP-file tools to improve the XAP situation quite easily. I wrote a simple <A href="http://en.wikipedia.org/wiki/Batch_file">batch file</A> named XapReZip.cmd (contents below) that can be added to a Visual Studio 2008 Silverlight project to automatically re-compress the project's XAP file more efficiently. All you need to do is add a single command to your project's post-build events (detailed below) and from then on all your XAP files will be even smaller and quicker to download! </P>
<P>To demonstrate its effectiveness, I've run XapReZip against three test applications, two simple demonstration applications of mine, and the current version of two professional-grade applications you're probably already familiar with. The table below shows the starting XAP file size, the size after running XapReZip, the difference between the two, and the percent difference. (All sizes are in bytes.) </P>
<TABLE cellSpacing="2" cellPadding="2">

<COL>
<COL>
<COL>
<COL>
<COL>
<TBODY>
<TR>
<TD>Scenario</TD>
<TD>Starting Size</TD>
<TD>After XapReZip</TD>
<TD>Difference</TD>
<TD>Reduction</TD></TR>
<TR>
<TD>New Silverlight Project</TD>
<TD>3,980</TD>
<TD>3,202</TD>
<TD>778</TD>
<TD>20%</TD></TR>
<TR>
<TD>... with DatePicker</TD>
<TD>73,228</TD>
<TD>56,513</TD>
<TD>16,715</TD>
<TD>23%</TD></TR>
<TR>
<TD>... and DataGrid</TD>
<TD>194,452</TD>
<TD>151,646</TD>
<TD>42,806</TD>
<TD>22%</TD></TR>
<TR>
<TD><A href="http://blogs.msdn.com/delay/archive/2008/06/11/again-with-the-support-for-simple-html-display-in-silverlight-htmltextblock-sample-updated-for-silverlight-2-beta-2.aspx">HtmlTextBlock</A></TD>
<TD>12,360</TD>
<TD>10,312</TD>
<TD>2,048</TD>
<TD>17%</TD></TR>
<TR>
<TD><A href="http://blogs.msdn.com/delay/archive/2008/06/13/proof-of-concept-silverlight-xps-reader-comes-to-beta-2-simplesilverlightxpsviewer-sample-updated-for-silverlight-2-beta-2.aspx">SimpleSilverlightXpsViewer</A></TD>
<TD>13,879</TD>
<TD>11,408</TD>
<TD>2,471</TD>
<TD>18%</TD></TR>
<TR>
<TD><A href="http://www.nbcolympics.com/video/">NBC Olympics Video Player</A></TD>
<TD>789,523</TD>
<TD>615,239</TD>
<TD>174,284</TD>
<TD>22%</TD></TR>
<TR>
<TD><A href="http://linerider.com/">Line Rider</A></TD>
<TD>789,496</TD>
<TD>538,784</TD>
<TD>250,712</TD>
<TD>32%</TD></TR></TBODY></TABLE>
<P>Basically, you can expect to see about a 22% reduction in size for XAP files in general - slightly less for code-intensive XAPs and potentially much more for larger, richer XAPs. For example, it looks like Line Rider could shave a quarter of a megabyte off its download size without breaking a sweat - which is even more compelling given how easy it would be! :) </P>
<P>The complete code for XapReZip.cmd is below. As written, XapReZip assumes that Zip.exe and UnZip.exe will be located in the same directory as XapReZip.cmd (this is easy to change) and that all of the files that are part of the XAP are available in the same directory as the XAP file itself (which just happens to be true after compiling with Visual Studio or MSBuild). For the purposes of this demonstration, I've used Zip 2.32 and UnZip 5.52 from the <A href="http://www.info-zip.org/">Info-ZIP group</A> because they're free and have a nice license. Of course, you can use whatever tools you're most comfortable with. </P><PRE>@REM XapReZip - Recompresses XAP files smaller

@REM Invoke as a VS post-build event like so:
@REM C:\XapReZip\XapReZip.cmd $(TargetName).xap

@echo off
setlocal

REM Define paths to zip.exe and unzip.exe
set ZIPEXE="%~p0zip.exe"
set UNZIPEXE="%~p0unzip.exe"

REM Define paths for intermediate files
set XAP=%1
set XAPDIR=%~p1
set XAPBAK=%1.bak
set XAPZIP=%1.zip

REM Output a banner message
echo XapReZip: %XAP%

REM Change to XAP file directory
pushd %XAPDIR%

REM Create new XAP file with maximum compression
%UNZIPEXE% -Z -1 %XAP% | %ZIPEXE% -@ -9 -X %XAPZIP%

REM Abort if something went wrong
if ERRORLEVEL 1 goto :DONE

REM Replace original XAP file with smaller one
copy /y %XAP% %XAPBAK% &gt; NUL
copy /y %XAPZIP% %XAP% &gt; NUL
del %XAPZIP%

REM Output a success message
echo XapReZip: Success

:DONE

REM Restore previous directory
popd

endlocal</PRE>
<P>Adding XapReZip to a Silverlight Project in Visual Studio is easy. Just go to the Project menu, choose Properties (it's the last item), switch to the Build Events tab, and set a post-build event command line like this: <CODE>C:\XapReZip\XapReZip.cmd $(TargetName).xap</CODE>. Here's what it looks like in Visual Studio: </P><IMG height="558" alt="Configuring XapReZip as a post-build event in Visual Studio" src="http://blogs.msdn.com/blogfiles/delay/XapReZip.png" width="566"> 
<P>After you've set that one command, you can forget about it - XapReZip will go to work every time you recompile the application and you'll be able to run and debug it just like always. Except a little smaller. :) </P>
<P>So if you're eager to keep your Silverlight applications as lean as possible, consider adding XapReZip to your project. It'll probably be the easiest 22% savings you get all day! </P></DIV><img src="http://blogs.msdn.com/aggbug.aspx?PostID=8742291" width="1" height="1">]]></content:encoded>
			<wfw:commentRss>http://blogs.msdn.com/delay/archive/2008/07/16/smaller-is-better-a-simple-step-to-shrink-the-download-size-of-silverlight-2-applications.aspx/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Silverlight 2 Beta 2 Update - kb955011</title>
		<link>http://weblogs.asp.net/mschwarz/archive/2008/07/17/silverlight-2-beta-2-update-kb955011.aspx</link>
		<comments>http://weblogs.asp.net/mschwarz/archive/2008/07/17/silverlight-2-beta-2-update-kb955011.aspx#comments</comments>
		<pubDate>Thu, 17 Jul 2008 05:23:37 +0000</pubDate>
		<dc:creator>Michael Schwarz</dc:creator>
		
		<category><![CDATA[silverlighters.org (Syndicated Content)]]></category>

		<guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6409529</guid>
		<description><![CDATA[<p><a href="http://www.ajaxpro.info/images/blog/Silverlight2Beta2Updatekb955011_67F3/image.png"><img height="182" alt="image" src="http://www.ajaxpro.info/images/blog/Silverlight2Beta2Updatekb955011_67F3/image_thumb.png" width="240" align="right" border="0" /></a> Since yesterday there is an update available for <a href="http://www.silverlight.net/">Silverlight 2</a>. This update improves stability, media streaming, and the auto-update component. This update also improves support for <a href="http://www.mozilla.com/firefox/">Firefox 3</a>.</p>  <p><a href="http://support.microsoft.com/kb/955011">Microsoft Support kb955011</a></p>  <p>More details on Silverlight and Firefox 3 for Web developers:</p>  <ul>   <li><a href="Silverlight 2 (beta 2) and Firefox 3... so happy together...">Silverlight 2 and Firefox 3… so happy together</a> (Jon Galloway)</li>    <li><a href="http://www.timheuer.com/blog/archive/2008/06/17/silverlight-and-firefox-3-updates.aspx">Firefox 3 and Silverlight</a> (Tim Heuer)      <br /><a href="http://www.timheuer.com/blog/archive/2008/07/02/updating-your-silverlight-javascript-detection.aspx">Updating silverlight.js and Firefox 3</a></li> </ul>  <p>When visiting <a title="http://www.microsoft.com/silverlight/resources/install.aspx?v=2.0" href="http://www.microsoft.com/silverlight/resources/install.aspx?v=2.0">download Web page of Silverlight</a> I get the message that the latest Silverlight 2 plugin is installed (version 2.0.30523.6). After installing the Silverlight update using <a title="http://update.microsoft.com" href="http://update.microsoft.com">update.microsoft.com</a> I have version 2.0.30523.8, now.</p><img src="http://weblogs.asp.net/aggbug.aspx?PostID=6409529" width="1" height="1">]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.ajaxpro.info/images/blog/Silverlight2Beta2Updatekb955011_67F3/image.png"><img height="182" alt="image" src="http://www.ajaxpro.info/images/blog/Silverlight2Beta2Updatekb955011_67F3/image_thumb.png" width="240" align="right" border="0" /></a> Since yesterday there is an update available for <a href="http://www.silverlight.net/">Silverlight 2</a>. This update improves stability, media streaming, and the auto-update component. This update also improves support for <a href="http://www.mozilla.com/firefox/">Firefox 3</a>.</p>  <p><a href="http://support.microsoft.com/kb/955011">Microsoft Support kb955011</a></p>  <p>More details on Silverlight and Firefox 3 for Web developers:</p>  <ul>   <li><a href="Silverlight 2 (beta 2) and Firefox 3... so happy together...">Silverlight 2 and Firefox 3… so happy together</a> (Jon Galloway)</li>    <li><a href="http://www.timheuer.com/blog/archive/2008/06/17/silverlight-and-firefox-3-updates.aspx">Firefox 3 and Silverlight</a> (Tim Heuer)      <br /><a href="http://www.timheuer.com/blog/archive/2008/07/02/updating-your-silverlight-javascript-detection.aspx">Updating silverlight.js and Firefox 3</a></li> </ul>  <p>When visiting <a title="http://www.microsoft.com/silverlight/resources/install.aspx?v=2.0" href="http://www.microsoft.com/silverlight/resources/install.aspx?v=2.0">download Web page of Silverlight</a> I get the message that the latest Silverlight 2 plugin is installed (version 2.0.30523.6). After installing the Silverlight update using <a title="http://update.microsoft.com" href="http://update.microsoft.com">update.microsoft.com</a> I have version 2.0.30523.8, now.</p><img src="http://weblogs.asp.net/aggbug.aspx?PostID=6409529" width="1" height="1">]]></content:encoded>
			<wfw:commentRss>http://weblogs.asp.net/mschwarz/archive/2008/07/17/silverlight-2-beta-2-update-kb955011.aspx/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
