<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>IRhetoric - Karsten Januszewski   : WPF</title><link>http://blogs.msdn.com/karstenj/archive/tags/WPF/default.aspx</link><description>Tags: WPF</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Announcing Flotzam: Twitter, Flickr, Facebook and Blog Mash Up</title><link>http://blogs.msdn.com/karstenj/archive/2007/06/21/announcing-flotzam-twitter-flickr-facebook-and-blog-mash-up.aspx</link><pubDate>Fri, 22 Jun 2007 01:44:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3449349</guid><dc:creator>karstenj</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/karstenj/comments/3449349.aspx</comments><wfw:commentRss>http://blogs.msdn.com/karstenj/commentrss.aspx?PostID=3449349</wfw:commentRss><description>&lt;P&gt;Awhile back, for MIX, &lt;A href="http://systim.spaces.live.com/" mce_href="http://systim.spaces.live.com/"&gt;Tim Aidlin&lt;/A&gt; and I built Flitterbook.&amp;nbsp; We liked it so much that we now have version 2, renamed &lt;A href="http://flotzam.com/" mce_href="http://flotzam.com/"&gt;Flotzam&lt;/A&gt;, ready for your consumption.&amp;nbsp; Lots of improvements, including a new UI, RSS support, Facebook notifications and complete configuration control. Also, check out the &lt;A href="http://flotzam.com/blog/post/flotzam-video.aspx" mce_href="http://flotzam.com/blog/post/flotzam-video.aspx"&gt;Silverlight-created video that is a screen capture of the application in action&lt;/A&gt;.&amp;nbsp; So, we'd love for you to &lt;A href="http://flotzam.com/" mce_href="http://flotzam.com/"&gt;go check it out&lt;/A&gt;, let us know what you think on the &lt;A href="http://flotzam.com/forum/" mce_href="http://flotzam.com/forum/"&gt;Flotzam forum&lt;/A&gt; and watch the &lt;A href="http://flotzam.com/blog" mce_href="http://flotzam.com/blog"&gt;Flotzam blog&lt;/A&gt;. &lt;/P&gt;
&lt;P&gt;&lt;A href="http://flotzam.com/" border="0"&gt;&lt;IMG src="http://flotzam.com/images/flotzam.jpg" border=0 mce_src="http://flotzam.com/images/flotzam.jpg"&gt;&lt;/A&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=3449349" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/karstenj/archive/tags/WPF/default.aspx">WPF</category><category domain="http://blogs.msdn.com/karstenj/archive/tags/Facebook/default.aspx">Facebook</category><category domain="http://blogs.msdn.com/karstenj/archive/tags/Twitter/default.aspx">Twitter</category></item><item><title>COLLABORATING ON CREATING ANIMATIONS IN WPF AND BLEND: POSSIBILITIES AND LIMITATIONS</title><link>http://blogs.msdn.com/karstenj/archive/2007/06/20/collaborating-on-creating-animations-in-wpf-and-blend-possibilities-and-limitations.aspx</link><pubDate>Thu, 21 Jun 2007 02:16:41 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3433330</guid><dc:creator>karstenj</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/karstenj/comments/3433330.aspx</comments><wfw:commentRss>http://blogs.msdn.com/karstenj/commentrss.aspx?PostID=3433330</wfw:commentRss><description>&lt;p&gt;One area that is currently top of mind for me is designer and developer collaboration with WPF and Expression Blend, in particular around animation.&amp;nbsp; I'd like to start documenting some techniques and outlining things that can and can't be done.&amp;nbsp;&amp;nbsp;&lt;/p&gt; &lt;p&gt;Before diving in, let's quickly review the animation system in WPF.&amp;nbsp; The two ways to do animation in WPF is either declaratively (XAML) or procedurally (code).&amp;nbsp;&amp;nbsp;&amp;nbsp;If you use Expression Blend to create your animations, you will be in effect using the declarative (XAML) method.&amp;nbsp; What gets slightly confusing is that the two methods, declarative and procedural,&amp;nbsp;are not entirely in parallel.&amp;nbsp; For example, the only way to begin an animation declaratively (XAML) is through the &amp;lt;&lt;strong&gt;BeginStoryboard&lt;/strong&gt;&amp;gt; tag.&amp;nbsp; However, the equivalent call in code is to call the &lt;strong&gt;Begin&lt;/strong&gt; method off a &lt;strong&gt;UIElement&lt;/strong&gt; and&amp;nbsp; passing it the storyboard to fire.&amp;nbsp; The other option is to call the &lt;strong&gt;Begin&lt;/strong&gt; method from a storyboard itself, passing it the &lt;strong&gt;UIElement&lt;/strong&gt; to which the storyboard should be applied. And, in code, you can trigger animations that don't even have storyboards using&amp;nbsp;the &lt;strong&gt;ApplyAnimationClock&lt;/strong&gt; or &lt;strong&gt;BeginAnimation&lt;/strong&gt; directly off a &lt;strong&gt;UIElement&lt;/strong&gt;.&amp;nbsp; (More on this later if you're confused. The syntax is, like much of WPF, a little tricky.)&lt;/p&gt; &lt;p&gt;But all of the above -- and &lt;a href="http://msdn2.microsoft.com/en-us/library/ms752312.aspx"&gt;much of the SDK documentation on animation&lt;/a&gt; -- assumes that you have chosen either one or the other.&amp;nbsp; What happens if you want to mix and match these two methods?&amp;nbsp; This particularly comes into play if you are working on a project where animations get created in Blend but then need to be manipulated, triggered and recontextualized from code.&amp;nbsp; And it potentially gets more tricky if you have multiple people working on the project, the classic scenario being one person who creates the animations in Blend and another who works with those animations in code. &lt;/p&gt; &lt;p&gt;So, let's look at the possibilities:&lt;/p&gt; &lt;p&gt;&lt;font size="4"&gt;1. How to&amp;nbsp;trigger a storyboard from code that was created in Blend.&lt;/font&gt;&lt;/p&gt; &lt;p&gt;Let's say we have an animation in Blend to do&amp;nbsp;an opacity fade on an&amp;nbsp;image.&amp;nbsp; Assuming it was created&amp;nbsp;&amp;nbsp;by creating a new timeline and leave the "Create as a resource" checkbox checked, we can get at it from code pretty easily.Simply grab the storyboard from the resources, cast it appropriately&amp;nbsp;and begin it.&amp;nbsp; &lt;/p&gt; &lt;p&gt;&lt;font face="Courier New"&gt;&lt;strong&gt;Storyboard s = (Storyboard) this.FindResource("FadeIn");&lt;br&gt;this.BeginStoryboard(s);&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;Now, the reason this works is that the storyboard itself contains information about the name of the object that it wants to animate.&amp;nbsp; If you look at the storyboard &lt;a href="http://winfx.members.winisp.net/files/animationcollab.zip"&gt;in the sample code I posted&lt;/a&gt;, it sets the &lt;strong&gt;Storyboard.TargetName&lt;/strong&gt; value explicitly to the name "image".&amp;nbsp; Thus, when the storyboard is called from the page itself via &lt;strong&gt;BeginStoryboard&lt;/strong&gt;, it is able to find the element named image and run the animations. But what happens if we want to generically apply that animation that was created in Blend to other elements? &lt;/p&gt; &lt;p&gt;&lt;font size="4"&gt;2. How to trigger a storyboard from code and apply it to another UI element&lt;/font&gt;&lt;/p&gt; &lt;p&gt;Well, to accomplish this task, we need to start hacking XAML.&amp;nbsp; If this scares you, don't read on.&amp;nbsp; But the fact is that XAML generated from Blend sometimes needs a little love. So, in this case, we are going to copy that storyboard.&amp;nbsp; We can't do that without jumping into the XAML and manually coping the entire &amp;lt;Storyboard&amp;gt; and giving it a new x:Key. Once we've done that, we have manually remove every instance where &lt;strong&gt;Storyboard.TargetName&lt;/strong&gt; is set.&amp;nbsp; Literally, remove the entire&amp;nbsp;attribute. Now, we can apply this storyboard to any &lt;strong&gt;UIElement&lt;/strong&gt; and not just images.&amp;nbsp;&amp;nbsp;In this case, we call the &lt;strong&gt;Begin&lt;/strong&gt; method from the storyboard itself, passing the element we want&amp;nbsp;the storyboard to be applied to.&lt;/p&gt; &lt;p&gt;&lt;font face="Courier New"&gt;&lt;strong&gt;Storyboard s = (Storyboard)this.FindResource("FadeIn2");&lt;br&gt;s.Begin(textBlock);&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;The thing to watch out for with this technique is to make sure you call the storyboard on an element that in fact has all the properties referenced in the storyboard.&amp;nbsp; Otherwise, you'll get a runtime exception that says something like:&lt;/p&gt; &lt;p&gt;&lt;font face="Courier New"&gt;&lt;strong&gt;Additional information: '[Unknown]' property does not point to a DependencyObject in path '(0).(1).[0].(2)'.&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;Which is saying that the animation could find the property that it was told to animate.&amp;nbsp; A place where this can get you is if you are doing any Transform animations, such as Scale, Translate, Rotate or Skew.&amp;nbsp; By default, when you add an element to Blend, it does not create a TransformGroup for it. For example, go to Blend, add a &lt;strong&gt;Rectangle&lt;/strong&gt; to the stage and see what it creates in XAML. It won't have a &lt;strong&gt;RenderTransform&lt;/strong&gt;.&amp;nbsp; Now, go change its scale to 2 and then change it back to 1.&amp;nbsp; Now look at its XAML: a RenderTransform has been permanently added to it as a child which doesn't do anything! Blend counts on that &lt;strong&gt;TransformGroup&lt;/strong&gt; for doing its animations, in that exact order (Scale, Skew, Rotate, Translate).&amp;nbsp; So, if you've created an animation that does a transform and you want to apply it to some other element, be sure that the element has a &lt;strong&gt;TransformGroup&lt;/strong&gt; with the four transforms.&lt;/p&gt; &lt;p&gt;&lt;font size="4"&gt;3. How to tweak an animation created in Blend on the fly in code&lt;/font&gt;&lt;/p&gt; &lt;p&gt;Let's say there's an animation created in Blend that you want to use, but you want to actually modify it with some dynamic values at runtime, maybe adding more animation.&amp;nbsp; First, you grab the storyboard and clone it so you have a new instance to party on. Then, you create your animation in code -- that's where you could insert dynamic variables.&amp;nbsp; Finally, you have to create a property path to the value you want animated.&amp;nbsp; The syntax is a little goofy, but once you crack its code as far as a path (&lt;a href="http://msdn2.microsoft.com/en-us/library/system.windows.propertypath.path.aspx"&gt;good doc here&lt;/a&gt;) you'll be off and running.&amp;nbsp; Here's the code I used to add a scale animation on the fly:&lt;/p&gt; &lt;p&gt;&lt;font face="Courier New"&gt;&lt;strong&gt;Storyboard s = ((Storyboard)this.FindResource("FadeIn2")).Clone();&lt;br&gt;DoubleAnimation da = new DoubleAnimation(0, 1, TimeSpan.FromSeconds(1), FillBehavior.HoldEnd);&lt;br&gt;Storyboard.SetTargetProperty(da, new PropertyPath("(0).(1).[0].(2)", UIElement.RenderTransformProperty,&lt;br&gt;TransformGroup.ChildrenProperty,&lt;br&gt;ScaleTransform.ScaleXProperty));&lt;br&gt;s.Children.Add(da);&lt;br&gt;s.Begin(rectangle);&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;You could use a similar technique to crack into the storyboard, grab an animation that was created in XAML and tweak it.&amp;nbsp; So for example, we could grab the animation from the storyboard and change its begin time like this:&lt;/p&gt; &lt;p&gt;&lt;font face="Courier New"&gt;&lt;strong&gt;DoubleAnimationUsingKeyFrames d = (DoubleAnimationUsingKeyFrames)s.Children[0];&lt;br&gt;d.BeginTime = TimeSpan.FromSeconds(.5);&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="4"&gt;4. How to crack into an animation that is part of a DataTemplate&lt;/font&gt;&lt;/p&gt; &lt;p&gt;Doh! You can't!&amp;nbsp; I tried every workaround I could, but once a &lt;strong&gt;ContentTemplate&lt;/strong&gt; gets loaded, it is in the WPF terminology "Sealed" and I've never seen a way to make it unsealed, even before it is added to the visual tree.&amp;nbsp; Bummer.&lt;/p&gt; &lt;p&gt;**********************************&lt;/p&gt; &lt;p&gt;So where are we?&amp;nbsp; We've&amp;nbsp;learned&amp;nbsp;some techniques such that a design technologist or interactive designer or diviner (or whatever they are called) can work in Blend, creating subtle and great animations and then, if there are scenarios where the developer or integrator or diviner (or whatever they are called) needs to start that animation, reuse that animation or tweak that animation on the fly, they can. Go WPF!&lt;/p&gt; &lt;p&gt;&lt;a href="http://winfx.members.winisp.net/files/animationcollab.zip"&gt;Download the code&lt;/a&gt;&lt;/p&gt;&lt;img src="http://winfx.members.winisp.net/files/snowboard.jpg"&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=3433330" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/karstenj/archive/tags/Windows+Presentation+Foundation+_2800_Avalon_2900_/default.aspx">Windows Presentation Foundation (Avalon)</category><category domain="http://blogs.msdn.com/karstenj/archive/tags/WPF/default.aspx">WPF</category><category domain="http://blogs.msdn.com/karstenj/archive/tags/Expression+Blend/default.aspx">Expression Blend</category></item><item><title>CREATING A .NET TWITTER API in 4.5 SECONDS</title><link>http://blogs.msdn.com/karstenj/archive/2007/06/08/creating-a-net-twitter-api-in-4-5-seconds.aspx</link><pubDate>Sat, 09 Jun 2007 00:01:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3168876</guid><dc:creator>karstenj</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/karstenj/comments/3168876.aspx</comments><wfw:commentRss>http://blogs.msdn.com/karstenj/commentrss.aspx?PostID=3168876</wfw:commentRss><description>&lt;P&gt;I've been meaning to document how I wrapped the Twitter API ... in 4.5 seconds.&amp;nbsp;&amp;nbsp; There is a&amp;nbsp;very powerful feature in .NET is a tool in the sdk called &lt;STRONG&gt;xsd.exe&lt;/STRONG&gt;.&amp;nbsp; Darren David actually has &lt;A href="http://blog.lookorfeel.com/index.php/2007/05/02/the-net-xml-schema-definition-tool-or-how-i-learned-to-stop-parsing-and-love-the-dom-part-1/" mce_href="http://blog.lookorfeel.com/index.php/2007/05/02/the-net-xml-schema-definition-tool-or-how-i-learned-to-stop-parsing-and-love-the-dom-part-1/"&gt;a fabulous post&lt;/A&gt; on&amp;nbsp;exactly the power of this tool: never touch a DOM&amp;nbsp;or XPATH again!&amp;nbsp; &amp;nbsp;His post explains what is happening under the hood with xsd.exe quite nicely.&amp;nbsp;I'd definitely recommend reading his post.&amp;nbsp; I figured it might be interesting for folks to see&amp;nbsp;the exact steps I took to wrap the Twitter API:&lt;/P&gt;
&lt;P&gt;1. Grab an instance of the public timeline from Twitter and pass that to xsd.exe to infer a schema as follows: &lt;STRONG&gt;xsd&lt;/STRONG&gt; &lt;A title=http://twitter.com/statuses/public_timeline.xml href="http://twitter.com/statuses/public_timeline.xml" mce_href="http://twitter.com/statuses/public_timeline.xml"&gt;http://twitter.com/statuses/public_timeline.xml&lt;/A&gt;&amp;nbsp;which creates public_timeline.xsd&lt;/P&gt;
&lt;P&gt;3. Use the inferred schema to generate classes: &lt;STRONG&gt;xsd&lt;/STRONG&gt; public_timeline.xsd&lt;/P&gt;
&lt;P&gt;4. Walla!&amp;nbsp; We now have a class to party on called public_timeline.cs&lt;/P&gt;
&lt;P&gt;5. To instantiate the class with live data, it is as simple as the following:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&lt;STRONG&gt;System.Xml.Serialization.XmlSerializer serializer = new System.Xml.Serialization.XmlSerializer(typeof(statuses));&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&lt;STRONG&gt;statuses s = serializer.Deserialize(new System.Xml.XmlTextReader("&lt;/STRONG&gt;&lt;/FONT&gt;&lt;A href="http://twitter.com/statuses/public_timeline.xml%22))" mce_href='http://twitter.com/statuses/public_timeline.xml"))'&gt;&lt;FONT face="Courier New"&gt;&lt;STRONG&gt;http://twitter.com/statuses/public_timeline.xml"))&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face="Courier New"&gt;&lt;STRONG&gt; as statuses;&lt;/STRONG&gt;&lt;/FONT&gt; 
&lt;P&gt;And there you have it.&amp;nbsp; No DOM, no XPATH, no RegEx.&amp;nbsp; Now, if we want to take this wrapper to the next level, there are a few things we can do.&amp;nbsp; First, you will notice that Twitter returns the data as a string.&amp;nbsp; That's kind of a bummer; it would be nice to have it as a strongly typed &lt;STRONG&gt;DateTime&lt;/STRONG&gt;.&amp;nbsp; Here's the line of code to do that: 
&lt;P&gt;&lt;FONT face="Courier New"&gt;&lt;STRONG&gt;DateTime date = DateTime.ParseExact(s.created_at, "ddd MMM dd HH:mm:ss zzzzz yyyy", CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal);&lt;/STRONG&gt;&lt;/FONT&gt; 
&lt;P&gt;Another thing that you'll need to do is authenticate when you contact Twitter if you want data other than the public timeline.&amp;nbsp; Here's how to do that: 
&lt;P&gt;&lt;FONT face="Courier New"&gt;&lt;STRONG&gt;using (WebClient client = new WebClient())&lt;BR&gt;{&lt;BR&gt;client.Credentials = new NetworkCredential(TWITTER_USERNAME, TWITTER_PASSWORD);&lt;BR&gt;statuses s = serializer.Deserialize(client.OpenRead(TWITTER_URL)) as statuses;&lt;BR&gt;}&lt;/STRONG&gt;&lt;/FONT&gt; 
&lt;P&gt;Of course, the TWITTER variables need to be set with the username, password and particular URL to the Twitter feed you are looking for.&amp;nbsp; 
&lt;P&gt;Another thing to think about doing is making the calls to Twitter on a different thread.&amp;nbsp; My recommendation for doing that is to implement &lt;A href="http://blogs.msdn.com/dancre/archive/2006/10/11/datamodel-view-viewmodel-pattern-series.aspx" mce_href="http://blogs.msdn.com/dancre/archive/2006/10/11/datamodel-view-viewmodel-pattern-series.aspx"&gt;Dan Crevier's Data-View-View Model&lt;/A&gt;.&amp;nbsp; This frees the UI thread from any calls to Twitter and provides a really nice model for marshalling data between the threads.&amp;nbsp; In fact, I did just this in my &lt;A href="http://winfx.members.winisp.net/blog/flitter.zip" mce_href="http://winfx.members.winisp.net/blog/flitter.zip"&gt;Flitter&lt;/A&gt; and &lt;A href="http://blogs.msdn.com/coding4fun/attachment/2854939.ashx" mce_href="http://blogs.msdn.com/coding4fun/attachment/2854939.ashx"&gt;Flitterbook&lt;/A&gt; implementations, which you can check out in the source code. 
&lt;P&gt;The final thing to think about, which I just recently implemented in some code I was working on, was to make the naming conventions look prettier.&amp;nbsp; Darren David alluded to this in his post but he's been so busy with the totally amazing &lt;A href="http://blog.lookorfeel.com/index.php/2007/06/04/hp-multi-touch-interactive-canvas-launched-at-d5/" mce_href="http://blog.lookorfeel.com/index.php/2007/06/04/hp-multi-touch-interactive-canvas-launched-at-d5/"&gt;HP Multi Touch kiosk he built&lt;/A&gt; (which you have to check out the videos for if you haven't yet) that he hasn't posted his part II.&amp;nbsp; But I imagine he's going to talk about using partial classes so as to make the class look prettier without touching the generated code.&amp;nbsp; This came in real handy with the Twitter API which generated some code with ugly array structures that I wasn't so keen on.&amp;nbsp;I also had a need to use&amp;nbsp;a kind of cool feature of WPF databinding&amp;nbsp;where I&amp;nbsp;wanted to reuse a datatemplate between two&amp;nbsp;different objects&amp;nbsp;(Twitter status and Facebook status) by just having them share names, such as AvatarURL, rather than create two templates that were fundamentally identitcal except for the data object.&amp;nbsp;As such, I created a partial class with a bunch of getters as follows: 
&lt;P&gt;&lt;FONT face="Courier New"&gt;&lt;STRONG&gt;public partial class statusesStatus&lt;BR&gt;{&lt;BR&gt;public DateTime Date&lt;BR&gt;{&lt;BR&gt;get&lt;BR&gt;{&lt;BR&gt;return DateTime.ParseExact((string)this.created_at, "ddd MMM dd HH:mm:ss zzzzz yyyy", CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal);&lt;BR&gt;}&lt;BR&gt;} &lt;/STRONG&gt;&lt;/FONT&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&lt;STRONG&gt;public string AvatarUrl&lt;BR&gt;{&lt;BR&gt;get&lt;BR&gt;{&lt;BR&gt;return this.user[0].profile_image_url;&lt;BR&gt;}&lt;BR&gt;} &lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&lt;STRONG&gt;public string Text&lt;BR&gt;{&lt;BR&gt;get&lt;BR&gt;{&lt;BR&gt;return this.text;&lt;BR&gt;}&lt;BR&gt;} &lt;/STRONG&gt;&lt;/FONT&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&lt;STRONG&gt;public string UserName&lt;BR&gt;{&lt;BR&gt;get&lt;BR&gt;{&lt;BR&gt;return this.user[0].screen_name;&lt;BR&gt;}&lt;BR&gt;} &lt;/STRONG&gt;&lt;/FONT&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&lt;STRONG&gt;public string Location&lt;BR&gt;{&lt;BR&gt;get&lt;BR&gt;{&lt;BR&gt;return this.user[0].location;&lt;BR&gt;}&lt;BR&gt;} &lt;/STRONG&gt;&lt;/FONT&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&lt;STRONG&gt;} &lt;/STRONG&gt;&lt;/FONT&gt;
&lt;P&gt;Now I have a much prettier class without touching the generated code from xsd.exe.&amp;nbsp; Sorry for stealing Part II Darren. I couldn't&amp;nbsp;help myself, as I&amp;nbsp;have been&amp;nbsp;meaning to write this post for about 2 months!&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=3168876" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/karstenj/archive/tags/Windows+Presentation+Foundation+_2800_Avalon_2900_/default.aspx">Windows Presentation Foundation (Avalon)</category><category domain="http://blogs.msdn.com/karstenj/archive/tags/WPF/default.aspx">WPF</category><category domain="http://blogs.msdn.com/karstenj/archive/tags/Twitter/default.aspx">Twitter</category></item><item><title>FLITTERBOOK: INTEGRATING WITH THE FACEBOOK PLATFORM</title><link>http://blogs.msdn.com/karstenj/archive/2007/05/24/flitterbook-integrating-with-the-facebook-platform.aspx</link><pubDate>Fri, 25 May 2007 08:50:19 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2861820</guid><dc:creator>karstenj</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/karstenj/comments/2861820.aspx</comments><wfw:commentRss>http://blogs.msdn.com/karstenj/commentrss.aspx?PostID=2861820</wfw:commentRss><description>&lt;p&gt;I'm here at the &lt;a href="http://www.techcrunch.com/2007/05/24/facebook-launches-facebook-platform-they-are-the-anti-myspace/"&gt;Facebook Developer's event&lt;/a&gt; down here in San Francisco.&amp;nbsp; Dan'l Lewin from Microsoft was on stage as a parter:&lt;/p&gt; &lt;p&gt;&lt;img src="http://farm1.static.flickr.com/189/512719401_40f6dd4b74_m.jpg"&gt; &lt;/p&gt; &lt;p&gt;Lots of good stuff announced as far as Facebook/Microsoft partnership: Microsoft just released &lt;a href="http://blogs.msdn.com/coding4fun/archive/2007/05/24/2854939.aspx"&gt;a great wrapper to the Facebook API&lt;/a&gt;&amp;nbsp;written by the guys at &lt;a href="http://www.claritycon.com/"&gt;Clarity Consulting&lt;/a&gt;.&amp;nbsp; They've got some nice sample applications, including a cool WPF app that is a rolodex of your Facebook contacts.&lt;/p&gt; &lt;p&gt;&lt;img src="http://farm1.static.flickr.com/223/512983829_e2f4f63dbf_m.jpg"&gt; &lt;/p&gt; &lt;p&gt;&lt;br&gt;Also, Popfly also added support for the Facebook API to their mashup builder.&amp;nbsp; Speaking of Silverlight, there's support for Silverlight in FBML via the FB:Silverlight tag, although it is undocumented right now and not quite there.&amp;nbsp; However, you can host Silverlight in an iframe using FBML.&amp;nbsp; More on that to come.&lt;/p&gt; &lt;p&gt;I&amp;nbsp;implemented in an updated version of Flitterbook, which you can download &lt;a href="http://blogs.msdn.com/coding4fun/attachment/2854939.ashx"&gt;here&lt;/a&gt;.&amp;nbsp; This version of Flitterbook now has support for the Facebook API and pulls all images from your friends along with Twitter feeds and Flickr data.&amp;nbsp; Again, this is still alpha code: no promises!&lt;/p&gt; &lt;p&gt;One thing I implemented in Flitterbook is support for infinite sessions with Facebook.&amp;nbsp; There aren't any code samples for this in the samples that ship with the Facebook&amp;nbsp; Developer Toolkit so I thought it might be useful for other folks. I save the Facebook infinite session data in a user config file using Visual Studio. The crux is that you have to pass your own secret if you don't have a secret that gets returned from Facebook to support an infinite session.&amp;nbsp; Here's the code:&lt;/p&gt; &lt;p&gt;&lt;font face="Courier New"&gt;&lt;/font&gt; &lt;p&gt;&lt;font face="Courier New"&gt;//set infinite session parameters on to facebook data adapter&lt;br&gt;if (Settings.Default.IsFacebookInfiniteSession)&lt;br&gt;{&lt;br&gt;&amp;nbsp; facebookConnect.UserId = Settings.Default.FACEBOOK_USERID;&lt;br&gt;&amp;nbsp; facebookConnect.SessionKey = Settings.Default.FACEBOOK_SESSIONKEY;&lt;br&gt;&amp;nbsp; //note here that we pass the secret that we saved&lt;br&gt;&amp;nbsp; facebookConnect.Secret = Settings.Default.FACEBOOK_SECRET;&lt;br&gt;}&lt;br&gt;else&lt;br&gt;{&lt;br&gt;&amp;nbsp; //if we don't have an infinite session, we use my application's secret&lt;br&gt;&amp;nbsp; facebookConnect.Secret = secret;&lt;br&gt;&amp;nbsp; //we invoke the UI dialog&lt;br&gt;&amp;nbsp; facebookConnect.ConnectToFacebook();&lt;br&gt;&amp;nbsp; //if the user let us save their session, throw it in config&lt;br&gt;&amp;nbsp; if (!facebookConnect.SessionExpires)&lt;br&gt;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Settings.Default.FACEBOOK_SESSIONKEY = facebookConnect.SessionKey;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Settings.Default.FACEBOOK_USERID = facebookConnect.UserId;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Settings.Default.FACEBOOK_SECRET = facebookConnect.Secret;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Settings.Default.IsFacebookInfiniteSession = true;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Settings.Default.Save();&lt;br&gt;&amp;nbsp; }&lt;br&gt;}&lt;/font&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=2861820" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/karstenj/archive/tags/WPF/default.aspx">WPF</category><category domain="http://blogs.msdn.com/karstenj/archive/tags/Expression+Blend/default.aspx">Expression Blend</category></item><item><title>THREE NEW EXPRESSION BLEND HANDS-ON LABS</title><link>http://blogs.msdn.com/karstenj/archive/2007/05/22/three-new-expression-blend-hands-on-labs.aspx</link><pubDate>Tue, 22 May 2007 17:26:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2793871</guid><dc:creator>karstenj</dc:creator><slash:comments>6</slash:comments><comments>http://blogs.msdn.com/karstenj/comments/2793871.aspx</comments><wfw:commentRss>http://blogs.msdn.com/karstenj/commentrss.aspx?PostID=2793871</wfw:commentRss><description>&lt;P&gt;I just posted three new hands-on labs for Expression Blend that were created for MIX but haven't been posted for the world yet.&amp;nbsp;There's lots of little nuggets in there worth checking out, things like creating a user controls, databinding, triggers, styling controls, using web services, paging, data input&amp;nbsp;and more.&amp;nbsp; The more I use Blend, the more I love it, but it has &lt;A href="http://blogs.msdn.com/karstenj/archive/2006/04/05/curve.aspx" mce_href="http://blogs.msdn.com/karstenj/archive/2006/04/05/curve.aspx"&gt;its own learning curve&lt;/A&gt;, above and beyond WPF.&lt;/P&gt;
&lt;P&gt;The first lab is a UI for Windows Live Search, including Image Search.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://winfx.members.winisp.net/images/live.jpg" mce_src="http://winfx.members.winisp.net/images/live.jpg"&gt; &lt;/P&gt;
&lt;P&gt;The second lab is a color swatch lab.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://winfx.members.winisp.net/images/swatch.jpg" mce_src="http://winfx.members.winisp.net/images/swatch.jpg"&gt; &lt;/P&gt;
&lt;P&gt;The third lab is a recipe viewer application.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://winfx.members.winisp.net/images/recipe.jpg" mce_src="http://winfx.members.winisp.net/images/recipe.jpg"&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=2793871" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/karstenj/archive/tags/WPF/default.aspx">WPF</category><category domain="http://blogs.msdn.com/karstenj/archive/tags/Expression+Blend/default.aspx">Expression Blend</category></item><item><title>New Lab Posted: Creating 3D Content with Windows Presentation Foundation</title><link>http://blogs.msdn.com/karstenj/archive/2007/03/28/new-lab-posted-creating-3d-content-with-windows-presentation-foundation.aspx</link><pubDate>Wed, 28 Mar 2007 23:25:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1980187</guid><dc:creator>karstenj</dc:creator><slash:comments>6</slash:comments><comments>http://blogs.msdn.com/karstenj/comments/1980187.aspx</comments><wfw:commentRss>http://blogs.msdn.com/karstenj/commentrss.aspx?PostID=1980187</wfw:commentRss><description>&lt;P&gt;I just posted a &lt;A class="" href="http://wpf.netfx3.com/files/folders/labs/entry9680.aspx" mce_href="http://wpf.netfx3.com/files/folders/labs/entry9680.aspx"&gt;new lab for learning how to use 3D&lt;/A&gt; in WPF.&amp;nbsp; This is a great lab that I would highly recommend if you are learning WPF 3D. It shows how to do dynamic animation of 3D content as well as how to do 2D on 3D using the &lt;A class="" href="http://www.codeplex.com/3DTools" mce_href="http://www.codeplex.com/3DTools"&gt;3DTools&lt;/A&gt;. &lt;/P&gt;
&lt;P&gt;&lt;IMG style="WIDTH: 425px; HEIGHT: 419px" height=419 src="http://inlinethumb49.webshots.com/4592/2918638560100818464S425x425Q85.jpg" width=425 mce_src="http://inlinethumb49.webshots.com/4592/2918638560100818464S425x425Q85.jpg"&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1980187" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/karstenj/archive/tags/Windows+Presentation+Foundation+_2800_Avalon_2900_/default.aspx">Windows Presentation Foundation (Avalon)</category><category domain="http://blogs.msdn.com/karstenj/archive/tags/3D/default.aspx">3D</category><category domain="http://blogs.msdn.com/karstenj/archive/tags/WPF/default.aspx">WPF</category></item><item><title>North Face Case Study Published</title><link>http://blogs.msdn.com/karstenj/archive/2007/03/22/north-face-case-study-published.aspx</link><pubDate>Thu, 22 Mar 2007 22:40:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1932897</guid><dc:creator>karstenj</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/karstenj/comments/1932897.aspx</comments><wfw:commentRss>http://blogs.msdn.com/karstenj/commentrss.aspx?PostID=1932897</wfw:commentRss><description>&lt;P&gt;&lt;A class="" href="http://www.microsoft.com/casestudies/casestudy.aspx?casestudyid=201147" mce_href="http://www.microsoft.com/casestudies/casestudy.aspx?casestudyid=201147"&gt;A case study about the North Face Kiosk&lt;/A&gt; is now posted to the Microsoft Case Studies site.&amp;nbsp; This is a nice write up, showing how the technology solved business problems, and explaining the larger context of how the kiosk plays into The North Face's overall marketing and sales goals. There are quite a few nice quotes about WPF in there and a shout out to WCF as well.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG style="WIDTH: 427px; HEIGHT: 343px" height=343 src="http://www.microsoft.com/casestudies/resources/Images/201147/figure1.jpg" width=427 mce_src="http://www.microsoft.com/casestudies/resources/Images/201147/figure1.jpg"&gt;&amp;nbsp; &lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1932897" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/karstenj/archive/tags/Windows+Presentation+Foundation+_2800_Avalon_2900_/default.aspx">Windows Presentation Foundation (Avalon)</category><category domain="http://blogs.msdn.com/karstenj/archive/tags/WPF/default.aspx">WPF</category></item><item><title>Inspired By Flash Math Creativity #3: WPF Flag </title><link>http://blogs.msdn.com/karstenj/archive/2007/03/08/inspired-by-flash-math-creativity-3-wpf-flag.aspx</link><pubDate>Fri, 09 Mar 2007 08:43:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1842104</guid><dc:creator>karstenj</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/karstenj/comments/1842104.aspx</comments><wfw:commentRss>http://blogs.msdn.com/karstenj/commentrss.aspx?PostID=1842104</wfw:commentRss><description>&lt;P&gt;There is a clever sample up on &lt;A target=_blank href="http://www.friendsofed.com/fmc/FMCv2/FMC.html" mce_href="http://www.friendsofed.com/fmc/FMCv2/FMC.html"&gt;Flash Math Creativity&lt;/A&gt;&amp;nbsp;by &lt;A href="http://www.actionscript.cl/" mce_href="http://www.actionscript.cl"&gt;Lifaros&lt;/A&gt;&amp;nbsp;that fundamentally does 2D morph meshing by chopping up an image into sections and then animating the sections, resulting in the effect of a flag waving.&amp;nbsp; I decided to implement something similar in WPF.&amp;nbsp; When I started thinking about how to chop up something in WPF, I remembered the &lt;A target=_blank href="http://msdn2.microsoft.com/en-us/library/ms771766.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/ms771766.aspx"&gt;Slide Puzzle&lt;/A&gt; sample from the SDK and I used it the foundation for how to chop, well, anything up in WPF.&amp;nbsp; (If you haven't checked out this sample, definitely do so!) &lt;/P&gt;
&lt;P&gt;In my sample, I only chop up an image, but nothing is stopping you from using this same technique to chop up a video, a document or the UI itself.&amp;nbsp; Once again, I used the custom animation classes to create the animation using &lt;STRONG&gt;Math.Sin&lt;/STRONG&gt;.&amp;nbsp; The slider allows you to modify the intensity of the wave. The result? The UN flag waving in the desert.&amp;nbsp; I'm not sure why.&amp;nbsp; &lt;A href="http://rhizohm.net/download/netfx3/wave.zip" mce_href="http://rhizohm.net/download/netfx3/wave.zip"&gt;Download source&lt;/A&gt; or &lt;A href="http://rhizohm.net/download/netfx3/apps/publish.htm" mce_href="http://rhizohm.net/download/netfx3/apps/publish.htm"&gt;run it&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://wpf.netfx3.com/direct/wave" mce_href="http://wpf.netfx3.com/direct/wave" border="0"&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&lt;IMG style="WIDTH: 637px; HEIGHT: 451px" src="http://rhizohm.net/download/netfx3/wave.jpg" width=637 height=451 mce_src="http://rhizohm.net/download/netfx3/wave.jpg"&gt;&lt;/P&gt;
&lt;P&gt;Here's the crux of the code:&lt;/P&gt;
&lt;P&gt;private void Chop()&lt;BR&gt;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; stackPanel.Children.Clear();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Image image = (Image)this.Resources["image"];&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; BitmapSource bitmap = (BitmapSource)image.Source;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Size size = new Size(bitmap.PixelWidth / 5, bitmap.PixelHeight / 5);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; image.Width = size.Width;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; image.Height = size.Height;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; float edgesize = 1.0f / numCols;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Set up viewbox appropriately for each tile.&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (int i = 0; i &amp;lt; numCols; i++)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Rectangle r = new Rectangle();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TranslateTransform t = new TranslateTransform();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; r.RenderTransform = t;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //this confused me at first!&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; r.SnapsToDevicePixels = true;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; VisualBrush vb = new VisualBrush(image);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //viewboxes are all relative to 1&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; vb.Viewbox = new Rect(edgesize * i, 0, edgesize, 1);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; vb.ViewboxUnits = BrushMappingMode.RelativeToBoundingBox;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; r.Fill = vb;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; r.Height = image.Height;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; r.Width = image.Width / numCols;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CircleAnimation ca = new CircleAnimation();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ca.Direction = CircleAnimation.DirectionEnum.YDirection;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ca.Radius = slider.Value;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ca.Duration = TimeSpan.FromSeconds(1);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ca.BeginTime = TimeSpan.FromMilliseconds(i * 10);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ca.RepeatBehavior = RepeatBehavior.Forever;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; t.BeginAnimation(TranslateTransform.YProperty, ca);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; stackPanel.Children.Add(r);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;&amp;nbsp;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1842104" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/karstenj/archive/tags/WPF/default.aspx">WPF</category><category domain="http://blogs.msdn.com/karstenj/archive/tags/Action+Script/default.aspx">Action Script</category></item><item><title>3D Cloth Source Code Posted: Technique for WPF 3D Morph Mesh</title><link>http://blogs.msdn.com/karstenj/archive/2007/02/26/3d-cloth-source-code-posted-technique-for-wpf-3d-morph-mesh.aspx</link><pubDate>Mon, 26 Feb 2007 22:44:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1765227</guid><dc:creator>karstenj</dc:creator><slash:comments>11</slash:comments><comments>http://blogs.msdn.com/karstenj/comments/1765227.aspx</comments><wfw:commentRss>http://blogs.msdn.com/karstenj/commentrss.aspx?PostID=1765227</wfw:commentRss><description>&lt;P&gt;There is a great 3D cloth demo that has been floating around interally for awhile and shown at conferences, talks, channel 9 interviews, etc. However, we haven't ever posted the source code . . . until now.&amp;nbsp; You can &lt;A target=_blank href="http://rhizohm.net/download/netfx3/apps/publish.htm" mce_href="http://rhizohm.net/download/netfx3/apps/publish.htm"&gt;run it from here&lt;/A&gt; and download the &lt;A href="http://rhizohm.net/download/netfx3/3dcloth.zip" mce_href="http://rhizohm.net/download/netfx3/3dcloth.zip"&gt;source code here&lt;/A&gt;. &lt;/P&gt;
&lt;P&gt;I didn't write this code; David Teitlebaum, from the WPF team,&amp;nbsp;did. He was hesitant to release it as the code&amp;nbsp;isn't factored to his liking, but I convinced him otherwise.&amp;nbsp;&amp;nbsp;His code is interesting to read: &lt;STRONG&gt;Thing3D&lt;/STRONG&gt; is my personal&amp;nbsp;favorite&amp;nbsp;class.&amp;nbsp;It is also worth calling out&amp;nbsp;that he uses no XAML and he also uses&amp;nbsp;a &lt;STRONG&gt;MatrixCamera&lt;/STRONG&gt; instead of&amp;nbsp;the&amp;nbsp;more easy-to-grok&amp;nbsp;&lt;STRONG&gt;PerspectiveCamera&lt;/STRONG&gt; and &lt;STRONG&gt;OrthographicCamera&lt;/STRONG&gt;.&amp;nbsp; And&amp;nbsp;the technique he uses for morphing the mesh is to swap out vertices on the fly using a timer, again not for the feint of heart. But, if you already know 3D paradigms and are wondering how to create stunning effects like this in WPF, this source code will be illuminating for you.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;If you can't run the application because you either aren't on Vista or haven't installed .NET 3.0 on XP, here are some pics to give you a sense of the effect as the cloth, which is really just a 20 x 20 vertice plane, drops onto a sphere, bounces and slides onto a cube:&lt;/P&gt;
&lt;P mce_keep="true"&gt;&lt;IMG style="WIDTH: 855px; HEIGHT: 737px" src="http://rhizohm.net/download/netfx3/cloth1.png" width=855 height=737 mce_src="http://rhizohm.net/download/netfx3/cloth1.png"&gt;&lt;/P&gt;
&lt;P&gt;You can &lt;A target=_blank href="http://wpf.netfx3.com/direct/3dcloth2/mysecondprogram.application" mce_href="http://wpf.netfx3.com/direct/3dcloth2/mysecondprogram.application"&gt;run it from here&lt;/A&gt; and download the &lt;A href="http://wpf.netfx3.com/files/folders/code_snippets/entry9068.aspx" mce_href="http://wpf.netfx3.com/files/folders/code_snippets/entry9068.aspx"&gt;source code here&lt;/A&gt;. &lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1765227" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/karstenj/archive/tags/3D/default.aspx">3D</category><category domain="http://blogs.msdn.com/karstenj/archive/tags/WPF/default.aspx">WPF</category></item><item><title>Inspired By Flash Math Creativity #2: WPF Planets</title><link>http://blogs.msdn.com/karstenj/archive/2007/02/23/inspired-by-flash-math-creativity-2-wpf-planets.aspx</link><pubDate>Sat, 24 Feb 2007 00:45:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1749785</guid><dc:creator>karstenj</dc:creator><slash:comments>8</slash:comments><comments>http://blogs.msdn.com/karstenj/comments/1749785.aspx</comments><wfw:commentRss>http://blogs.msdn.com/karstenj/commentrss.aspx?PostID=1749785</wfw:commentRss><description>&lt;P&gt;My next inspiration from the algorithms introduced in &lt;A target=_blank href="http://www.friendsofed.com/fmc/FMCv2/FMC.html" mce_href="http://www.friendsofed.com/fmc/FMCv2/FMC.html"&gt;Flash Math Creativity&lt;/A&gt;&amp;nbsp;was based on the work of &lt;A target=_blank href="http://www.nooflat.nu/" mce_href="http://www.nooflat.nu/"&gt;Jamie MacDonald&lt;/A&gt;. In looking at his work,&amp;nbsp; I quickly realized that I was going to need to brush up on my trigonometry skills. This led me to another great Friend of Ed book, &lt;A target=_blank href="http://www.friendsofed.com/book.html?isbn=1590595181" mce_href="http://www.friendsofed.com/book.html?isbn=1590595181"&gt;Foundation ActionScript Animation: Making Things Move&lt;/A&gt;, which has some great trigonometry for animation explanations.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;You can see the&amp;nbsp;results of my latest experiment &lt;A target=_blank href="http://rhizohm.net/download/netfx3/apps/planets.xbap" mce_href="http://rhizohm.net/download/netfx3/apps/planets.xbap"&gt;here&lt;/A&gt; and the code is &lt;A href="http://rhizohm.net/download/netfx3/planets/planets.zip" mce_href="http://rhizohm.net/download/netfx3/planets/planets.zip"&gt;here&lt;/A&gt;. Just to make sure I was up an running with basic trig, I created a sine wave in 01 as follows:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://wpf.netfx3.com/direct/planets"&gt;&lt;IMG style="MARGIN: 0px 10px 10px" border=0 align=left src="http://rhizohm.net/download/netfx3/p1.jpg"&gt;&lt;/A&gt;double x = 0;&lt;BR&gt;double y = 0;&lt;BR&gt;double angle = 0;&lt;BR&gt;for (int i = 0; i &amp;lt; 500; i++)&lt;BR&gt;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; x += 1;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; y = 200 + Math.Sin(angle) * 50;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Ellipse el = new Ellipse();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; el.Width = 2;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; el.Height = 2;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; el.Fill = Brushes.Red;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Canvas.SetLeft(el, x);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Canvas.SetTop(el, y);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; stage.Children.Add(el);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; angle += .05;&amp;nbsp; }&lt;/P&gt;
&lt;P&gt;Nothing fancy here.&amp;nbsp; To make a circle, I changed the x to be x = Math.Cos(angle) * 50.&amp;nbsp; This is the basis for doing circle and ellipse animations.&amp;nbsp; Now, instead of trying to do animations using &lt;STRONG&gt;CompositionTarget.Rendering&lt;/STRONG&gt;, I remembered that the SDK has a great sample called &lt;A target=_blank href="http://msdn2.microsoft.com/en-us/library/ms771715.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/ms771715.aspx"&gt;CustomAnimations&lt;/A&gt;, in which a CircleAnimation exists already using this formula.&amp;nbsp; Here's the key code where it overrides&amp;nbsp;the &lt;STRONG&gt;GetCurrentValueCore&lt;/STRONG&gt; method to create the circle effect using basic trig:&lt;/P&gt;
&lt;P&gt;protected override double GetCurrentValueCore(double defaultOriginValue, double defaultDestinationValue, AnimationClock clock)&lt;BR&gt;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; double returnValue;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; double time = clock.CurrentProgress.Value;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // math magic: calculate new coordinates using polar coordinate equations. This requires two &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // animations to be wired up in order to move in a circle, since we don't make any assumptions&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // about what we're animating (e.g. a TranslateTransform). &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (Direction == DirectionEnum.XDirection)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; returnValue = Math.Cos(2 * Math.PI * time);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; returnValue = Math.Sin(2 * Math.PI * time);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Need to add the defaultOriginValue so that composition works.&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return returnValue * Radius + defaultOriginValue;&lt;BR&gt;}&lt;BR&gt;&lt;/P&gt;
&lt;P&gt;At first, I used this in code to create the effect of these circles circling toward you using BeginAnimation, based on the TowardUs sample in the Flash Math Creativity book (the very first sample):&lt;/P&gt;
&lt;P&gt;&lt;A href="http://wpf.netfx3.com/direct/planets"&gt;&lt;IMG style="MARGIN: 0px 10px 10px" border=0 align=right src="http://rhizohm.net/download/netfx3/p2.jpg"&gt;&lt;/A&gt;CircleAnimation cx = new CircleAnimation();&lt;BR&gt;cx.Duration = new Duration(TimeSpan.FromSeconds(1.5));&lt;BR&gt;cx.Direction = CircleAnimation.DirectionEnum.XDirection;&lt;BR&gt;cx.Radius = 150;&lt;BR&gt;cx.RepeatBehavior = RepeatBehavior.Forever;&lt;/P&gt;
&lt;P&gt;CircleAnimation cy = new CircleAnimation();&lt;BR&gt;cy.Duration = new Duration(TimeSpan.FromSeconds(1.5));&lt;BR&gt;cy.Direction = CircleAnimation.DirectionEnum.YDirection;&lt;BR&gt;cy.Radius = 150;&lt;BR&gt;cy.RepeatBehavior = RepeatBehavior.Forever;&lt;/P&gt;
&lt;P&gt;stage.Children.Add(el);&lt;BR&gt;el.BeginAnimation(Ellipse.OpacityProperty, opacityAnimation);&lt;BR&gt;st.BeginAnimation(ScaleTransform.ScaleXProperty, d);&lt;BR&gt;st.BeginAnimation(ScaleTransform.ScaleYProperty, d);&lt;BR&gt;tt.BeginAnimation(TranslateTransform.XProperty, cx);&lt;BR&gt;tt.BeginAnimation(TranslateTransform.YProperty, cy);&lt;/P&gt;
&lt;P&gt;This resulted in 03.&amp;nbsp; It worked, but the code started getting ugly as far as getting each circle to fire when I wanted it to.&amp;nbsp; I found myself using a timer&amp;nbsp;and wiring up an anonymous delegate.&amp;nbsp;I realized &lt;STRONG&gt;Storyboards&lt;/STRONG&gt; and &lt;STRONG&gt;ParallelTimelines&lt;/STRONG&gt; would serve me much better, which are much easier to wire up in XAML than in code.&amp;nbsp; So,&amp;nbsp; 04 is the same thing, but a XAML solution instead:&lt;/P&gt;
&lt;P&gt;&amp;lt;ParallelTimeline BeginTime="0:0:0"&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;lt;DoubleAnimation&amp;nbsp; Duration="0:0:1.5" To="25" Storyboard.TargetName="ellipse0" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)"/&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;lt;DoubleAnimation Duration="0:0:1.5"&amp;nbsp; To="25" Storyboard.TargetName="ellipse0" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)"/&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;lt;DoubleAnimation Duration="0:0:1.5" From="1"&amp;nbsp; To="0" Storyboard.TargetName="ellipse0" Storyboard.TargetProperty="(UIElement.Opacity)"/&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;lt;CustomAnimations:CircleAnimation Duration="0:0:1.5" Radius="150" Direction="YDirection" Storyboard.TargetName="ellipse0" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[1].(TranslateTransform.Y)"/&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;lt;CustomAnimations:CircleAnimation Duration="0:0:1.5" Radius="150" Direction="XDirection" Storyboard.TargetName="ellipse0" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[1].(TranslateTransform.X)"/&amp;gt;&lt;BR&gt;&amp;lt;/ParallelTimeline&amp;gt;&lt;/P&gt;
&lt;P&gt;By using parallel timelines I could structure my animations and when they fired. &lt;/P&gt;
&lt;P&gt;A nice thing about this CustomAnimation is that it can be applied to 3D animations as well, applied to the &lt;STRONG&gt;TranslateTransform3D&lt;/STRONG&gt; which I did 05, changing the &lt;STRONG&gt;Radius&lt;/STRONG&gt; property to be much smaller to fit the coordinates I was using for my ViewPort.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&lt;A href="http://wpf.netfx3.com/direct/planets"&gt;&lt;IMG style="MARGIN: 0px 10px 10px" border=0 align=left src="http://rhizohm.net/download/netfx3/p3.jpg"&gt;&lt;/A&gt;void towardus3d_Loaded(object sender, RoutedEventArgs e)&lt;BR&gt;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sphere = new GeometryModel3D(sphereFactory.Mesh, materialGreen);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ModelVisual3D mv3d = myViewPort3D.Children[1] as ModelVisual3D;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; mv3d.Content = sphere;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CircleAnimation ca3d_y = new CircleAnimation();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ca3d_y.Duration = TimeSpan.FromSeconds(5);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ca3d_y.RepeatBehavior = RepeatBehavior.Forever;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ca3d_y.Radius = .5;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ca3d_y.Direction = CircleAnimation.DirectionEnum.YDirection;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CircleAnimation ca3d_x = new CircleAnimation();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ca3d_x.Duration = TimeSpan.FromSeconds(5);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ca3d_x.RepeatBehavior = RepeatBehavior.Forever;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ca3d_x.Radius = .5;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ca3d_x.Direction = CircleAnimation.DirectionEnum.XDirection;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ModelTranslate.BeginAnimation(TranslateTransform3D.OffsetYProperty, ca3d_y);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ModelTranslate.BeginAnimation(TranslateTransform3D.OffsetXProperty, ca3d_x);&lt;BR&gt;}&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It then dawned on me, as I looked at 05, an orbiting sphere, that it&amp;nbsp;would make for great planets.&amp;nbsp;&amp;nbsp;I went out to &lt;A target=_blank href="http://maps.jpl.nasa.gov/jupiter.html" mce_href="http://maps.jpl.nasa.gov/jupiter.html"&gt;NASA&lt;/A&gt; and found the texture&amp;nbsp;maps for Jupiter and its moons.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;I also wanted to do all of this 3D work in XAML, so I made a class called &lt;STRONG&gt;SphereModelVisual3D&lt;/STRONG&gt; that I could instantiate Jupiter, for example, like this:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://wpf.netfx3.com/direct/planets"&gt;&lt;IMG style="MARGIN: 0px 10px 10px" border=0 align=right src="http://rhizohm.net/download/netfx3/p4.jpg"&gt;&lt;/A&gt;&amp;lt;mv3d:SphereModelVisual3D x:Name="Jupiter" &amp;gt;&lt;BR&gt;&amp;nbsp; &amp;lt;mv3d:SphereModelVisual3D.Material&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;DiffuseMaterial&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;DiffuseMaterial.Brush &amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;ImageBrush ImageSource="&lt;A href="http://maps.jpl.nasa.gov/pix/jup0vss1.jpg%22/"&gt;http://maps.jpl.nasa.gov/pix/jup0vss1.jpg%22/&lt;/A&gt;&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/DiffuseMaterial.Brush&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/DiffuseMaterial&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;lt;/mv3d:SphereModelVisual3D.Material&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;mv3d:SphereModelVisual3D.Transform&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Transform3DGroup &amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;ScaleTransform3D ScaleX="2" ScaleY="2"&amp;nbsp; ScaleZ="2" /&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;RotateTransform3D&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;RotateTransform3D.Rotation&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;AxisAngleRotation3D Angle="0" Axis="0 1 0" x:Name="Jupiter_rotation"&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/AxisAngleRotation3D&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/RotateTransform3D.Rotation&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/RotateTransform3D&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;TranslateTransform3D OffsetX="0" OffsetY="0" OffsetZ="0" /&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/Transform3DGroup&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;lt;/mv3d:SphereModelVisual3D.Transform&amp;gt;&lt;BR&gt;&amp;lt;/mv3d:SphereModelVisual3D&amp;gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The animation that handles the elliptical orbits needs to transform the Z property the TranslateTransform3D.&amp;nbsp; It then looks like this:&lt;/P&gt;
&lt;P&gt;&amp;lt;ParallelTimeline RepeatBehavior="Forever"&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;lt;DoubleAnimation Duration="0:0:10"&amp;nbsp; To="360"&amp;nbsp; Storyboard.TargetName="Jupiter_rotation" Storyboard.TargetProperty="Angle"/&amp;gt;&lt;BR&gt;&amp;lt;/ParallelTimeline&amp;gt;&lt;BR&gt;&amp;lt;ParallelTimeline RepeatBehavior="Forever"&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;lt;CustomAnimations:CircleAnimation Duration="0:0:2"&amp;nbsp; Radius="9" Direction="YDirection" Storyboard.TargetName="Io" Storyboard.TargetProperty="(ModelVisual3D.Transform).(Transform3DGroup.Children)[2].(TranslateTransform3D.OffsetZ)"/&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;lt;CustomAnimations:CircleAnimation Duration="0:0:2"&amp;nbsp; Radius="2" Direction="XDirection" Storyboard.TargetName="Io" Storyboard.TargetProperty="(ModelVisual3D.Transform).(Transform3DGroup.Children)[2].(TranslateTransform3D.OffsetX)"/&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;lt;DoubleAnimation Duration="0:0:2"&amp;nbsp; To="360"&amp;nbsp; Storyboard.TargetName="Io_rotation" Storyboard.TargetProperty="Angle"/&amp;gt;&lt;BR&gt;&amp;lt;/ParallelTimeline&amp;gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The result is in 06. It is not astronomically correct as far as scale&amp;nbsp;-- I'll leave that for someone with some more time on their hands, but I liked the end result.&amp;nbsp; I also threw in the TrackBall control from the &lt;A target=_blank href="http://www.codeplex.com/3DTools" mce_href="http://www.codeplex.com/3DTools"&gt;3d tools project&lt;/A&gt; so you can trackball the whole model. &lt;/P&gt;
&lt;P mce_keep="true"&gt;The code is &lt;A href="http://wpf.netfx3.com/direct/planets/planets.zip" mce_href="http://wpf.netfx3.com/direct/planets/planets.zip"&gt;here&lt;/A&gt;.&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1749785" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/karstenj/archive/tags/Windows+Presentation+Foundation+_2800_Avalon_2900_/default.aspx">Windows Presentation Foundation (Avalon)</category><category domain="http://blogs.msdn.com/karstenj/archive/tags/3D/default.aspx">3D</category><category domain="http://blogs.msdn.com/karstenj/archive/tags/WPF/default.aspx">WPF</category><category domain="http://blogs.msdn.com/karstenj/archive/tags/Avalon/default.aspx">Avalon</category><category domain="http://blogs.msdn.com/karstenj/archive/tags/Flash/default.aspx">Flash</category></item><item><title>Inspired By Flash Math Creativity: WPF Flowers</title><link>http://blogs.msdn.com/karstenj/archive/2007/02/16/inspired-by-flash-math-creativity-wpf-flowers.aspx</link><pubDate>Fri, 16 Feb 2007 20:57:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1690605</guid><dc:creator>karstenj</dc:creator><slash:comments>7</slash:comments><comments>http://blogs.msdn.com/karstenj/comments/1690605.aspx</comments><wfw:commentRss>http://blogs.msdn.com/karstenj/commentrss.aspx?PostID=1690605</wfw:commentRss><description>&lt;P&gt;&lt;A href="http://winfx.members.winisp.net/flowers/"&gt;&lt;IMG style="MARGIN: 0px 10px 10px" src="http://winfx.members.winisp.net/images/flower.jpg" align=right border=0&gt;&lt;/A&gt;I've recently picked up a great book called &lt;A class="" href="http://www.friendsofed.com/fmc/FMCv2/FMC.html" target=_blank mce_href="http://www.friendsofed.com/fmc/FMCv2/FMC.html"&gt;Flash Math Creativity&lt;/A&gt;.&amp;nbsp; I been inspired by some of the techniques it outlines and have played around with similar ideas in WPF.&amp;nbsp; The exercise has been a fruitful one, in that I'm making some pleasing computer art while also learning about the differences between Action Script animation and WPF animation.&amp;nbsp; The first one I played with is flowers, inspired by the work of &lt;A class="" href="http://www.glenrhodes.com/" target=_blank mce_href="http://www.glenrhodes.com "&gt;Glen Rhodes&lt;/A&gt;, which is actually featured on the cover of the book.&amp;nbsp; You can &lt;A class="" href="http://winfx.members.winisp.net/flowers/" target=_blank mce_href="http://winfx.members.winisp.net/flowers/"&gt;see the results here&lt;/A&gt; and &lt;A class="" href="http://winfx.members.winisp.net/flowers.zip" mce_href="http://winfx.members.winisp.net/flowers.zip"&gt;download the code here&lt;/A&gt;. &lt;/P&gt;
&lt;P&gt;The first flower, which has no animation, is pretty simple. I just create 125 rectangles with a fill using a DrawingBrush I created in Blend.&amp;nbsp; I place each of the petals on the "stage", which in the case is a &lt;STRONG&gt;Grid&lt;/STRONG&gt;.&amp;nbsp; I use &lt;STRONG&gt;Grid&lt;/STRONG&gt; instead of &lt;STRONG&gt;Canvas&lt;/STRONG&gt; so that I get the goodness of the WPF layout engine for free without having to handle any positioning of the rectangles.&amp;nbsp; I then tranform the rotation and scale of each one to create the flower effect.&amp;nbsp; I also swap the ZIndex so that the large petals are in back and the smaller ones are in front. &lt;/P&gt;
&lt;P&gt;&lt;BR&gt;void OnLoaded(object sender, EventArgs e)&lt;BR&gt;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; int r = 0;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; double s = 0;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (int i=0; i &amp;lt; 125; i++)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Rectangle rect = new Rectangle();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rect.Width = 50;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rect.Height = 50;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rect.Fill = (DrawingBrush)this.FindResource("petal");&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TransformGroup tg = new TransformGroup();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; s += .01;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ScaleTransform st = new ScaleTransform(s * s * s + .1, s * s * s + .1);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; r += 27;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RotateTransform rt = new RotateTransform(r);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tg.Children.Add(st);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tg.Children.Add(rt);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rect.RenderTransform = tg;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Grid.SetZIndex(rect, -i);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; stage.Children.Add(rect);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;}&lt;/P&gt;
&lt;P&gt;&lt;A href="http://winfx.members.winisp.net/flowers/"&gt;&lt;IMG style="MARGIN: 0px 10px 10px" src="http://winfx.members.winisp.net/images/flower2.jpg" align=left border=0&gt;&lt;/A&gt;Where things get a little more interesting is when it comes to animating the flower. In Action Script, this kind of dynamic animation is handled through the very convenient &lt;STRONG&gt;onEnterFrame&lt;/STRONG&gt;.&amp;nbsp; This handler provides a per-frame callback for each individual movie clip, in which a function can be wired up.&amp;nbsp; There is no equivalent in WPF such that you get a per-frame callback &lt;EM&gt;for each element&lt;/EM&gt;.&amp;nbsp; The&amp;nbsp;closest thing to this concept is the &lt;STRONG&gt;CompositionTarget.Rendering&lt;/STRONG&gt; handler, which gets called per-frame for the entire tree (or page or stage, if you will.) &lt;/P&gt;
&lt;P&gt;It is possible to find each element you are looking for when this event gets fired and achieve a similar effect to &lt;STRONG&gt;onEnterFrame&lt;/STRONG&gt;.&amp;nbsp; I did just this in Page3.xaml, which ends up adding the following in addition to the loaded method:&lt;/P&gt;
&lt;P mce_keep="true"&gt;void CompositionTarget_Rendering(object sender, EventArgs e)&lt;BR&gt;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; foreach (UIElement uie in stage.Children)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TransformGroup tg = uie.RenderTransform as TransformGroup;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ScaleTransform st = tg.Children[0] as ScaleTransform;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (st.ScaleX &amp;gt; -3)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; st.ScaleX -= .1;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;}&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can see how I end up having to walk the tree, extracting the children and then acting on the children.&amp;nbsp; While this works, there are several disadvantages to this methodology.&amp;nbsp; First, having to figure out the animation for every UI element within a single callback has the potential to get quite unwieldy.&amp;nbsp; Second, using this method means we don't get all of the goodness of the WPF animation system, things like frame rate indepence, timelines, storyboards, repeat behaviors, autoreverse, etc.&amp;nbsp; So, let's see what this animation would look like using the WPF animation system:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://winfx.members.winisp.net/flowers/"&gt;&lt;IMG style="MARGIN: 0px 10px 10px" src="http://winfx.members.winisp.net/images/flower3.jpg" align=right border=0&gt;&lt;/A&gt;void Page2_Loaded(object sender, RoutedEventArgs e)&lt;BR&gt;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; int r = 0;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; double s = 0;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; DoubleAnimation d = new DoubleAnimation(-3, new Duration(TimeSpan.FromSeconds(2)));&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; d.AutoReverse = true;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; d.RepeatBehavior = RepeatBehavior.Forever;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (int i = 0; i &amp;lt; 125; i++)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Rectangle rect = new Rectangle();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rect.Width = 50;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rect.Height = 50;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rect.Opacity = .5;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rect.Fill = (DrawingBrush)this.FindResource("petal2");&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TransformGroup tg = new TransformGroup();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; s += .01;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ScaleTransform st = new ScaleTransform(s * s * s + .1, s * s * s + .1);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; r += 27;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RotateTransform rt = new RotateTransform(r);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tg.Children.Add(st);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tg.Children.Add(rt);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rect.RenderTransform = tg;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Grid.SetZIndex(rect, -i);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; st.BeginAnimation(ScaleTransform.ScaleXProperty, d);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; stage.Children.Add(rect);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;}&lt;/P&gt;
&lt;P&gt;With this code, I get to wire up an animation to each element -- in fact I'm wiring up the same animation, which simply animates the scale.&amp;nbsp; I get to use some of the features of the animation system, like AutoReverse and RepeatBehaviors.&amp;nbsp; And, I'm letting WPF calculate the timing instead of me doing it per-frame.&amp;nbsp; Much nicer, methinks.&lt;/P&gt;
&lt;P&gt;Those seasoned with the WPF samples can probably deduce where I derived the harness you toggle between the different animations. I took the basic idea from &lt;A class="" href="http://wpf.netfx3.com/files/folders/controls/entry8196.aspx" target=_blank mce_href="http://wpf.netfx3.com/files/folders/controls/entry8196.aspx"&gt;Kevin Moore's Bag-o-Tricks&lt;/A&gt; and then added the fading between frames from the custom frame in the WPF Feature Fest sample.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;I'm also now pointing all my WPF samples to an HTML page which checks to see if you have the framework installed and directs you to where you get it if you don't.&amp;nbsp; I took this from the Windows SDK and modified to to auto-redirect if .NET 3.0 is installed.&amp;nbsp; It is included in the source.&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1690605" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/karstenj/archive/tags/Windows+Presentation+Foundation+_2800_Avalon_2900_/default.aspx">Windows Presentation Foundation (Avalon)</category><category domain="http://blogs.msdn.com/karstenj/archive/tags/WPF/default.aspx">WPF</category><category domain="http://blogs.msdn.com/karstenj/archive/tags/Action+Script/default.aspx">Action Script</category></item><item><title>WPF Application Portfolio Wiki Updated -- More WPF Apps!</title><link>http://blogs.msdn.com/karstenj/archive/2007/02/09/wpf-application-portfolio-wiki-updated.aspx</link><pubDate>Sat, 10 Feb 2007 01:59:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1638052</guid><dc:creator>karstenj</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/karstenj/comments/1638052.aspx</comments><wfw:commentRss>http://blogs.msdn.com/karstenj/commentrss.aspx?PostID=1638052</wfw:commentRss><description>&lt;P&gt;&lt;A class="" href="http://blogs.msdn.com/tims" target=_blank mce_href="http://blogs.msdn.com/tims"&gt;Tim Sneath&lt;/A&gt;&amp;nbsp;has been doing a great job of blogging the many Vista/WPF showcase applications that are being deployed right now.&amp;nbsp; If you are looking for a quick list of URLs that you can hit for the .XBAP or .APPLICATION files, please go to the &lt;A class="" href="http://channel9.msdn.com/wiki/default.aspx/WPF.ApplicationPortfolio" target=_blank mce_href="http://channel9.msdn.com/wiki/default.aspx/WPF.ApplicationPortfolio"&gt;WPF Application Portfolio wiki&lt;/A&gt;, which I've updated with all the links, tagging them with the kind of deployment used -- very cool to see the number of .application and .xbap applications out there!&amp;nbsp; If you are doing a demo and trying to show someone the WPF portfolio, hopefully this wiki page will be useful -- and watch for more coming...&lt;/P&gt;
&lt;P&gt;I've also added some that Tim hasn't documented yet, in particular a whole bunch from Japan, as well as one from Metaliq on snowboarding visualization. Some screenshots below.&amp;nbsp; &lt;/P&gt;&lt;FONT size=2&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;A href="http://www.metaliq.com/wpf/"&gt;http://www.metaliq.com/wpf/&lt;/A&gt;&amp;nbsp;&lt;BR&gt;&lt;A href="http://weathernews.com/wpfglobal.xbap"&gt;&lt;FONT size=2&gt;http://weathernews.com/wpfglobal.xbap&lt;/FONT&gt;&lt;/A&gt;&lt;BR&gt;&lt;A href="http://sp.warnermycal.com/vista/contents/preview.xbap"&gt;&lt;FONT size=2&gt;http://sp.warnermycal.com/vista/contents/preview.xbap&lt;/FONT&gt;&lt;/A&gt;&lt;BR&gt;&lt;A href="http://www.shiseido.co.jp/biyou_dic_vista/shiseido.xbap"&gt;&lt;FONT size=2&gt;http://www.shiseido.co.jp/biyou_dic_vista/shiseido.xbap&lt;/FONT&gt;&lt;/A&gt;&lt;BR&gt;&lt;A href="http://www.dosv.jp/parts_assembler/PartsAssembler.xbap"&gt;&lt;FONT size=2&gt;http://www.dosv.jp/parts_assembler/PartsAssembler.xbap&lt;/FONT&gt;&lt;/A&gt;&lt;BR&gt;&lt;A href="http://japan.cnet.com/wpf/photo/"&gt;&lt;FONT size=2&gt;http://japan.cnet.com/wpf/photo/&lt;/FONT&gt;&lt;/A&gt;&lt;BR&gt;&lt;/P&gt;
&lt;P&gt;&lt;IMG style="WIDTH: 1024px; HEIGHT: 768px" height=768 src="http://www.metaliq.com/wpf/images/screen2full.jpg" width=1024 mce_src="http://www.metaliq.com/wpf/images/screen2full.jpg"&gt;&lt;/P&gt;
&lt;P&gt;&lt;IMG style="WIDTH: 697px; HEIGHT: 377px" height=377 src="http://winfx.members.winisp.net/images/1.png" width=697 mce_src="http://winfx.members.winisp.net/images/1.png"&gt;&lt;/P&gt;
&lt;P&gt;&lt;IMG style="WIDTH: 584px; HEIGHT: 400px" height=400 src="http://winfx.members.winisp.net/images/2.png" width=584 mce_src="http://winfx.members.winisp.net/images/2.png"&gt;&lt;/P&gt;
&lt;P&gt;&lt;IMG style="WIDTH: 700px; HEIGHT: 425px" height=425 src="http://winfx.members.winisp.net/images/3.png" width=700 mce_src="http://winfx.members.winisp.net/images/3.png"&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1638052" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/karstenj/archive/tags/Windows+Presentation+Foundation+_2800_Avalon_2900_/default.aspx">Windows Presentation Foundation (Avalon)</category><category domain="http://blogs.msdn.com/karstenj/archive/tags/WPF/default.aspx">WPF</category><category domain="http://blogs.msdn.com/karstenj/archive/tags/Avalon/default.aspx">Avalon</category><category domain="http://blogs.msdn.com/karstenj/archive/tags/weblive/default.aspx">weblive</category></item><item><title>Announcing Expression Blend Beta 2 and Expression Design Beta 1</title><link>http://blogs.msdn.com/karstenj/archive/2007/01/30/announcing-expression-blend-beta-2-and-expression-design-beta-1.aspx</link><pubDate>Wed, 31 Jan 2007 08:32:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1561764</guid><dc:creator>karstenj</dc:creator><slash:comments>6</slash:comments><comments>http://blogs.msdn.com/karstenj/comments/1561764.aspx</comments><wfw:commentRss>http://blogs.msdn.com/karstenj/commentrss.aspx?PostID=1561764</wfw:commentRss><description>&lt;P&gt;You can now go download &lt;A class="" href="http://www.microsoft.com/products/expression/en/Expression-Blend/try.mspx" target=_blank mce_href="http://www.microsoft.com/products/expression/en/Expression-Blend/try.mspx"&gt;Expression Blend Beta 2&lt;/A&gt; as well as &lt;A class="" href="http://www.microsoft.com/products/expression/en/expression-design/free-trial.mspx" target=_blank mce_href="http://www.microsoft.com/products/expression/en/expression-design/free-trial.mspx"&gt;Expression Design Beta 1&lt;/A&gt;. Both applications have received significant work since their last incarnation with tons of bugs fixed. Go give 'em a whirl.&lt;/P&gt;
&lt;P&gt;&lt;IMG style="WIDTH: 312px; HEIGHT: 213px" height=213 src="http://www.microsoft.com/products/expression/en/images/ex-blend/boxShot_Blend.jpg" width=312 mce_src="http://www.microsoft.com/products/expression/en/images/ex-blend/boxShot_Blend.jpg"&gt;&lt;IMG style="WIDTH: 312px; HEIGHT: 213px" height=213 src="http://www.microsoft.com/products/expression/en/images/ex-design/boxShot_Design.jpg" width=312 mce_src="http://www.microsoft.com/products/expression/en/images/ex-design/boxShot_Design.jpg"&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1561764" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/karstenj/archive/tags/Windows+Presentation+Foundation+_2800_Avalon_2900_/default.aspx">Windows Presentation Foundation (Avalon)</category><category domain="http://blogs.msdn.com/karstenj/archive/tags/WPF/default.aspx">WPF</category><category domain="http://blogs.msdn.com/karstenj/archive/tags/Avalon/default.aspx">Avalon</category><category domain="http://blogs.msdn.com/karstenj/archive/tags/Expression+Blend/default.aspx">Expression Blend</category></item><item><title>Databinding In Expression Blend: Forget the Data and Do the Bind</title><link>http://blogs.msdn.com/karstenj/archive/2007/01/26/databinding-in-expression-blend-forget-the-data-and-do-the-bind.aspx</link><pubDate>Fri, 26 Jan 2007 23:47:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1538016</guid><dc:creator>karstenj</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/karstenj/comments/1538016.aspx</comments><wfw:commentRss>http://blogs.msdn.com/karstenj/commentrss.aspx?PostID=1538016</wfw:commentRss><description>&lt;P&gt;I just posted a &lt;A class="" href="http://channel9.msdn.com/ShowPost.aspx?PostID=276212" target=_blank mce_href="http://channel9.msdn.com/ShowPost.aspx?PostID=276212"&gt;screencast&lt;/A&gt; showing how to wire up UI elements using Blend.&amp;nbsp; The general premise is that databinding in WPF is about more&amp;nbsp;than just data; it also allows you to connect UI properties, like wiring a slider up to a progress bar. Blend exposes this is a very useable way, once you know your way around.&amp;nbsp; I also use some cool styles from this &lt;A href="http://msdn.microsoft.com/msdnmag/issues/07/01/Foundations/default.aspx"&gt;Charles Petzold article&lt;/A&gt;&amp;nbsp;and show how, in Blend, you can extract a style and template from a piece of XAML to be reused in other parts of your application.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&lt;IMG style="WIDTH: 400px; HEIGHT: 424px" height=424 src="http://msdn.microsoft.com/msdnmag/issues/07/01/Foundations/fig12.gif" width=400 mce_src="http://msdn.microsoft.com/msdnmag/issues/07/01/Foundations/fig12.gif"&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1538016" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/karstenj/archive/tags/Windows+Presentation+Foundation+_2800_Avalon_2900_/default.aspx">Windows Presentation Foundation (Avalon)</category><category domain="http://blogs.msdn.com/karstenj/archive/tags/WPF/default.aspx">WPF</category><category domain="http://blogs.msdn.com/karstenj/archive/tags/Avalon/default.aspx">Avalon</category></item><item><title>Doninoken: WPF XBAP Piece by Bascule</title><link>http://blogs.msdn.com/karstenj/archive/2007/01/25/doninoken-wpf-xbap-piece-by-bascule.aspx</link><pubDate>Thu, 25 Jan 2007 23:01:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1531418</guid><dc:creator>karstenj</dc:creator><slash:comments>5</slash:comments><comments>http://blogs.msdn.com/karstenj/comments/1531418.aspx</comments><wfw:commentRss>http://blogs.msdn.com/karstenj/commentrss.aspx?PostID=1531418</wfw:commentRss><description>&lt;P&gt;Check out &lt;A class="" href="http://www.microsoft.com/japan/windowsvista/webshowcase/domino.htm" target=_blank mce_href="http://www.microsoft.com/japan/windowsvista/webshowcase/domino.htm"&gt;Doninoken&lt;/A&gt;, an amazing WPF piece that is part of the Japanese Vista launch, done by the design agency &lt;A class="" href="http://bascule.co.jp/" target=_blank mce_href="http://bascule.co.jp/"&gt;Bascule&lt;/A&gt;.&amp;nbsp;&amp;nbsp; The aesthetic is amazing.&amp;nbsp; I love how they use WPF 3D, mapping images on planes and animating the planes.&amp;nbsp;(Watch for the small camera that pops up after the title screen that lets you interact with the app and zoom the camera around.) &amp;nbsp;Still, how did they do it?&amp;nbsp; Maya exports? Hand tweaking XAML?&amp;nbsp; It is very impressive. And makes you want some sushi...&lt;/P&gt;
&lt;P&gt;&lt;A class="" href="http://www.microsoft.com/japan/windowsvista/webshowcase/domino.htm" target=_blank mce_href="http://www.microsoft.com/japan/windowsvista/webshowcase/domino.htm" border="0"&gt;&lt;IMG style="WIDTH: 750px; HEIGHT: 650px" height=650 src="http://www.microsoft.com/japan/windowsvista/webshowcase/images/domino.jpg" width=750 border=0 mce_src="http://www.microsoft.com/japan/windowsvista/webshowcase/images/domino.jpg"&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1531418" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/karstenj/archive/tags/Windows+Presentation+Foundation+_2800_Avalon_2900_/default.aspx">Windows Presentation Foundation (Avalon)</category><category domain="http://blogs.msdn.com/karstenj/archive/tags/3D/default.aspx">3D</category><category domain="http://blogs.msdn.com/karstenj/archive/tags/WPF/default.aspx">WPF</category></item></channel></rss>