<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" media="screen" href="/styles/xslt/rss.xslt"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:c9="http://channel9.msdn.com">
<channel>
	<title>Channel 9 Forums - Tech Off - Silverlight: animate size change</title>
	<atom:link rel="self" type="application/rss+xml" href="http://channel9.msdn.com/Forums/rss"></atom:link>
	<image>
		<url>http://mschnlnine.vo.llnwd.net/d1/Dev/App_Themes/C9/images/feedimage.png</url>
		<title>Channel 9 Forums - Tech Off - Silverlight: animate size change</title>
		<link>http://channel9.msdn.com/Forums</link>
	</image>
	<description>Channel 9 keeps you up to date with the latest news and behind the scenes info from Microsoft that developers love to keep up with. From LINQ to SilverLight – Watch videos and hear about all the cool technologies coming and the people behind them.</description>
	<link>http://channel9.msdn.com/Forums</link>
	<language>en</language>
	<pubDate>Sat, 25 May 2013 21:42:18 GMT</pubDate>
	<lastBuildDate>Sat, 25 May 2013 21:42:18 GMT</lastBuildDate>
	<generator>Rev9</generator>
	<c9:totalResults>4</c9:totalResults>
	<c9:pageCount>-4</c9:pageCount>
	<c9:pageSize>-1</c9:pageSize>
	<item>
		<title>Tech Off - Silverlight: animate size change</title>
		<description><![CDATA[<p>In Silverlight, let's say I have a &lt;Border VerticalAlignment=&quot;Top&quot;/&gt; with some contents in it. Now those contents change and become bigger; the Border automatically resizes of course to accomodate the new content. So far so good.</p>
<p>&nbsp;</p>
<p>But what if I want to <em>animate</em> that change? So when the content of the &lt;Border&gt; control changes, I want it to animate from its current size to the new size. Note that I cannot predict what the size of the new content will be, so I can't just hard-code
 a value in an animation.</p>
<p>&nbsp;</p>
<p>I can't find any way to do this. Any ideas?</p>]]></description>
		<link>http://channel9.msdn.com/Forums/TechOff/562638-Silverlight-animate-size-change/562638#562638</link>
		<pubDate>Thu, 22 Jul 2010 04:22:03 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/TechOff/562638-Silverlight-animate-size-change/562638#562638</guid>
		<dc:creator>Sven Groot</dc:creator>
		<slash:comments>4</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/Sven Groot/Discussions/RSS</wfw:commentRss>
	</item>
	<item>
		<title>Tech Off - Silverlight: animate size change</title>
		<description><![CDATA[<p>There are some interesting examples of resizing content panels in Kenny Young's video on Silverlight TV. Check it out. He has some demos (you can grab them from the link) that show how to use panels and as you resize, they animate.
</p>
<p>&nbsp;</p>
<p><a href="http://channel9.msdn.com/shows/SilverlightTV/Creating-Rich-Interactions-Using-Blend-4-Transition-Effects-Fluid-Layout-and-Layout-States-Silverlig/">http://channel9.msdn.com/shows/SilverlightTV/Creating-Rich-Interactions-Using-Blend-4-Transition-Effects-Fluid-Layout-and-Layout-States-Silverlig/</a></p>]]></description>
		<link>http://channel9.msdn.com/Forums/TechOff/562638-Silverlight-animate-size-change/c207c285258c40928ac19dea00aaafc3#c207c285258c40928ac19dea00aaafc3</link>
		<pubDate>Thu, 22 Jul 2010 07:07:54 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/TechOff/562638-Silverlight-animate-size-change/c207c285258c40928ac19dea00aaafc3#c207c285258c40928ac19dea00aaafc3</guid>
		<dc:creator>John Papa</dc:creator>
		<slash:comments>4</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/jopapa/Discussions/RSS</wfw:commentRss>
	</item>
	<item>
		<title>Tech Off - Silverlight: animate size change</title>
		<description><![CDATA[<p>Can you do it in the code-behind? When the content changes, just start animating the Border to the new size of the content. At least that's how I'd approach it in WPF.</p>]]></description>
		<link>http://channel9.msdn.com/Forums/TechOff/562638-Silverlight-animate-size-change/2f867f95ae194728a2c89dea00aaafcb#2f867f95ae194728a2c89dea00aaafcb</link>
		<pubDate>Thu, 22 Jul 2010 13:49:56 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/TechOff/562638-Silverlight-animate-size-change/2f867f95ae194728a2c89dea00aaafcb#2f867f95ae194728a2c89dea00aaafcb</guid>
		<dc:creator>Scott</dc:creator>
		<slash:comments>4</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/spivonious/Discussions/RSS</wfw:commentRss>
	</item>
	<item>
		<title>Tech Off - Silverlight: animate size change</title>
		<description><![CDATA[<p><blockquote><div class="quoteUser">spivonious said:</div><div class="quoteText">
<p>Can you do it in the code-behind? When the content changes, just start animating the Border to the new size of the content. At least that's how I'd approach it in WPF.</p>
</div></blockquote>
<p>That's what I ended up doing. I'm not sure if the Blend FluidLayout stuff would've worked for me, I couldn't get it to look quite right.</p>
<p>&nbsp;</p>
<p>The item in question I wanted to resize was actually a databound item in a ListBox. I'd set it up so that the DataTemplate used for the items changes when an item is selected to show more information inside. In order to do this, I was handling the ListBox.SelectionChanged
 event to change the ContentTemplate of the containing ListBoxItem whenever they got selected.</p>
<p>&nbsp;</p>
<p>To solve the animation problem, I record the ListBoxItem's current ActualHeight, then set the new ContentTemplate, then call UpdateLayout which updates the DesiredSize property. I then create a Storyboard with a DoubleAnimation to animate the height from
 the old height to the new DesiredSize.Height. This works a charm. <img src='http://ecn.channel9.msdn.com/o9/content/images/emoticons/emotion-1.gif' alt='Smiley' /></p>
<p>&nbsp;</p>
<p>When the items get unselected, I simply change the Height property back to Double.NaN so they autosize again. Though I suppose I could animate that as well but currently I don't. <img src='http://ecn.channel9.msdn.com/o9/content/images/emoticons/emotion-1.gif' alt='Smiley' /></p></p>]]></description>
		<link>http://channel9.msdn.com/Forums/TechOff/562638-Silverlight-animate-size-change/b417031561424c9fa85c9dea00aaafd9#b417031561424c9fa85c9dea00aaafd9</link>
		<pubDate>Fri, 23 Jul 2010 17:41:38 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/TechOff/562638-Silverlight-animate-size-change/b417031561424c9fa85c9dea00aaafd9#b417031561424c9fa85c9dea00aaafd9</guid>
		<dc:creator>Sven Groot</dc:creator>
		<slash:comments>4</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/Sven Groot/Discussions/RSS</wfw:commentRss>
	</item>
</channel>
</rss>