<?xml version="1.0" encoding="utf-8"?><?xml-stylesheet type='text/xsl' href='http://pavanpodila.spaces.live.com/mmm2008-07-24_12.50/rsspretty.aspx?rssquery=en-US;http%3a%2f%2fpavanpodila.spaces.live.com%2fblog%2ffeed.rss' version='1.0'?><rss version="2.0" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:msn="http://schemas.microsoft.com/msn/spaces/2005/rss" xmlns:live="http://schemas.microsoft.com/live/spaces/2006/rss" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:cf="http://www.microsoft.com/schemas/rss/core/2005" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>the WPF way...: Blog</title><description /><link>http://pavanpodila.spaces.live.com/blog</link><language>en-US</language><pubDate>Tue, 25 Mar 2008 03:33:19 GMT</pubDate><lastBuildDate>Tue, 25 Mar 2008 03:33:19 GMT</lastBuildDate><generator>Microsoft Spaces v1.1</generator><docs>http://www.rssboard.org/rss-specification</docs><ttl>60</ttl><cf:parentRSS>http://pavanpodila.spaces.live.com/feed.rss</cf:parentRSS><live:type>blog</live:type><live:identity><live:id>-7161136268153875560</live:id><live:alias>pavanpodila</live:alias></live:identity><image><title>the WPF way...: Blog</title><url>http://byfiles.storage.live.com/y1p7TX43OT0ISbzlJNYd4u1jC5NAHKsG_GdVRDy9QPTj4GIy7X73ihluwOaUmToiAn3</url><link>http://pavanpodila.spaces.live.com/blog</link></image><cf:listinfo><cf:group ns="http://schemas.microsoft.com/live/spaces/2006/rss" element="typelabel" label="Type" /><cf:group ns="http://schemas.microsoft.com/live/spaces/2006/rss" element="tag" label="Tag" /><cf:group element="category" label="Category" /><cf:sort element="pubDate" label="Date" data-type="date" default="true" /><cf:sort element="title" label="Title" data-type="string" /><cf:sort ns="http://purl.org/rss/1.0/modules/slash/" element="comments" label="Comments" data-type="number" /></cf:listinfo><item><title>Moved my blog to "Pixel in Gene"</title><link>http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!654.entry</link><description>&lt;p&gt;Hello everyone! &lt;p&gt;           I have decided to move my blog to &lt;a href="http://blog.pixelingene.com"&gt;http://blog.pixelingene.com&lt;/a&gt;. This allows me greater control over making posts, adding images, attachments etc. Also I have the flexibility to play around with Page templates, CSS etc. Moving forward all posts will be made on &amp;quot;Pixel in Gene&amp;quot;. I'll retain this blog as there are still links pointing here. &lt;blockquote&gt; &lt;p&gt;I am in the process of moving all my posts. Once done I'll have a complete copy of &amp;quot;the WPF Way...&amp;quot;.&lt;/blockquote&gt; &lt;p&gt;Please update your feeds by visiting the blog !! &lt;p&gt;(&lt;a href="http://blog.pixelingene.com/"&gt;Pixel in Gene&lt;/a&gt;) &lt;p&gt;  &lt;p&gt;Thanks! &lt;p&gt;Pavan Podila&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-7161136268153875560&amp;page=RSS%3a+Moved+my+blog+to+%22Pixel+in+Gene%22&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=pavanpodila.spaces.live.com&amp;amp;GT1=pavanpodila"&gt;</description><comments>http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!654.entry#comment</comments><guid isPermaLink="true">http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!654.entry</guid><pubDate>Mon, 21 Jan 2008 17:31:17 GMT</pubDate><slash:comments>0</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://pavanpodila.spaces.live.com/blog/cns!9C9E888164859398!654/comments/feed.rss</wfw:commentRss><wfw:comment>http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!654.entry#comment</wfw:comment><dcterms:modified>2008-01-21T17:31:17Z</dcterms:modified></item><item><title>Community input on Write - Speak - Collaborate</title><link>http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!641.entry</link><description>&lt;p&gt;Over the past couple of months I have received fairly good response and feedback to some of the posts that I have made. I have also received some criticism that I don't share enough code. &lt;p&gt;Moving forward in 2008, I would like to change that, at least by making small steps. I would like to take the community's feedback and input on topics that are of supreme interest (eg. &lt;a href="http://pavanpodila.spaces.live.com/blog/cns!9C9E888164859398!380.entry"&gt;ElementFlow&lt;/a&gt;). Here is a short list I came up with: &lt;p&gt;  &lt;p&gt;&lt;strong&gt;Writing&lt;/strong&gt; &lt;ul&gt; &lt;li&gt;Blog posts on interesting ways of applying the WPF concepts/ideas &lt;li&gt;Custom control development (topics of interest to community) &lt;li&gt;Advanced topics in custom control development (mixing 3D, Adorners, virtualization, etc) &lt;li&gt;Design patterns &lt;li&gt;Creative experiments &lt;li&gt;Write a book ??&lt;/ul&gt; &lt;p&gt;I will definitely be publishing more source code! &lt;p&gt;  &lt;p&gt;&lt;strong&gt;Speaking&lt;/strong&gt; &lt;ul&gt; &lt;li&gt;Start off with presentations at local User groups. I am in the North East area of US. I guess I could easily drive within a 3-4 hr radius. So that would include New Jersey, New York, Connecticut, Maryland, Delaware, etc. If you run a User Group or know of some, please do let me know. &lt;li&gt;Speak at conferences&lt;/ul&gt; &lt;p&gt;  &lt;p&gt;&lt;strong&gt;Collaboration&lt;/strong&gt; &lt;ul&gt; &lt;li&gt;This could include some exclusive work &lt;li&gt;Side projects&lt;/ul&gt; &lt;p&gt;  &lt;p&gt;I am sure I can benefit from what the community thinks and it will also help me share / collaborate better. Looking forward to your views... &lt;p&gt;  &lt;div style="padding-right:0px;display:inline;padding-left:0px;padding-bottom:0px;margin:0px;padding-top:0px"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/wpf" rel=tag&gt;wpf&lt;/a&gt;, &lt;a href="http://technorati.com/tags/community" rel=tag&gt;community&lt;/a&gt;, &lt;a href="http://technorati.com/tags/sharing" rel=tag&gt;sharing&lt;/a&gt;&lt;/div&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-7161136268153875560&amp;page=RSS%3a+Community+input+on+Write+-+Speak+-+Collaborate&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=pavanpodila.spaces.live.com&amp;amp;GT1=pavanpodila"&gt;</description><comments>http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!641.entry#comment</comments><guid isPermaLink="true">http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!641.entry</guid><pubDate>Wed, 09 Jan 2008 14:21:01 GMT</pubDate><slash:comments>1</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://pavanpodila.spaces.live.com/blog/cns!9C9E888164859398!641/comments/feed.rss</wfw:commentRss><wfw:comment>http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!641.entry#comment</wfw:comment><dcterms:modified>2008-01-09T14:26:32Z</dcterms:modified></item><item><title>Degrafa goes live</title><link>http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!637.entry</link><description>&lt;p&gt;Although WPF development is my full-time activity, I also spend a considerable amount of time with &lt;a href="http://www.adobe.com/products/flex/"&gt;Adobe Flex&lt;/a&gt;. Over the past couple of weeks I have been involved in an exciting Open Source project called &lt;strong&gt;Degrafa&lt;/strong&gt;. Degrafa is a Declarative Graphics Framework for Flex that simplifies access to the Flash/Flex graphics API. People familiar with Flex know that creating simple shapes, paths requires Actionscript programming and cannot be done directly in MXML. This becomes very cumbersome especially when creating programmatic skins for Flex. &lt;p&gt;Degrafa aims to solve this by exposing the Flex graphics API in MXML. This opens up a whole new world of opportunities and creativity. If you think this is useful to you, make sure to drop by &lt;a href="http://www.degrafa.com"&gt;www.degrafa.com&lt;/a&gt;. We have recently announced a &lt;a href="http://www.degrafa.com/2008/01/03/degrafa-derby-win-a-flex-builder-3-license/"&gt;Degrafa Derby contest&lt;/a&gt; to award the most creative application built using the framework. &lt;p&gt;  &lt;p&gt;&lt;a href="http://www.degrafa.com/2008/01/01/degrafa-origin-released/"&gt;&lt;img style="border-right:0px;border-top:0px;border-left:0px;border-bottom:0px" height=117 alt=image src="http://tkfiles.storage.msn.com/y1p7NiTSwV6vwZg-ogxWvmopkRYnhmCiwznw5LRgPxdXsL7P3ExbBvPkhJghHuJRu6bOzyoobCq8eY?PARTNER=WRITER" width=436 border=0&gt;&lt;/a&gt; &lt;p&gt;  &lt;p&gt;We have lot of interesting features planned for the coming releases. There is also a converter app that will be made available for converting the juicy Degrafa graphics to XAML. Umm, I wonder who is writing that ;-) &lt;p&gt;  &lt;div style="padding-right:0px;display:inline;padding-left:0px;padding-bottom:0px;margin:0px;padding-top:0px"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/wpf" rel=tag&gt;wpf&lt;/a&gt;, &lt;a href="http://technorati.com/tags/xaml" rel=tag&gt;xaml&lt;/a&gt;, &lt;a href="http://technorati.com/tags/degrafa" rel=tag&gt;degrafa&lt;/a&gt;, &lt;a href="http://technorati.com/tags/flex" rel=tag&gt;flex&lt;/a&gt;&lt;/div&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-7161136268153875560&amp;page=RSS%3a+Degrafa+goes+live&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=pavanpodila.spaces.live.com&amp;amp;GT1=pavanpodila"&gt;</description><comments>http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!637.entry#comment</comments><guid isPermaLink="true">http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!637.entry</guid><pubDate>Mon, 07 Jan 2008 14:33:46 GMT</pubDate><slash:comments>0</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://pavanpodila.spaces.live.com/blog/cns!9C9E888164859398!637/comments/feed.rss</wfw:commentRss><wfw:comment>http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!637.entry#comment</wfw:comment><dcterms:modified>2008-01-07T14:33:46Z</dcterms:modified></item><item><title>Smooth animations, at the Window level</title><link>http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!634.entry</link><description>&lt;p&gt;If you have ever tried animating the Width / Height of a Window control, you would notice some jerkiness during the animation. This happens because the Window control is not really living entirely in the WPF sandbox. It is part WPF and part Native. To achieve a really smooth animation, you have &lt;strong&gt;GOT TO BE &lt;/strong&gt;inside the WPF sandbox. But how do I do it? &lt;p&gt;  &lt;p&gt;&lt;strong&gt;The AnimationWindow&lt;/strong&gt; &lt;p&gt;Creating animations directly on the Window is definitely not a desired solution. You have to first push the window contents (both the client-area and the non-client-area) into the WPF sandbox. You can do this by deriving from the &lt;a href="http://pavanpodila.spaces.live.com/blog/cns!9C9E888164859398!345.entry"&gt;GlassWindow&lt;/a&gt; control. You can create very customized ControlTemplates and replicate the look of a native window. You also have the flexibility of completely changing the look and feel of your application windows. This is a first step towards moving the Window content into the WPF sandbox. &lt;p&gt;However you still have the same problem when it comes to animating the window. That is because the GlassWindow is still using the native window wrapper and animating its Width / Height would still cause the jerkiness. What we need to do is push the entire window contents into a WPF control and then animate that control.  &lt;p&gt;This is exactly what the AnimationWindow does. It derives from GlassWindow and overrides its OnApplyTemplate() method. Inside the override it caches a reference to the top level container that contains the complete window contents (client + non-client). When you trigger resizing animations on the Window, the actual animation happens on this container. Since you are completely inside the WPF sandbox, the animations are smooth and your customers happy ;-). &lt;p&gt;  &lt;p&gt;&lt;strong&gt;So what's the Trick ?&lt;/strong&gt; &lt;p&gt;&lt;em&gt;&lt;strong&gt;[1] Derive from GlassWindow and override OnApplyTemplate()&lt;/strong&gt;&lt;/em&gt; &lt;p&gt; &lt;pre&gt;&lt;font size=3&gt;   &lt;/font&gt;&lt;font size=2&gt;[&lt;span style="color:rgb(43,145,175)"&gt;TemplatePart&lt;/span&gt;(Type = &lt;span style="color:rgb(0,0,255)"&gt;typeof&lt;/span&gt;(&lt;span style="color:rgb(43,145,175)"&gt;Grid&lt;/span&gt;), Name = &lt;span style="color:rgb(163,21,21)"&gt;&amp;quot;PART_WindowContent&amp;quot;&lt;/span&gt;)]
    &lt;span style="color:rgb(0,0,255)"&gt;public&lt;/span&gt; &lt;span style="color:rgb(0,0,255)"&gt;class&lt;/span&gt; &lt;span style="color:rgb(43,145,175)"&gt;AnimationWindow&lt;/span&gt; : &lt;/font&gt;&lt;font size=2&gt;&lt;span style="color:rgb(43,145,175)"&gt;GlassWindow
&lt;/span&gt;    {
        &lt;span style="color:rgb(0,0,255)"&gt;private&lt;/span&gt; &lt;span style="color:rgb(43,145,175)"&gt;Grid&lt;/span&gt; _contentGrid;
        &lt;span style="color:rgb(0,0,255)"&gt;private&lt;/span&gt; &lt;span style="color:rgb(43,145,175)"&gt;Storyboard&lt;/span&gt; _resizeAnimator;

        &lt;span style="color:rgb(0,0,255)"&gt;public&lt;/span&gt; &lt;span style="color:rgb(0,0,255)"&gt;static&lt;/span&gt; &lt;span style="color:rgb(0,0,255)"&gt;readonly&lt;/span&gt; &lt;span style="color:rgb(43,145,175)"&gt;DependencyProperty&lt;/span&gt; NewSizeProperty = &lt;span style="color:rgb(43,145,175)"&gt;DependencyProperty&lt;/span&gt;.Register(
            &lt;span style="color:rgb(163,21,21)"&gt;&amp;quot;NewSize&amp;quot;&lt;/span&gt;, &lt;span style="color:rgb(0,0,255)"&gt;typeof&lt;/span&gt;(&lt;span style="color:rgb(43,145,175)"&gt;Size&lt;/span&gt;), &lt;span style="color:rgb(0,0,255)"&gt;typeof&lt;/span&gt;(&lt;span style="color:rgb(43,145,175)"&gt;AnimationWindow&lt;/span&gt;), &lt;span style="color:rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="color:rgb(43,145,175)"&gt;PropertyMetadata&lt;/span&gt;(&lt;span style="color:rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="color:rgb(43,145,175)"&gt;Size&lt;/span&gt;()));

        &lt;span style="color:rgb(0,0,255)"&gt;public&lt;/span&gt; &lt;span style="color:rgb(43,145,175)"&gt;Size&lt;/span&gt; NewSize
        {
            &lt;span style="color:rgb(0,0,255)"&gt;get&lt;/span&gt; { &lt;span style="color:rgb(0,0,255)"&gt;return&lt;/span&gt; (&lt;span style="color:rgb(43,145,175)"&gt;Size&lt;/span&gt;)GetValue(NewSizeProperty); }
            &lt;span style="color:rgb(0,0,255)"&gt;set&lt;/span&gt; { SetValue(NewSizeProperty, &lt;span style="color:rgb(0,0,255)"&gt;value&lt;/span&gt;); }
        }


        &lt;span style="color:rgb(0,0,255)"&gt;static&lt;/span&gt; AnimationWindow()
        {
            DefaultStyleKeyProperty.OverrideMetadata(&lt;span style="color:rgb(0,0,255)"&gt;typeof&lt;/span&gt;(&lt;span style="color:rgb(43,145,175)"&gt;AnimationWindow&lt;/span&gt;), &lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font size=2&gt;&lt;span style="color:rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="color:rgb(43,145,175)"&gt;FrameworkPropertyMetadata&lt;/span&gt;(&lt;span style="color:rgb(0,0,255)"&gt;typeof&lt;/span&gt;(&lt;span style="color:rgb(43,145,175)"&gt;AnimationWindow&lt;/span&gt;)));
        }

        &lt;span style="color:rgb(0,0,255)"&gt;public&lt;/span&gt; &lt;span style="color:rgb(0,0,255)"&gt;override&lt;/span&gt; &lt;span style="color:rgb(0,0,255)"&gt;void&lt;/span&gt; OnApplyTemplate()
        {
            &lt;span style="color:rgb(0,0,255)"&gt;base&lt;/span&gt;.OnApplyTemplate();

            &lt;/font&gt;&lt;font size=2&gt;&lt;span style="color:rgb(0,128,0)"&gt;// Get a reference to the ContentGrid
&lt;/span&gt;            _contentGrid = GetChildControl&amp;lt;&lt;span style="color:rgb(43,145,175)"&gt;Grid&lt;/span&gt;&amp;gt;(&lt;span style="color:rgb(163,21,21)"&gt;&amp;quot;PART_WindowContent&amp;quot;&lt;/span&gt;);
        }&lt;/font&gt;&lt;/pre&gt;
&lt;blockquote&gt;&lt;pre&gt;&lt;font size=2&gt;}&lt;/font&gt;&lt;/pre&gt;&lt;/blockquote&gt;
&lt;p&gt;&lt;font face="Courier New" size=4&gt;&lt;/font&gt;
&lt;p dir=ltr style="margin-right:0px"&gt;Before starting the animation you need to set the &lt;strong&gt;NewSize &lt;/strong&gt;DependencyProperty. The &lt;em&gt;GetChildControl&amp;lt;T&amp;gt; &lt;/em&gt;is a protected method on GlassWindow. Inside OnApplyTemplate() I am caching the top-level container as &lt;strong&gt;_contentGrid&lt;/strong&gt;.
&lt;p dir=ltr style="margin-right:0px"&gt;&lt;strong&gt;&lt;em&gt;[2] Expose a method to animate window&lt;/em&gt;&lt;/strong&gt;
&lt;p dir=ltr style="margin-right:0px"&gt;&lt;strong&gt;&lt;/strong&gt; &lt;pre&gt; &lt;font size=2&gt;       &lt;span style="color:rgb(0,0,255)"&gt;public&lt;/span&gt; &lt;span style="color:rgb(0,0,255)"&gt;void&lt;/span&gt; &lt;strong&gt;ApplyResizeAnimation&lt;/strong&gt;()
        {
            &lt;span style="color:rgb(43,145,175)"&gt;Size&lt;/span&gt; currentSize = &lt;span style="color:rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="color:rgb(43,145,175)"&gt;Size&lt;/span&gt;(Width, Height);

            &lt;/font&gt;&lt;font size=2&gt;&lt;span style="color:rgb(0,128,0)"&gt;// Temporarily resize the ContentGrid to avoid automatic layout flashes
&lt;/span&gt;            _contentGrid.SetValue(WidthProperty, currentSize.Width);
            _contentGrid.SetValue(HeightProperty, currentSize.Height);

            &lt;span style="color:rgb(0,0,255)"&gt;if&lt;/span&gt; (NewSize.Width &amp;gt; currentSize.Width)
            {
                Width = NewSize.Width;
            }
            &lt;span style="color:rgb(0,0,255)"&gt;if&lt;/span&gt; (NewSize.Height &amp;gt; currentSize.Height)
            {
                Height = NewSize.Height;
            }

            PlayAnimation(currentSize);
        }

        &lt;span style="color:rgb(0,0,255)"&gt;private&lt;/span&gt; &lt;span style="color:rgb(0,0,255)"&gt;void&lt;/span&gt; PlayAnimation(&lt;span style="color:rgb(43,145,175)"&gt;Size&lt;/span&gt; currentSize)
        {
            &lt;/font&gt;&lt;font size=2&gt;&lt;span style="color:rgb(0,128,0)"&gt;// Create Storyboard
&lt;/span&gt;            _resizeAnimator = PrepareStoryboard(currentSize);
            _resizeAnimator.CurrentStateInvalidated += ResizeAnimator_CurrentStateInvalidated;
            _resizeAnimator.Begin(_contentGrid, &lt;span style="color:rgb(0,0,255)"&gt;true&lt;/span&gt;);
        }

        &lt;span style="color:rgb(0,0,255)"&gt;void&lt;/span&gt; ResizeAnimator_CurrentStateInvalidated(&lt;span style="color:rgb(0,0,255)"&gt;object&lt;/span&gt; sender, &lt;span style="color:rgb(43,145,175)"&gt;EventArgs&lt;/span&gt; e)
        {
            &lt;span style="color:rgb(43,145,175)"&gt;Clock&lt;/span&gt; clock = sender &lt;span style="color:rgb(0,0,255)"&gt;as&lt;/span&gt; &lt;span style="color:rgb(43,145,175)"&gt;Clock&lt;/span&gt;;
            &lt;span style="color:rgb(0,0,255)"&gt;if&lt;/span&gt; (clock.CurrentState != &lt;span style="color:rgb(43,145,175)"&gt;ClockState&lt;/span&gt;.Active)
            {
                Width = NewSize.Width;
                Height = NewSize.Height;

                &lt;/font&gt;&lt;font size=2&gt;&lt;span style="color:rgb(0,128,0)"&gt;// Clear Width/Height settings and switch to automatic layout
&lt;/span&gt;                _contentGrid.ClearValue(WidthProperty);
                _contentGrid.ClearValue(HeightProperty);

                _resizeAnimator.CurrentStateInvalidated -= ResizeAnimator_CurrentStateInvalidated;
                _resizeAnimator.Remove(_contentGrid);
            }
        }

        &lt;span style="color:rgb(0,0,255)"&gt;private&lt;/span&gt; &lt;span style="color:rgb(43,145,175)"&gt;Storyboard&lt;/span&gt; PrepareStoryboard(&lt;span style="color:rgb(43,145,175)"&gt;Size&lt;/span&gt; size)
        {
            &lt;span style="color:rgb(43,145,175)"&gt;Storyboard&lt;/span&gt; board = &lt;span style="color:rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="color:rgb(43,145,175)"&gt;Storyboard&lt;/span&gt;();
            board.FillBehavior = &lt;span style="color:rgb(43,145,175)"&gt;FillBehavior&lt;/span&gt;.HoldEnd;

            &lt;/font&gt;&lt;font size=2&gt;&lt;span style="color:rgb(0,128,0)"&gt;// Width
&lt;/span&gt;            &lt;span style="color:rgb(43,145,175)"&gt;DoubleAnimation&lt;/span&gt; wAnim = &lt;span style="color:rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="color:rgb(43,145,175)"&gt;DoubleAnimation&lt;/span&gt;(size.Width, NewSize.Width, &lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font size=2&gt;&lt;span style="color:rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="color:rgb(43,145,175)"&gt;Duration&lt;/span&gt;(&lt;span style="color:rgb(43,145,175)"&gt;TimeSpan&lt;/span&gt;.FromMilliseconds(500)));
            &lt;span style="color:rgb(43,145,175)"&gt;Storyboard&lt;/span&gt;.SetTargetProperty(wAnim, &lt;span style="color:rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="color:rgb(43,145,175)"&gt;PropertyPath&lt;/span&gt;(&lt;span style="color:rgb(163,21,21)"&gt;&amp;quot;(0)&amp;quot;&lt;/span&gt;, WidthProperty));

            &lt;/font&gt;&lt;font size=2&gt;&lt;span style="color:rgb(0,128,0)"&gt;// Height
&lt;/span&gt;            &lt;span style="color:rgb(43,145,175)"&gt;DoubleAnimation&lt;/span&gt; hAnim = &lt;span style="color:rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="color:rgb(43,145,175)"&gt;DoubleAnimation&lt;/span&gt;(size.Height, NewSize.Height, &lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font size=2&gt;&lt;span style="color:rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="color:rgb(43,145,175)"&gt;Duration&lt;/span&gt;(&lt;span style="color:rgb(43,145,175)"&gt;TimeSpan&lt;/span&gt;.FromMilliseconds(500)));
            &lt;span style="color:rgb(43,145,175)"&gt;Storyboard&lt;/span&gt;.SetTargetProperty(hAnim, &lt;span style="color:rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="color:rgb(43,145,175)"&gt;PropertyPath&lt;/span&gt;(&lt;span style="color:rgb(163,21,21)"&gt;&amp;quot;(0)&amp;quot;&lt;/span&gt;, HeightProperty));

            board.Children.Add(wAnim);
            board.Children.Add(hAnim);
            &lt;span style="color:rgb(0,0,255)"&gt;return&lt;/span&gt; board;
        }&lt;/font&gt;
&lt;/pre&gt;
&lt;p&gt;In ApplyResizeAnimation() I first explicitly set the Width + Height of the _contentGrid. I do this to avoid some automatic layout flashes. These would happen if my NewSize is greater than the current size. I then clear the explicit Width + Height settings when the animation gets over. Note that I am exploiting the &lt;a href="http://msdn2.microsoft.com/en-us/library/ms743230.aspx"&gt;precedence nature of the DependencyProperty&lt;/a&gt;. 
&lt;p&gt; 
&lt;p&gt;&lt;em&gt;&lt;strong&gt;[3] Create a ControlTemplate for the Window with transparency&lt;/strong&gt;&lt;/em&gt;&lt;pre&gt;&lt;font size=2&gt;&lt;span style="color:rgb(0,0,255)"&gt;    &amp;lt;&lt;/span&gt;&lt;span style="color:rgb(163,21,21)"&gt;Style&lt;/span&gt;&lt;span style="color:rgb(0,0,255)"&gt; &lt;/span&gt;&lt;span style="color:rgb(255,0,0)"&gt;x:Key&lt;/span&gt;&lt;span style="color:rgb(0,0,255)"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:rgb(0,0,255)"&gt;TestWindowStyle&lt;/span&gt;&amp;quot;
&lt;span style="color:rgb(0,0,255)"&gt;           &lt;/span&gt;&lt;span style="color:rgb(255,0,0)"&gt;TargetType&lt;/span&gt;&lt;span style="color:rgb(0,0,255)"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:rgb(0,0,255)"&gt;{x:Type Controls:AnimationWindow}&lt;/span&gt;&amp;quot;&lt;/font&gt;&lt;font size=2&gt;&lt;span style="color:rgb(0,0,255)"&gt;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color:rgb(163,21,21)"&gt;Setter&lt;/span&gt;&lt;span style="color:rgb(0,0,255)"&gt; &lt;/span&gt;&lt;span style="color:rgb(255,0,0)"&gt;Property&lt;/span&gt;&lt;span style="color:rgb(0,0,255)"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:rgb(0,0,255)"&gt;AllowsTransparency&lt;/span&gt;&amp;quot;
&lt;span style="color:rgb(0,0,255)"&gt;                &lt;/span&gt;&lt;span style="color:rgb(255,0,0)"&gt;Value&lt;/span&gt;&lt;span style="color:rgb(0,0,255)"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:rgb(0,0,255)"&gt;True&lt;/span&gt;&amp;quot;&lt;/font&gt;&lt;font size=2&gt;&lt;span style="color:rgb(0,0,255)"&gt;/&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color:rgb(163,21,21)"&gt;Setter&lt;/span&gt;&lt;span style="color:rgb(0,0,255)"&gt; &lt;/span&gt;&lt;span style="color:rgb(255,0,0)"&gt;Property&lt;/span&gt;&lt;span style="color:rgb(0,0,255)"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:rgb(0,0,255)"&gt;WindowStyle&lt;/span&gt;&amp;quot;
&lt;span style="color:rgb(0,0,255)"&gt;                &lt;/span&gt;&lt;span style="color:rgb(255,0,0)"&gt;Value&lt;/span&gt;&lt;span style="color:rgb(0,0,255)"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:rgb(0,0,255)"&gt;None&lt;/span&gt;&amp;quot;&lt;/font&gt;&lt;font size=2&gt;&lt;span style="color:rgb(0,0,255)"&gt;/&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color:rgb(163,21,21)"&gt;Setter&lt;/span&gt;&lt;span style="color:rgb(0,0,255)"&gt; &lt;/span&gt;&lt;span style="color:rgb(255,0,0)"&gt;Property&lt;/span&gt;&lt;span style="color:rgb(0,0,255)"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:rgb(0,0,255)"&gt;ResizeMode&lt;/span&gt;&amp;quot;
&lt;span style="color:rgb(0,0,255)"&gt;                &lt;/span&gt;&lt;span style="color:rgb(255,0,0)"&gt;Value&lt;/span&gt;&lt;span style="color:rgb(0,0,255)"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:rgb(0,0,255)"&gt;CanResize&lt;/span&gt;&amp;quot;&lt;/font&gt;&lt;font size=2&gt;&lt;span style="color:rgb(0,0,255)"&gt;/&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color:rgb(163,21,21)"&gt;Setter&lt;/span&gt;&lt;span style="color:rgb(0,0,255)"&gt; &lt;/span&gt;&lt;span style="color:rgb(255,0,0)"&gt;Property&lt;/span&gt;&lt;span style="color:rgb(0,0,255)"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:rgb(0,0,255)"&gt;Template&lt;/span&gt;&amp;quot;
&lt;span style="color:rgb(0,0,255)"&gt;                &lt;/span&gt;&lt;span style="color:rgb(255,0,0)"&gt;Value&lt;/span&gt;&lt;span style="color:rgb(0,0,255)"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:rgb(0,0,255)"&gt;{StaticResource TestWindow_Template}&lt;/span&gt;&amp;quot;&lt;/font&gt;&lt;font size=2&gt;&lt;span style="color:rgb(0,0,255)"&gt;/&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color:rgb(163,21,21)"&gt;Style&lt;/span&gt;&lt;/font&gt;&lt;span style="color:rgb(0,0,255)"&gt;&lt;font size=2&gt;&amp;gt;
&lt;/font&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;font size=2&gt; &lt;/font&gt;
&lt;p&gt;With all of these, your animations should run super smooth!
&lt;p&gt; 
&lt;p&gt;&lt;strong&gt;Getting Creative&lt;/strong&gt;
&lt;p&gt;Note that you can pull off some really exotic tricks with the AnimationWindow. Right now the resize animations are hard-coded. You can change that to expose a property on AnimationWindow to set custom Storyboards. If you club it with the &lt;a href="http://pavanpodila.spaces.live.com/blog/cns!9C9E888164859398!483.entry"&gt;TransitionContainer&lt;/a&gt;, you can even have Mac OSX style genie effects, right on the Desktop !!
&lt;p&gt; 
&lt;p&gt;&lt;a href="http://cid-9c9e888164859398.skydrive.live.com/self.aspx/Public/AnimationWindowTester.zip"&gt;Download EXE&lt;/a&gt;
&lt;p&gt; 
&lt;div style="padding-right:0px;display:inline;padding-left:0px;padding-bottom:0px;margin:0px;padding-top:0px"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/wpf" rel=tag&gt;wpf&lt;/a&gt;,&lt;a href="http://technorati.com/tags/xaml" rel=tag&gt;xaml&lt;/a&gt;,&lt;a href="http://technorati.com/tags/customcontrol" rel=tag&gt;customcontrol&lt;/a&gt;&lt;/div&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-7161136268153875560&amp;page=RSS%3a+Smooth+animations%2c+at+the+Window+level&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=pavanpodila.spaces.live.com&amp;amp;GT1=pavanpodila"&gt;</description><comments>http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!634.entry#comment</comments><guid isPermaLink="true">http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!634.entry</guid><pubDate>Fri, 04 Jan 2008 02:12:30 GMT</pubDate><slash:comments>2</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://pavanpodila.spaces.live.com/blog/cns!9C9E888164859398!634/comments/feed.rss</wfw:commentRss><wfw:comment>http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!634.entry#comment</wfw:comment><dcterms:modified>2008-01-04T02:12:30Z</dcterms:modified></item><item><title>Controlling Z-Index of children in Custom controls</title><link>http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!605.entry</link><description>&lt;p&gt;In WPF, the standard way to control Z-Index (programmatically) is to use Panel.SetZIndex(). However that works well only if you plan to use a list of children inside a Panel. What if you want to get the Z-Index functionality in your own custom controls ? &lt;p&gt;  &lt;p&gt;&lt;strong&gt;Override GetVisualChild()&lt;/strong&gt; &lt;p&gt;The way to do that is to override the GetVisualChild() method of your custom control.  &lt;p&gt;The GetVisualChild() requests for a Visual at a particular index. Generally you would return the child in the same order as in your internal visual collection. This gives you the effect of the Z-order, with the &lt;strong&gt;0th &lt;/strong&gt;child at the bottom-most position and the &lt;strong&gt;(n-1)th &lt;/strong&gt;child at the top-most position. If you want to change this default ordering, it is possible to do that by returning a different child at the requested index.  &lt;p&gt;&lt;strong&gt;Reversing Z-order&lt;/strong&gt; &lt;p&gt;Say you want to reverse the child order. In that case you could write your method like so:&lt;pre&gt;&lt;font size=4&gt;        &lt;span style="color:rgb(0,0,255)"&gt;protected&lt;/span&gt; &lt;span style="color:rgb(0,0,255)"&gt;override&lt;/span&gt; &lt;span style="color:rgb(43,145,175)"&gt;Visual&lt;/span&gt; GetVisualChild(&lt;span style="color:rgb(0,0,255)"&gt;int&lt;/span&gt; index)
        {
            &lt;span style="color:rgb(0,0,255)"&gt;if&lt;/span&gt; (index &amp;lt; 0 || index &amp;gt;= Children.Count)
            {
                &lt;span style="color:rgb(0,0,255)"&gt;throw&lt;/span&gt; &lt;span style="color:rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="color:rgb(43,145,175)"&gt;Exception&lt;/span&gt;(&lt;span style="color:rgb(163,21,21)"&gt;&amp;quot;Invalid Child index: &amp;quot;&lt;/span&gt; + index);
            }

            &lt;span style="color:rgb(0,0,255)"&gt;int&lt;/span&gt; zIndex = GetZIndex(index);
            &lt;span style="color:rgb(0,0,255)"&gt;return&lt;/span&gt; Children[zIndex];
        }
&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font size=4&gt;        &lt;span style="color:rgb(0,0,255)"&gt;private&lt;/span&gt; &lt;span style="color:rgb(0,0,255)"&gt;int&lt;/span&gt; GetZIndex(&lt;span style="color:rgb(0,0,255)"&gt;int&lt;/span&gt; index)
        {
            &lt;span style="color:rgb(0,0,255)"&gt;return&lt;/span&gt; (Children.Count - 1) - index;
        }

&lt;/font&gt;&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;Thus the trick with Z-ordering lies in the particular implementation of GetVisualChild().
&lt;p&gt; 
&lt;div style="padding-right:0px;display:inline;padding-left:0px;padding-bottom:0px;margin:0px;padding-top:0px"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/wpf" rel=tag&gt;wpf&lt;/a&gt;, &lt;a href="http://technorati.com/tags/z-oder" rel=tag&gt;z-oder&lt;/a&gt;, &lt;a href="http://technorati.com/tags/customcontrol" rel=tag&gt;customcontrol&lt;/a&gt;&lt;/div&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-7161136268153875560&amp;page=RSS%3a+Controlling+Z-Index+of+children+in+Custom+controls&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=pavanpodila.spaces.live.com&amp;amp;GT1=pavanpodila"&gt;</description><comments>http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!605.entry#comment</comments><guid isPermaLink="true">http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!605.entry</guid><pubDate>Sat, 15 Dec 2007 17:17:31 GMT</pubDate><slash:comments>0</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://pavanpodila.spaces.live.com/blog/cns!9C9E888164859398!605/comments/feed.rss</wfw:commentRss><wfw:comment>http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!605.entry#comment</wfw:comment><dcterms:modified>2007-12-15T17:20:41Z</dcterms:modified></item><item><title>WPF In Finance Contest [Promo Post]</title><link>http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!604.entry</link><description>&lt;p&gt;Got some great ideas? Want to do it in WPF and also earn some big bucks?  &lt;p&gt;A &amp;quot;YES&amp;quot; means you should check out Lab49's WPF Innovation Contest. &lt;p&gt;&lt;a href="http://wpfcontest.lab49.com/"&gt;&lt;img style="border-top-width:0px;border-left-width:0px;border-bottom-width:0px;border-right-width:0px" height=90 alt=image src="http://tkfiles.storage.msn.com/y1p7NiTSwV6vwYIcGkjw-MP7Cbm9ozAqPJcrFavFpBDnnj5V-ZmHACc7tV2TR4kSRYv_jIQBL6z7bE?PARTNER=WRITER" width=302 border=0&gt;&lt;/a&gt;  &lt;p&gt;  &lt;div style="padding-right:0px;display:inline;padding-left:0px;padding-bottom:0px;margin:0px;padding-top:0px"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/wpf" rel=tag&gt;wpf&lt;/a&gt;, &lt;a href="http://technorati.com/tags/contest" rel=tag&gt;contest&lt;/a&gt;, &lt;a href="http://technorati.com/tags/lab49" rel=tag&gt;lab49&lt;/a&gt;&lt;/div&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-7161136268153875560&amp;page=RSS%3a+WPF+In+Finance+Contest+%5bPromo+Post%5d&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=pavanpodila.spaces.live.com&amp;amp;GT1=pavanpodila"&gt;</description><comments>http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!604.entry#comment</comments><guid isPermaLink="true">http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!604.entry</guid><pubDate>Mon, 10 Dec 2007 16:59:57 GMT</pubDate><slash:comments>0</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://pavanpodila.spaces.live.com/blog/cns!9C9E888164859398!604/comments/feed.rss</wfw:commentRss><wfw:comment>http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!604.entry#comment</wfw:comment><dcterms:modified>2007-12-10T16:59:57Z</dcterms:modified></item><item><title>Improved DragDropManager - Source code</title><link>http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!571.entry</link><description>&lt;p&gt;The DragDropManger has been a very handy class for me in couple of my projects. Since my &lt;a href="http://pavanpodila.spaces.live.com/blog/cns!9C9E888164859398!229.entry"&gt;last post&lt;/a&gt; I made some changes to the interfaces (IDragSourceAdvisor, IDropTargetAdvisor) and also to DragDropManager. There are no major changes except for a few method additions in the interfaces. These methods make it even more flexible. &lt;p&gt;&lt;strong&gt;Changes to IDragSourceAdvisor and IDropTargetAdvisor&lt;/strong&gt; &lt;blockquote&gt; &lt;p&gt;&lt;strong&gt;Added method: UIElement GetTopContainer();&lt;/strong&gt; &lt;p&gt;In my previous version I had assumed there would be only one MainWindow. Hence I was using Application.Current.MainWindow as my default top container. Of course this assumption worked well for some of my projects but broke when I had to do DnD across windows. This lead me to add the GetTopContainer() method, which is queried for the right container (AdornerDecorator).  &lt;p&gt;How is this useful? Say for example you have a DragSource in one window and a DropTarget in another window. When an element in dragged onto the target window, the location of the feedback-UI is no longer relative to the MainWindow, instead it is relative to the target window. By querying the IDropTargetAdvisor for the top-container we can see the feedback-UI at the right place.  &lt;p&gt;[Note] If you are using just the MainWindow, you can return Application.Current.MainWindow as your top container.&lt;/blockquote&gt; &lt;blockquote&gt; &lt;p&gt;&lt;strong&gt;Added read-only property ApplyMouseOffset to IDropTargetAdvisor&lt;/strong&gt;&lt;/blockquote&gt; &lt;blockquote&gt; &lt;p&gt;When an element is moved from the source to the target, the initial click on the source-element may be at an offset inside its bounding-box. If the same offset needs to be applied to the feedback-UI on the target, the property ApplyMouseOffset can be set to True. In most cases you would set it as True. To accommodate a few outlier cases, this property had to be added.&lt;/blockquote&gt; &lt;p&gt;  &lt;p&gt;That is all for the changes. I hope you find the code useful.  If you do anything cool with it, I would love to know and shower praise on you ;) &lt;p&gt;  &lt;p&gt;&lt;a href="http://cid-9c9e888164859398.skydrive.live.com/self.aspx/Public/DragDrop.zip"&gt;Download DragDrop.zip&lt;/a&gt; &lt;p&gt;  &lt;div style="padding-right:0px;display:inline;padding-left:0px;padding-bottom:0px;margin:0px;padding-top:0px"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/wpf" rel=tag&gt;wpf&lt;/a&gt;, &lt;a href="http://technorati.com/tags/xaml" rel=tag&gt;xaml&lt;/a&gt;, &lt;a href="http://technorati.com/tags/dragdrop" rel=tag&gt;dragdrop&lt;/a&gt;&lt;/div&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-7161136268153875560&amp;page=RSS%3a+Improved+DragDropManager+-+Source+code&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=pavanpodila.spaces.live.com&amp;amp;GT1=pavanpodila"&gt;</description><comments>http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!571.entry#comment</comments><guid isPermaLink="true">http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!571.entry</guid><pubDate>Mon, 19 Nov 2007 14:14:24 GMT</pubDate><slash:comments>11</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://pavanpodila.spaces.live.com/blog/cns!9C9E888164859398!571/comments/feed.rss</wfw:commentRss><wfw:comment>http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!571.entry#comment</wfw:comment><dcterms:modified>2007-11-19T14:14:24Z</dcterms:modified></item><item><title>SlideDeckPanel - panel that does Card Deck layout</title><link>http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!559.entry</link><description>&lt;p&gt;In one of my recent explorations in a project I had to implement a panel layout that displayed its items as cards that have been fanned out right-&amp;gt;left.  &lt;p&gt;  &lt;p&gt;&lt;img style="border-top-width:0px;border-left-width:0px;border-bottom-width:0px;border-right-width:0px" height=156 alt=image src="http://tk4.storage.msn.com/y1p98pGElWCpu6lZqmokcXFEggD5NeGCC-7omJBMs-4QoIySHdiWluL0gmauoNoYXflhXokdtZ85FzsBwyNCtVSFA?PARTNER=WRITER" width=564 border=0&gt;  &lt;p&gt;  &lt;p&gt;Effectively the cards are laid out right-to-left, with the card on the right overlaying on the previous one. If the panel has enough space to accommodate all cards, there would be no overlap. As we keep increasing the number of cards, the amount of overlap increases appropriately.  &lt;p&gt;  &lt;p&gt;&lt;img style="border-top-width:0px;border-left-width:0px;border-bottom-width:0px;border-right-width:0px" height=584 alt=image src="http://tk4.storage.msn.com/y1p98pGElWCpu5tippd7M7XGbrnr1J3bfnvCeO2ZhkGNK7GEQJG7Jjfw9OkWZPzyPw5FOT8KM81-Y9rlDf-rBgtPQ?PARTNER=WRITER" width=558 border=0&gt;  &lt;p&gt;  &lt;p&gt;&lt;strong&gt;Selections and Hovers&lt;/strong&gt; &lt;p&gt;&lt;img style="border-top-width:0px;border-left-width:0px;border-bottom-width:0px;border-right-width:0px" height=507 alt=image src="http://tk4.storage.msn.com/y1p98pGElWCpu5oFVdA-tNtQ0N8clGVqveO9vOxd4yNB_BI9xxmt2xnr1aPGru7LWUIfGiUWAkFQ_gLvBw5Nv19QQ?PARTNER=WRITER" width=362 border=0&gt;  &lt;p&gt;Selections and Hovers are an integral part of interacting with a list of items. There are some default selection and hover behaviors that are associated with this layout. However we wanted to make it customizable from the component point-of-view. Thus it is possible for an user of this panel to provide custom animations for selection and de-selection. On the same note, it is also possible to create custom adorners for hovers. The selection + hover logic has been abstracted enough to keep things very simple. The programmer only needs to provide Storyboards for animating the selection/deselections. As regards the adorners for hovers, the panel only needs a ControlTemplate (with standard names for placeholders). &lt;p&gt;Using these ideas it is also possible to change the selection and hover animations on the fly. The following video demonstrates these concepts. I use two kinds of selections (None, JumpSelection) and two kinds of hovers. &lt;p&gt;  &lt;p&gt; &lt;div style="padding-right:0px;display:inline;padding-left:0px;padding-bottom:0px;margin:0px;padding-top:0px"&gt;&lt;div&gt;&lt;/div&gt;&lt;/div&gt; &lt;p&gt;  &lt;p&gt;In a future post I'll go over some details about how you can implement such dynamic custom controls/panels. &lt;p&gt;  &lt;div style="padding-right:0px;display:inline;padding-left:0px;padding-bottom:0px;margin:0px;padding-top:0px"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/wpf" rel=tag&gt;wpf&lt;/a&gt;, &lt;a href="http://technorati.com/tags/xaml" rel=tag&gt;xaml&lt;/a&gt;, &lt;a href="http://technorati.com/tags/panel" rel=tag&gt;panel&lt;/a&gt;&lt;/div&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-7161136268153875560&amp;page=RSS%3a+SlideDeckPanel+-+panel+that+does+Card+Deck+layout&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=pavanpodila.spaces.live.com&amp;amp;GT1=pavanpodila"&gt;</description><comments>http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!559.entry#comment</comments><guid isPermaLink="true">http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!559.entry</guid><pubDate>Tue, 06 Nov 2007 15:27:21 GMT</pubDate><slash:comments>1</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://pavanpodila.spaces.live.com/blog/cns!9C9E888164859398!559/comments/feed.rss</wfw:commentRss><wfw:comment>http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!559.entry#comment</wfw:comment><dcterms:modified>2007-11-06T15:27:21Z</dcterms:modified></item><item><title>File organization tip for Custom Control authors</title><link>http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!520.entry</link><description>&lt;p&gt;Custom controls can be fun to develop. Depending on the complexity of the control it would be a good practice to break it down into manageable pieces. While developing &lt;a href="http://pavanpodila.spaces.live.com/blog/cns!9C9E888164859398!380.entry"&gt;ElementFlow&lt;/a&gt;, I discovered such a technique which you may also find useful. &lt;p&gt;  &lt;p&gt;ElementFlow is a fairly complex custom control and there are many interacting pieces in it. Here is a quick listing: &lt;ul&gt; &lt;li&gt;3D setup &lt;li&gt;Handling meshes &lt;li&gt;Animations &lt;li&gt;Viewstates (Coverflow, Timeline, etc) &lt;li&gt;User input handling (Keyboard, Mouse)&lt;/ul&gt; &lt;p&gt;Putting all of this logic in the same file (ElementFlow.cs) made it a little cumbersome for me to navigate the file. Ofcourse I could use &lt;strong&gt;#region&lt;/strong&gt; and &lt;strong&gt;#endregion&lt;/strong&gt; to demarcate blocks of code but it was not that appealing. It works great to organize simpler elements like properties, fields, constructors, etc. &lt;p&gt;&lt;strong&gt;A Better way&lt;/strong&gt; &lt;p&gt;What I was really looking for was a higher-level logical organization. The answer lied in using &lt;strong&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/wa80x488(VS.80).aspx"&gt;Partial Classes&lt;/a&gt;&lt;/strong&gt;. It's a great language feature and should be exploited :) Most of us know that the Visual Designers in VS use partial classes to keep the code-behind separate from the &amp;quot;designer-vomit&amp;quot;. It keeps our code-behind neat and readable. As control-authors we can leverage this feature to our benefit. To better understand, let me describe the way I used it. &lt;p&gt;  &lt;p&gt;As described earlier, ElementFlow has many logical pieces. Using partial classes, these pieces can be pushed to separate files, keeping the original ElementFlow.cs file pretty short. I decided to organize it into four files: &lt;ol&gt; &lt;li&gt;&lt;strong&gt;ElementFlow.cs&lt;/strong&gt; : contains &lt;strong&gt;public-facing&lt;/strong&gt; properties, constructors and methods. This serves more like a definition of the control. &lt;li&gt;&lt;strong&gt;ElementFlow.3d.cs&lt;/strong&gt; : contains most of the Viewport3D, mesh-handling logic &lt;li&gt;&lt;strong&gt;ElementFlow.animation.cs&lt;/strong&gt; : contains creation of Storyboards, manipulating animations, viewstates etc &lt;li&gt;&lt;strong&gt;ElementFlow.input.cs&lt;/strong&gt; : contains logic to handle user-input&lt;/ol&gt; &lt;p&gt;  &lt;p&gt;Keeping such a separation has given me a convenient way to see the different parts of my control. In future when I have to expand the functionality I could manipulate one of these files [or create a new partial class]. Adopting a convention for file-naming could be the next step when your organization is primarily into custom control development. &lt;p&gt;  &lt;p&gt;As a side-thought, this post could be corollary to my &lt;a href="http://pavanpodila.spaces.live.com/blog/cns!9C9E888164859398!135.entry"&gt;earlier article on control development&lt;/a&gt;. &lt;p&gt;  &lt;div style="padding-right:0px;display:inline;padding-left:0px;padding-bottom:0px;margin:0px;padding-top:0px"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/wpf" rel=tag&gt;wpf&lt;/a&gt;, &lt;a href="http://technorati.com/tags/customcontrol" rel=tag&gt;customcontrol&lt;/a&gt;, &lt;a href="http://technorati.com/tags/elementflow" rel=tag&gt;elementflow&lt;/a&gt;&lt;/div&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-7161136268153875560&amp;page=RSS%3a+File+organization+tip+for+Custom+Control+authors&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=pavanpodila.spaces.live.com&amp;amp;GT1=pavanpodila"&gt;</description><comments>http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!520.entry#comment</comments><guid isPermaLink="true">http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!520.entry</guid><pubDate>Wed, 10 Oct 2007 17:00:45 GMT</pubDate><slash:comments>1</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://pavanpodila.spaces.live.com/blog/cns!9C9E888164859398!520/comments/feed.rss</wfw:commentRss><wfw:comment>http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!520.entry#comment</wfw:comment><dcterms:modified>2007-10-10T17:00:45Z</dcterms:modified></item><item><title>TransitionContainer: Easy transitions between views</title><link>http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!483.entry</link><description>&lt;p&gt;&lt;strong&gt;Transitions&lt;/strong&gt;, which is another word for animating between views, is a great way of keeping the user engaged as he interacts with your application. Most applications would contain a wide variety of views, where each view aids in interacting with a specific functionality of the application. When switching to a different view, a gradual animated change is far superior than an instant switch. It gives a context to the user telling him where he was earlier and where he is going to next. &lt;p&gt;&lt;strong&gt;TransitionContainer&lt;/strong&gt; is my custom control that can do a wide variety of transitions, 2D as well as 3D. It contains a bunch of transitions, which come out of the box as well as a really simple framework for creating custom transitions. The transitions that come by default or also implemented using the same framework. &lt;p&gt;Before I go into details about the framework, lets have a look at a video of the transitions in action. Below you can see my favorite transitions: Genie, Cube and Slide... you can tell where I get my inspiration from ;) &lt;p&gt;  &lt;div style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px"&gt;&lt;/div&gt; &lt;p&gt;  &lt;p&gt;&lt;strong&gt;TransitionContainer and the framework&lt;/strong&gt; &lt;p&gt;The TransitionContainer is a host element that takes care of all the nitty-gritties of applying transitions between views. A quick snippet of XAML shows its usage:&lt;pre&gt;&lt;font size=3&gt;&lt;span style="color:rgb(0,0,255)"&gt;    &amp;lt;&lt;/span&gt;&lt;span style="color:rgb(163,21,21)"&gt;Controls:TransitionContainer&lt;/span&gt;&lt;span style="color:rgb(0,0,255)"&gt; &lt;/span&gt;&lt;span style="color:rgb(255,0,0)"&gt;x:Name&lt;/span&gt;&lt;span style="color:rgb(0,0,255)"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:rgb(0,0,255)"&gt;_transContainer&lt;/span&gt;&amp;quot;&lt;/font&gt;&lt;font size=3&gt;&lt;span style="color:rgb(0,0,255)"&gt;&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="color:rgb(163,21,21)"&gt;Image&lt;/span&gt;&lt;span style="color:rgb(0,0,255)"&gt; &lt;/span&gt;&lt;span style="color:rgb(255,0,0)"&gt;x:Name&lt;/span&gt;&lt;span style="color:rgb(0,0,255)"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:rgb(0,0,255)"&gt;_image1&lt;/span&gt;&amp;quot;
&lt;span style="color:rgb(0,0,255)"&gt;             &lt;/span&gt;&lt;span style="color:rgb(255,0,0)"&gt;Source&lt;/span&gt;&lt;span style="color:rgb(0,0,255)"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:rgb(0,0,255)"&gt;/Resources/img1.jpg&lt;/span&gt;&amp;quot;
&lt;span style="color:rgb(0,0,255)"&gt;             &lt;/span&gt;&lt;span style="color:rgb(255,0,0)"&gt;Stretch&lt;/span&gt;&lt;span style="color:rgb(0,0,255)"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:rgb(0,0,255)"&gt;Fill&lt;/span&gt;&amp;quot;&lt;/font&gt;&lt;font size=3&gt;&lt;span style="color:rgb(0,0,255)"&gt;/&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="color:rgb(163,21,21)"&gt;Image&lt;/span&gt;&lt;span style="color:rgb(0,0,255)"&gt; &lt;/span&gt;&lt;span style="color:rgb(255,0,0)"&gt;x:Name&lt;/span&gt;&lt;span style="color:rgb(0,0,255)"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:rgb(0,0,255)"&gt;_image2&lt;/span&gt;&amp;quot;
&lt;span style="color:rgb(0,0,255)"&gt;             &lt;/span&gt;&lt;span style="color:rgb(255,0,0)"&gt;Source&lt;/span&gt;&lt;span style="color:rgb(0,0,255)"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:rgb(0,0,255)"&gt;/Resources/img2.jpg&lt;/span&gt;&amp;quot;
&lt;span style="color:rgb(0,0,255)"&gt;             &lt;/span&gt;&lt;span style="color:rgb(255,0,0)"&gt;Stretch&lt;/span&gt;&lt;span style="color:rgb(0,0,255)"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:rgb(0,0,255)"&gt;Fill&lt;/span&gt;&amp;quot;&lt;/font&gt;&lt;font size=3&gt;&lt;span style="color:rgb(0,0,255)"&gt;/&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color:rgb(163,21,21)"&gt;Controls:TransitionContainer&lt;/span&gt;&lt;/font&gt;&lt;span style="color:rgb(0,0,255)"&gt;&lt;font size=3&gt;&amp;gt;&lt;/font&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;Here the container contains a set of Images. In general it can contain any UIElement (aka views). TransitionContainer.&lt;strong&gt;Transition&lt;/strong&gt; property points to an instance of a class that implements the transition. A transition between two views can be invoked by calling TransitionContainer.&lt;strong&gt;ApplyTransition(string, string)&lt;/strong&gt;. The two string parameters point to the names of the two children between which the transition is applied. In the example above, the transition between the images can be applied by calling: &lt;pre&gt;&lt;font size=3&gt;            _transContainer.ApplyTransition(&amp;quot;_image2&amp;quot;, &amp;quot;_image1&amp;quot;);&lt;/font&gt;&lt;/pre&gt;
&lt;p&gt;&lt;font face="Courier New"&gt;&lt;/font&gt;&lt;font size=3&gt; &lt;/font&gt;
&lt;p&gt;You can see that it is really easy to use the control. Just dump all your views inside the TransitionContainer, set a Transition and call ApplyTransition(). Easy. 
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt; 
&lt;p&gt;&lt;strong&gt;Transitions&lt;/strong&gt;
&lt;p&gt;Transitions are pluggable classes and you can switch the transition to use at runtime (and at will ;)). Each transition derives from the abstract class &lt;strong&gt;Transition&lt;/strong&gt;:&lt;pre&gt;&lt;font size=2&gt;    &lt;span style="color:rgb(0,0,255)"&gt;public&lt;/span&gt; &lt;span style="color:rgb(0,0,255)"&gt;abstract&lt;/span&gt; &lt;span style="color:rgb(0,0,255)"&gt;class&lt;/span&gt; &lt;/font&gt;&lt;font size=2&gt;&lt;span style="color:rgb(43,145,175)"&gt;Transition
&lt;/span&gt;    {
        &lt;span style="color:rgb(0,0,255)"&gt;public&lt;/span&gt; &lt;span style="color:rgb(0,0,255)"&gt;abstract&lt;/span&gt; &lt;span style="color:rgb(0,0,255)"&gt;void&lt;/span&gt; Setup(&lt;span style="color:rgb(43,145,175)"&gt;Grid&lt;/span&gt; container, &lt;span style="color:rgb(43,145,175)"&gt;VisualBrush&lt;/span&gt; prevBrush, &lt;span style="color:rgb(43,145,175)"&gt;VisualBrush&lt;/span&gt; nextBrush);
        &lt;span style="color:rgb(0,0,255)"&gt;public&lt;/span&gt; &lt;span style="color:rgb(0,0,255)"&gt;abstract&lt;/span&gt; &lt;span style="color:rgb(0,0,255)"&gt;void&lt;/span&gt; PlayTransition(&lt;span style="color:rgb(43,145,175)"&gt;Grid&lt;/span&gt; container, &lt;span style="color:rgb(43,145,175)"&gt;TransitionContainer&lt;/span&gt; transContainer);
    }
&lt;/font&gt;&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;ApplyTransition() internally calls the Setup() method first followed by PlayTransition(). In Setup() you can create all the elements that are needed during the transition. PlayTransition() is where the actual transition will be seen on screen. Here you can run Storyboards on the elements you created earlier. At the end of the transition, you are supposed to call TransitionContainer.&lt;strong&gt;FinishTransition()&lt;/strong&gt;. This does some cleaning work, fires a &lt;strong&gt;TransitionCompleted &lt;/strong&gt;event and then brings the new view for user interaction.
&lt;p&gt;&lt;font color="#808080"&gt;[I am in the process of refactoring the APIs so that only the TransitionContainer would need to be passed into the Transition. The first parameter (Grid container) is unnecessarily exposing an implementation detail]&lt;/font&gt;
&lt;p&gt;I use the convention of suffixing all my transition classes with -Transition, as in GenieTransition. As a side note, the GenieTransition is actually very thin wrapper around my &lt;a href="http://pavanpodila.spaces.live.com/blog/cns!9C9E888164859398!230.entry"&gt;GenieAnimation&lt;/a&gt; class.
&lt;p&gt; 
&lt;div style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/wpf" rel=tag&gt;wpf&lt;/a&gt;, &lt;a href="http://technorati.com/tags/xaml" rel=tag&gt;xaml&lt;/a&gt;, &lt;a href="http://technorati.com/tags/genie" rel=tag&gt;genie&lt;/a&gt;, &lt;a href="http://technorati.com/tags/transition" rel=tag&gt;transition&lt;/a&gt;, &lt;a href="http://technorati.com/tags/customcontrol" rel=tag&gt;customcontrol&lt;/a&gt;&lt;/div&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-7161136268153875560&amp;page=RSS%3a+TransitionContainer%3a+Easy+transitions+between+views&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=pavanpodila.spaces.live.com&amp;amp;GT1=pavanpodila"&gt;</description><comments>http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!483.entry#comment</comments><guid isPermaLink="true">http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!483.entry</guid><pubDate>Thu, 30 Aug 2007 13:20:31 GMT</pubDate><slash:comments>5</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://pavanpodila.spaces.live.com/blog/cns!9C9E888164859398!483/comments/feed.rss</wfw:commentRss><wfw:comment>http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!483.entry#comment</wfw:comment><dcterms:modified>2007-08-30T13:23:08Z</dcterms:modified></item><item><title>The iPhone (-like) interface in WPF</title><link>http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!480.entry</link><description>&lt;p&gt;Sometime back I had worked on an internal Instant Messaging client for our company. We were looking for some inspiration for our client interface and at about the same time the &lt;a href="http://www.apple.com/iphone/"&gt;&lt;strong&gt;iPhone&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt; &lt;/strong&gt;was introduced. After a lot of thought (which was like &amp;quot;few minutes&amp;quot;), we decided to mimic the iPhone interface for our client. &lt;p&gt;The enabling UI technology was &lt;strong&gt;Windows Presentation Foundation (WPF)&lt;/strong&gt;. With WPF we could rapidly build something that looks a lot like iPhone in a very short time. I was playing the dual role of a Designer + Developer and tools like &lt;strong&gt;Blend&lt;/strong&gt; and &lt;strong&gt;Design &lt;/strong&gt;greatly helped in skinning the app. Below you can see a bunch of screenshots and a short video of accepting a call. &lt;p&gt;  &lt;p&gt;&lt;em&gt;Notification received. You can talk, IM or just ignore.&lt;/em&gt; &lt;p&gt;&lt;img style="border-top-width:0px;border-left-width:0px;border-bottom-width:0px;border-right-width:0px" height=387 alt=image src="http://tk4.storage.msn.com/y1p98pGElWCpu4d6yqZWFm9QahAkv0YyG18Bs-ds0VsRpWB6ATEJNW66hmwtmCtMKN0gloadQHvWeLqdtFzxj8w2w" width=217 border=0&gt;  &lt;p&gt;  &lt;p&gt;&lt;em&gt;In an audio chat (call)&lt;/em&gt; &lt;p&gt;&lt;img style="border-top-width:0px;border-left-width:0px;border-bottom-width:0px;border-right-width:0px" height=396 alt=image src="http://tk4.storage.msn.com/y1p98pGElWCpu5PQzmAEDwi7516wbMYZ0RsFiQmQpRMjUX9bkgj3mePQgranEGyAbQMP4NRGGfijG92Oq6ODBSs8w" width=215 border=0&gt;  &lt;p&gt;  &lt;p&gt;&lt;em&gt;Contact list&lt;/em&gt; &lt;p&gt;&lt;img style="border-top-width:0px;border-left-width:0px;border-bottom-width:0px;border-right-width:0px" height=398 alt=image src="http://tk4.storage.msn.com/y1p98pGElWCpu6eB18CemumY-5cateDoB_ZbCg99d8nEuH2cXSXF5ceckwCkqHLuRlkm5kIsKLU3qgRL02XSeO13A" width=240 border=0&gt;  &lt;p&gt;  &lt;p&gt;&lt;em&gt;Video of accepting a notification (via Talk)&lt;/em&gt; &lt;div style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px"&gt;&lt;/div&gt; &lt;p&gt;&lt;strong&gt;How was it built?&lt;/strong&gt; &lt;ul&gt; &lt;li&gt;Blend and Design were used for creating the skin of the app. The XAML UI was created in Blend and the graphics were developed in Design. I had made a &lt;a href="http://pavanpodila.spaces.live.com/blog/cns!9C9E888164859398!323.entry"&gt;post&lt;/a&gt; earlier about how the icons for the app were created in Design.  &lt;li&gt;The &lt;a href="http://www.google.com/url?sa=t&amp;amp;ct=res&amp;amp;cd=2&amp;amp;url=http://pavanpodila.spaces.live.com/blog/cns!9C9E888164859398!345.entry&amp;amp;ei=_e3SRsTIOYSwebPPmKgJ&amp;amp;usg=AFQjCNHZFqmsuX0MYmYKmReY7XgYZxEVOw&amp;amp;sig2=GUyyxvntXIxkDvlmnWGOig"&gt;GlassWindow&lt;/a&gt; control was used for creating the window chrome.  &lt;li&gt;Although you cannot see in the screenshots above, the &lt;a href="http://pavanpodila.spaces.live.com/blog/cns!9C9E888164859398!229.entry"&gt;Drag 'n' Drop library&lt;/a&gt; was also used  &lt;li&gt;I missed out using the &lt;a href="http://pavanpodila.spaces.live.com/blog/cns!9C9E888164859398!380.entry"&gt;ElementFlow&lt;/a&gt;, but that can be easily added. I only need to find a business case for that ;)&lt;/ul&gt; &lt;p&gt;  &lt;p&gt;This example only goes to show how powerful WPF can be. With greater tool support from Blend + Design, lot can be achieved in a far lesser time. Now until I get my own iPhone, I will continue to use the WPF version ;) &lt;p&gt;  &lt;div style="padding-right:0px;display:inline;padding-left:0px;padding-bottom:0px;margin:0px;padding-top:0px"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/wpf" rel=tag&gt;wpf&lt;/a&gt;, &lt;a href="http://technorati.com/tags/xaml" rel=tag&gt;xaml&lt;/a&gt;, &lt;a href="http://technorati.com/tags/iPhone" rel=tag&gt;iPhone&lt;/a&gt;, &lt;a href="http://technorati.com/tags/ui" rel=tag&gt;ui&lt;/a&gt;&lt;/div&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-7161136268153875560&amp;page=RSS%3a+The+iPhone+(-like)+interface+in+WPF&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=pavanpodila.spaces.live.com&amp;amp;GT1=pavanpodila"&gt;</description><comments>http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!480.entry#comment</comments><guid isPermaLink="true">http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!480.entry</guid><pubDate>Mon, 27 Aug 2007 16:35:58 GMT</pubDate><slash:comments>3</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://pavanpodila.spaces.live.com/blog/cns!9C9E888164859398!480/comments/feed.rss</wfw:commentRss><wfw:comment>http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!480.entry#comment</wfw:comment><dcterms:modified>2007-08-27T17:35:02Z</dcterms:modified></item><item><title>ElementFlow is now a Panel !!!</title><link>http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!468.entry</link><description>&lt;p&gt;The ElementFlow control was something I was working on a while back and I even posted about it &lt;a href="http://www.google.com/url?sa=t&amp;amp;ct=res&amp;amp;cd=5&amp;amp;url=http://pavanpodila.spaces.live.com/blog/cns!9C9E888164859398!380.entry&amp;amp;ei=cNjNRuPWHYeGeay2nfAP&amp;amp;usg=AFQjCNH0-U5EZ6CUCNjO6U4HJhZ4hD7GPg&amp;amp;sig2=XbkPOWreZlcQ4H5m6dbpGA"&gt;here&lt;/a&gt;. The control originally derived from a FrameworkElement and had its own properties for enabling binding to a data-source, namely ElementsSource and ElementTemplate. These properties behave similar to the ItemsSource and ItemTemplate of ItemsControl. &lt;p&gt;One could argue that instead of deriving from FrameworkElement, I should derive from ItemsControl. That way I would get the Databinding support free of cost. But making ElementFlow an ItemsControl means that I could use any Panel as my ItemsPanel. This ofcourse is NOT true. ElementFlow is primarily meant to visualize items in 3D. This means I would be using Viewport3D and GeometryModels to represent my items. Using any other kind of panel doesn't really work well and is simply not correct. Also I think it violates the &lt;a href="http://en.wikipedia.org/wiki/Liskov_substitution_principle"&gt;Liskov Substitution Principle (LSP)&lt;/a&gt;. &lt;p&gt;  &lt;p&gt;However, ItemsControl does take care of data-binding by automatically generating the ContentPresenters for the items in the data-source. That idea led to a philosophical debate with myself, where I was arguing (with myself) that ElementFlow should really be handling layout of the items in 3D and should not worry about the data-source and deciphering DataTemplates. Its primary job is really to layout items in 3D.  &lt;p&gt;The component in WPF that does pure layout is a Panel. Making ElementFlow a Panel was &amp;quot;definitely&amp;quot; the way to go. &lt;p&gt;  &lt;p&gt;&lt;strong&gt;Panel issues&lt;/strong&gt; &lt;blockquote&gt; &lt;p&gt;Deriving directly from Panel required me to make couple different changes to the control and I also ran into a few issues along the way: &lt;ul&gt; &lt;li&gt;Previously I was handling the part where I would generate the ContentPresenters from ElementsSource and ElementTemplate. That all had to go away, since none of it is needed any more.  &lt;li&gt;Next I had to hook into the stage where the Panel makes a change to its visual-children collection. This can be done by overriding &lt;/ul&gt; &lt;p&gt;        &lt;span style="color:rgb(0,0,255)"&gt;protected&lt;/span&gt; &lt;span style="color:rgb(0,0,255)"&gt;override&lt;/span&gt; &lt;span style="color:rgb(0,0,255)"&gt;void&lt;/span&gt; OnVisualChildrenChanged(&lt;span style="color:rgb(43,145,175)"&gt;DependencyObject&lt;/span&gt; visualAdded, &lt;span style="color:rgb(43,145,175)"&gt;DependencyObject&lt;/span&gt; visualRemoved)&lt;br&gt; &lt;p&gt;I make a change to my Viewport3D (adding/removing models) within this method. &lt;ul&gt; &lt;li&gt;I also ran into an issue when setting ElementFlow as the ItemsPanel inside an ItemsControl. It had to do with the way ItemsPresenter uses the ItemsPanel property of ItemsControl. ItemsPresenter requires that the count of the visual children of the Panel should be 0 at the beginning (ie before populating the Panel). However inside my VisualChildrenCount override, I was always returning &amp;quot;1&amp;quot;, indicating that I only have one visual child, which is my Viewport3D. Obviously I am not supposed to return &amp;quot;1&amp;quot; all the time. To circumvent this issue I call into the base-class to get me the VisualChildrenCount. If the count is zero, I return zero, else I return one.&lt;/ul&gt; &lt;p&gt; &lt;/blockquote&gt; &lt;p&gt;Once past those issues, I had ElementFlow working in collaboration with ItemsControl. I can now get all my UI elements from the ItemsControl and not have to worry about data-binding and its related issues (children add/remove/update). This also saves me lot of development and maintenance time, as I rely more on the framework for things its really good at, namely DataBinding! &lt;p&gt;  &lt;p&gt;Note that ElementFlow also works independently of ItemsControl, just like any other Panel :) &lt;p&gt;  &lt;div style="padding-right:0px;display:inline;padding-left:0px;padding-bottom:0px;margin:0px;padding-top:0px"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/wpf" rel=tag&gt;wpf&lt;/a&gt;, &lt;a href="http://technorati.com/tags/xaml" rel=tag&gt;xaml&lt;/a&gt;, &lt;a href="http://technorati.com/tags/elementflow" rel=tag&gt;elementflow&lt;/a&gt;, &lt;a href="http://technorati.com/tags/lsp" rel=tag&gt;lsp&lt;/a&gt;, &lt;a href="http://technorati.com/tags/customcontrol" rel=tag&gt;customcontrol&lt;/a&gt;&lt;/div&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-7161136268153875560&amp;page=RSS%3a+ElementFlow+is+now+a+Panel+!!!&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=pavanpodila.spaces.live.com&amp;amp;GT1=pavanpodila"&gt;</description><comments>http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!468.entry#comment</comments><guid isPermaLink="true">http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!468.entry</guid><pubDate>Thu, 23 Aug 2007 19:46:14 GMT</pubDate><slash:comments>4</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://pavanpodila.spaces.live.com/blog/cns!9C9E888164859398!468/comments/feed.rss</wfw:commentRss><wfw:comment>http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!468.entry#comment</wfw:comment><dcterms:modified>2007-08-23T19:46:14Z</dcterms:modified></item><item><title>ItemSkimmingPanel - a panel that does more than just layout</title><link>http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!456.entry</link><description>&lt;p&gt;Recently Apple released their next version of iLife, which has some cool enhancements to iPhoto and iMovie. One specific enhancement called &amp;quot;skimming&amp;quot; was interesting from my project's perspective. The idea is that when you scrub your mouse over an album, it skims through all the photos in that album. The same interaction applies when you scrub your mouse over a movie clip: it skims through all of its frames. &lt;p&gt;We had a similar requirement for viewing all the items inside a container. Skimming looked like a neat way of doing that. We had a couple of different ways of implementing this interaction but finally we decided on making this interaction as a Panel. The justification can be summarized in the bullets below: &lt;ul&gt; &lt;li&gt;Panel has a SetZIndex() API that is used to pop items to the front. This is useful to bring an item to the top of the stack.  &lt;li&gt;Panels can be used in conjunction with &lt;strong&gt;ItemsControl &lt;/strong&gt;to leverage data-binding. This can be done by setting the &lt;strong&gt;ItemsPanel &lt;/strong&gt;property of ItemsControl&lt;/ul&gt; &lt;p&gt;  &lt;p&gt;We added an extra feature to skimming, which we call &amp;quot;Item Context&amp;quot;. When you are skimming through a bunch of items, you would also want to know where the item is positioned in relation to others. In other words you would want to know the context of the item relative to others. It is also very handy to quickly visualize your stack (aka &lt;strong&gt;container&lt;/strong&gt;). Thus from a top level we have two different concepts in our ItemSkimmingPanel: &lt;ol&gt; &lt;li&gt;It skims through all the items in the Panel when you scrub your mouse on it. Each &amp;quot;skimming&amp;quot; action brings the item to the top of the stack.  &lt;li&gt;When you start the skimming process, a context is also displayed to see the relative location of the item.&lt;/ol&gt; &lt;p&gt;  &lt;p&gt;Both of these ideas can be seen in the video below. In the first half of the video you can see the skimming action without the context. The second half shows the context as you skim through the items. It will be clear how effective the skimming can be when the context is displayed. &lt;p&gt; &lt;p&gt; &lt;div style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px"&gt;&lt;/div&gt; &lt;p&gt;  &lt;p&gt; &lt;p&gt; &lt;strong&gt;A quick note on internals&lt;/strong&gt; &lt;p&gt;The ItemSkimmingPanel leverages the fact that a Panel can automatically handle the ZIndex of an item. We listen to standard mouse events (MouseDown, MouseUp, MouseMove) to achieve the effect of scrubbing. To prevent very rapid scrubs we make sure that the mouse moves a specific distance between each scrub. The context for skimming is shown using Adorners. The Adorner is positioned relative to the panel that is being scrubbed. Skinning of the context is supported via ControlTemplates. There are two Dependency properties on ItemSkimmingPanel used specifically for this purpose: ContextContainerTemplate and ContextItemTemplate. The names should be self-explanatory. &lt;p&gt;All of the skimming and context display logic is nicely encapsulated inside the ItemSkimmingPanel. &lt;p&gt;  &lt;div style="padding-right:0px;display:inline;padding-left:0px;padding-bottom:0px;margin:0px;padding-top:0px"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/wpf" rel=tag&gt;wpf&lt;/a&gt;, &lt;a href="http://technorati.com/tags/xaml" rel=tag&gt;xaml&lt;/a&gt;, &lt;a href="http://technorati.com/tags/panel" rel=tag&gt;panel&lt;/a&gt;, &lt;a href="http://technorati.com/tags/iLife" rel=tag&gt;iLife&lt;/a&gt;, &lt;a href="http://technorati.com/tags/iPhoto" rel=tag&gt;iPhoto&lt;/a&gt;, &lt;a href="http://technorati.com/tags/iMovie" rel=tag&gt;iMovie&lt;/a&gt;, &lt;a href="http://technorati.com/tags/skimming" rel=tag&gt;skimming&lt;/a&gt;&lt;/div&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-7161136268153875560&amp;page=RSS%3a+ItemSkimmingPanel+-+a+panel+that+does+more+than+just+layout&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=pavanpodila.spaces.live.com&amp;amp;GT1=pavanpodila"&gt;</description><comments>http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!456.entry#comment</comments><guid isPermaLink="true">http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!456.entry</guid><pubDate>Sat, 18 Aug 2007 03:24:11 GMT</pubDate><slash:comments>2</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://pavanpodila.spaces.live.com/blog/cns!9C9E888164859398!456/comments/feed.rss</wfw:commentRss><wfw:comment>http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!456.entry#comment</wfw:comment><dcterms:modified>2007-08-18T03:25:59Z</dcterms:modified></item><item><title>Creating WPF based addins with System.AddIn</title><link>http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!439.entry</link><description>&lt;p&gt;With Framework 3.5 we have a new namespace called System.AddIn which is useful for creating AddIn based application architectures. For an introduction to this namespace and its usage refer to: &lt;p&gt;&lt;a href="http://blogs.msdn.com/clraddins/"&gt;CLR AddIn blog&lt;/a&gt; &lt;p&gt;&lt;a href="http://blogs.msdn.com/zifengh/"&gt;Jason He's Paint.Net adventure with System.AddIn&lt;/a&gt; &lt;p&gt;  &lt;p&gt;&lt;strong&gt;WPF AddIns&lt;/strong&gt; &lt;blockquote&gt; &lt;p&gt;When creating WPF AddIns one of the first things you would want is the ability to exchange some UI related classes across AppDomains. Doing so requires us to marshall these classes using a Contract (as per System.AddIn parlance). The WPF team has created a new namespace &lt;strong&gt;System.Windows.Presentation&lt;/strong&gt; that provides this contract for exchanging WPF elements. Since the AddIn does not directly depend on the Contract, the exchange over the wire happens through an Adapter class. The Adapter will adapt the Contract to the View or the View to the Contract based on whether it is translating on Host side or the AddIn side.&lt;/blockquote&gt; &lt;p&gt;System.Windows.Presentation contains a class called &lt;strong&gt;VisualAdapters &lt;/strong&gt;that does exactly this job. When transmitting the Visual (System.Windows.Media.Visual) from the AddIn side, one needs to convert it to a Contract. The Contract interface defined for a Visual is called &lt;strong&gt;System.AddIn.Contract.INativeHandleContract &lt;/strong&gt;defined in the &lt;strong&gt;System.AddIn.Contract &lt;/strong&gt;assembly. VisualAdapters.ViewToContractAdapter is the method that does this conversion for us. &lt;p&gt;  &lt;p&gt;public static System.AddIn.Contract.INativeHandleContract &lt;strong&gt;ViewToContractAdapter&lt;/strong&gt;(System.Windows.Media.Visual root)&lt;br&gt;    Member of System.AddIn.Pipeline.VisualAdapters &lt;p&gt;Similarly to translate from a Contract to a Visual we have the complementary method on VisualAdapters: ContractToViewAdapter. Note that this method is not exactly symmetrical with the previous one. It does not return a Visual, instead a &lt;strong&gt;FrameworkElement&lt;/strong&gt;. &lt;p&gt;  &lt;p&gt;public static System.Windows.FrameworkElement ContractToViewAdapter(System.AddIn.Contract.INativeHandleContract nativeHandleContract)&lt;br&gt;    Member of System.AddIn.Pipeline.VisualAdapters &lt;p&gt;&lt;strong&gt;&lt;/strong&gt;  &lt;p&gt;&lt;strong&gt;Passing Collections across AppDomains&lt;/strong&gt; &lt;blockquote&gt; &lt;p&gt;Once you start building functionality into your addins you would soon hit the requirement to pass collections. Fortunately we already have contracts defined for them. System.AddIn.Contract defines the IListContract&amp;lt;T&amp;gt; which is a contract for passing IList. The adapter for this contract is defined in System.AddIn: CollectionAdapters. It contains a bunch of generic methods for translating between IList&amp;lt;T&amp;gt; and IListContract&amp;lt;T&amp;gt;.&lt;/blockquote&gt; &lt;p&gt;&lt;strong&gt;I need more Contracts!&lt;/strong&gt; &lt;blockquote&gt; &lt;p&gt;One of the AddIns I am trying to develop requires me to pass things like VisualBrush, Storyboard, etc. However there is no contract defined for these classes. Hopefully the WPF team will add it in the future or make some available via a CodePlex project ! I hope someone from the WPF team is reading this :)&lt;/blockquote&gt; &lt;div style="padding-right:0px;display:inline;padding-left:0px;padding-bottom:0px;margin:0px;padding-top:0px"&gt;Technorati tags: &lt;a href="http://technorati.com/tags/addin" rel=tag&gt;addin&lt;/a&gt;, &lt;a href="http://technorati.com/tags/wpf" rel=tag&gt;wpf&lt;/a&gt;&lt;/div&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-7161136268153875560&amp;page=RSS%3a+Creating+WPF+based+addins+with+System.AddIn&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=pavanpodila.spaces.live.com&amp;amp;GT1=pavanpodila"&gt;</description><comments>http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!439.entry#comment</comments><guid isPermaLink="true">http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!439.entry</guid><pubDate>Fri, 03 Aug 2007 11:52:27 GMT</pubDate><slash:comments>0</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://pavanpodila.spaces.live.com/blog/cns!9C9E888164859398!439/comments/feed.rss</wfw:commentRss><wfw:comment>http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!439.entry#comment</wfw:comment><dcterms:modified>2007-08-03T11:52:27Z</dcterms:modified></item><item><title>Making the Scrollbar work (with DragDropManager)</title><link>http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!414.entry</link><description>&lt;p&gt;This post is a corollary to a set of posts I did on the &lt;a href="http://pavanpodila.spaces.live.com/blog/cns!9C9E888164859398!229.entry"&gt;DragDropManager component&lt;/a&gt;. &lt;p&gt;  &lt;p&gt;If you have been using the DragDropManager with a ListBox, you may have encountered an issue where you are not able to scroll using the ScrollBar. There are couple of reasons for this: &lt;ol&gt; &lt;li&gt;I have setup Preview events on the UI control on which you attached the DragDropManager. This traps all the mouse events happening on the control. &lt;li&gt;When you try to use the ScrollBar to scroll, the DnD manager comes in and checks if a Drag-gesture is being made. This traps the mouse events for the ScrollBar and hence it never sees it. This is the default behavior since the ScrollViewer is part of the ControlTemplate for the ListBox and hence considered part of the control. &lt;li&gt;When the PreviewMouseLeftButtonDown event occurs, the dragged-element that is returned turns out to be the ListBox itself and not the ListBoxItem or ContentPresenter (in case of a Databound ListBox). Thus it is not clear from the dragged-element, whether the MouseDown event happened on the ScrollBar or the List item.&lt;/ol&gt; &lt;p&gt;  &lt;p&gt;&lt;strong&gt;So what's the workaround?&lt;/strong&gt; &lt;p&gt;The main reason the Scrollbar doesn't work is because of it being part of the ControlTemplate. Hence we need to take it out. We can then put the ListBox inside a ScrollViewer separately and get the desired scrolling behavior. Now the mouse preview events do not include the ScrollBar anymore. &lt;p&gt;  &lt;p&gt;&lt;strong&gt;A side note&lt;/strong&gt; &lt;p&gt;I have improved the DragDropManager and made some changes to the IDragSourceAdvisor and IDropTargetAdvisor interfaces. Will make a post on that soon :) &lt;div style="padding-right:0px;display:inline;padding-left:0px;padding-bottom:0px;margin:0px;padding-top:0px"&gt;Technorati tags: &lt;a href="http://technorati.com/tags/wpf" rel=tag&gt;wpf&lt;/a&gt;, &lt;a href="http://technorati.com/tags/attached-properties" rel=tag&gt;attached-properties&lt;/a&gt;, &lt;a href="http://technorati.com/tags/xaml" rel=tag&gt;xaml&lt;/a&gt;, &lt;a href="http://technorati.com/tags/dragdrop" rel=tag&gt;dragdrop&lt;/a&gt;&lt;/div&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-7161136268153875560&amp;page=RSS%3a+Making+the+Scrollbar+work+(with+DragDropManager)&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=pavanpodila.spaces.live.com&amp;amp;GT1=pavanpodila"&gt;</description><comments>http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!414.entry#comment</comments><guid isPermaLink="true">http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!414.entry</guid><pubDate>Mon, 02 Jul 2007 12:09:25 GMT</pubDate><slash:comments>1</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://pavanpodila.spaces.live.com/blog/cns!9C9E888164859398!414/comments/feed.rss</wfw:commentRss><wfw:comment>http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!414.entry#comment</wfw:comment><dcterms:modified>2007-07-02T12:11:18Z</dcterms:modified></item><item><title>BalloonDecorator source code</title><link>http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!411.entry</link><description>&lt;p&gt;&lt;img alt=image src="http://tk4.storage.msn.com/y1p2Wh678arNGpJBKAyl1xSQWPC6jgjl-9Pkopb1RbStFsZeaO_AjQFUYJfRbvCMS5PSp7ALOaRwyfbwxOUplRM3Q" border=0&gt; &lt;a href="http://tk4.storage.msn.com/y1p2Wh678arNGp57bkAby9NC1xMbSiCVSndOT1l2XfpmtIwuDJVtIrm7KJBbc3Z_SrfbrF6eGWZwJwo27PWzkTYTw"&gt;&lt;img style="border-right:0px;border-top:0px;margin:0px 0px 0px 10px;border-left:0px;border-bottom:0px" height=78 alt=image src="http://tkfiles.storage.msn.com/y1paKH4DC0WasIZfPHjFbzjJB6X7gNSjkBW6Lvtjaq6bFk3d_L4-ZUB_-ppKXwV20bn" width=464 border=0&gt;&lt;/a&gt;  &lt;p&gt;  &lt;p&gt;Sometime back I had &lt;a href="http://pavanpodila.spaces.live.com/blog/cns!9C9E888164859398!289.entry"&gt;posted about a simple Decorator that draws Balloon Text&lt;/a&gt;, similar to the speech balloons you see in comic strips. I called it the &lt;strong&gt;BalloonDecorator&lt;/strong&gt;. At the time of the post I found some minor bugs and delayed posting the source. Although I fixed the bugs I was a little lazy to upload the source. Thanks to few of my readers for nagging me :) I finally got around to do just that. &lt;p&gt;  &lt;p&gt;&lt;a title="BalloonDecorator Project files" href="http://www.box.net/shared/t10upgg660"&gt;Download Source&lt;/a&gt; &lt;p&gt;&lt;a href="http://pavanpodila.spaces.live.com/blog/cns!9C9E888164859398!289.entry"&gt;Original Blog entry&lt;/a&gt; &lt;p&gt;  &lt;div style="padding-right:0px;display:inline;padding-left:0px;padding-bottom:0px;margin:0px;padding-top:0px"&gt;Technorati tags: &lt;a href="http://technorati.com/tags/wpf" rel=tag&gt;wpf&lt;/a&gt;, &lt;a href="http://technorati.com/tags/xaml" rel=tag&gt;xaml&lt;/a&gt;, &lt;a href="http://technorati.com/tags/decorator" rel=tag&gt;decorator&lt;/a&gt;, &lt;a href="http://technorati.com/tags/balloon-text" rel=tag&gt;balloon-text&lt;/a&gt;&lt;/div&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-7161136268153875560&amp;page=RSS%3a+BalloonDecorator+source+code&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=pavanpodila.spaces.live.com&amp;amp;GT1=pavanpodila"&gt;</description><comments>http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!411.entry#comment</comments><guid isPermaLink="true">http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!411.entry</guid><pubDate>Wed, 27 Jun 2007 02:17:04 GMT</pubDate><slash:comments>1</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://pavanpodila.spaces.live.com/blog/cns!9C9E888164859398!411/comments/feed.rss</wfw:commentRss><wfw:comment>http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!411.entry#comment</wfw:comment><dcterms:modified>2007-06-27T02:17:04Z</dcterms:modified></item><item><title>Nice article on extending WPF animation classes - MSDN</title><link>http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!399.entry</link><description>&lt;p&gt;Charles Petzold has published an interesting article on creating custom animation classes. Read it &lt;a href="http://msdn.microsoft.com/msdnmag/issues/07/07/Foundations/"&gt;here&lt;/a&gt;.  &lt;p&gt;Sometime back I had used these concepts in making the &lt;a href="http://pavanpodila.spaces.live.com/blog/cns!9C9E888164859398!230.entry"&gt;GenieAnimation&lt;/a&gt;. It would have saved me some time if Charles had published this article earlier :) &lt;p&gt;  &lt;div style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px"&gt;Technorati tags: &lt;a href="http://technorati.com/tags/animation" rel=tag&gt;animation&lt;/a&gt;, &lt;a href="http://technorati.com/tags/xaml" rel=tag&gt;xaml&lt;/a&gt;, &lt;a href="http://technorati.com/tags/wpf" rel=tag&gt;wpf&lt;/a&gt;&lt;/div&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-7161136268153875560&amp;page=RSS%3a+Nice+article+on+extending+WPF+animation+classes+-+MSDN&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=pavanpodila.spaces.live.com&amp;amp;GT1=pavanpodila"&gt;</description><comments>http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!399.entry#comment</comments><guid isPermaLink="true">http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!399.entry</guid><pubDate>Thu, 14 Jun 2007 16:59:10 GMT</pubDate><slash:comments>0</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://pavanpodila.spaces.live.com/blog/cns!9C9E888164859398!399/comments/feed.rss</wfw:commentRss><wfw:comment>http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!399.entry#comment</wfw:comment><dcterms:modified>2007-06-14T16:59:10Z</dcterms:modified></item><item><title>The ElementFlow custom control - can do CoverFlow too!</title><link>http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!380.entry</link><description>&lt;p&gt;I am sure many of you have heard and even interacted with the CoverFlow view of iTunes. In the WPF world we have the good folks from Thirteen23, who have created an app called &lt;a href="http://www.thirteen23.com/labs/winfx/harmony/"&gt;Harmony&lt;/a&gt; that shows off the use of CoverFlow. They make good use of the Viewport3D to pull the desired effect. &lt;p&gt;Recently I had the opportunity to develop a custom control similar to CoverFlow. I call this control the &lt;strong&gt;ElementFlow&lt;/strong&gt;, because besides CoverFlow, the control can do lots of other views. In fact the whole view part of the control has been abstracted out so you can plug in your own view (if you wish). This is possible by creating a new ViewState and providing the necessary animations to flow the items. &lt;p&gt;Since the control is supposed to layout a list of items, it behaves very similar to an ItemsControl. However for various reasons I have not derived from ItemsControl (Why? - that's a topic of a different blog post). &lt;p&gt;To demonstrate this control I have captured two videos, one which contains reflections and one without. In the first one I show only the CoverFlow control (with reflections ON). In the second video (reflections OFF) I start with the CoverFlow view and then switch my ViewStates. You can see that the view transition is very fluid and the selected-item is retained on different ViewStates. [&lt;strong&gt;Note &lt;/strong&gt;that not all layout-related dependency properties have mappings for different ViewStates.] &lt;p&gt; &lt;div style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px"&gt;
&lt;br&gt;
&lt;a href="http://www.youtube.com/watch?v=0Wcq7kfL_14"&gt;YouTube - ElementFlow control (showing CoverFlow with reflection)&lt;/a&gt;&lt;/div&gt; &lt;p&gt; &lt;p&gt;  &lt;p&gt; &lt;div style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px"&gt;
&lt;br&gt;
&lt;a href="http://www.youtube.com/watch?v=apXB_WXmzm4"&gt;YouTube - ElementFlow control - showing other ViewStates&lt;/a&gt;&lt;/div&gt; &lt;p&gt;  &lt;p&gt;&lt;strong&gt;Some of the inner workings&lt;/strong&gt; &lt;ul&gt; &lt;li&gt;There are two ways in which you can add items to the ElementFlow control: creating the UIElement directly or by specifying a ElementsSource and ElementTemplate. Whenever an item is added, it is kept hidden separately and a VisualBrush of that item is texture-mapped onto the 3D Mesh. The mesh is then positioned according to its item-index in the list.  &lt;li&gt;I derive from a FrameworkElement instead of ItemsControl.  &lt;li&gt;To change the visual tree I override the following methods: GetVisualChild(), ArrangeOverride(), MeasureOverride() and the property: VisualChildrenCount  &lt;li&gt;Viewport3D is my only visual-child&lt;/ul&gt; &lt;p&gt;  &lt;p&gt;&lt;strong&gt;What are the features of this control?&lt;/strong&gt; &lt;ul&gt; &lt;li&gt;Can do multiple forms of 3D list visualizations using ViewStates. Some of the out-of-box ViewStates include: CoverFlow, RollerCoaster, TimeMachine, Rolodex  &lt;li&gt;Pluggable ViewStates  &lt;li&gt;Fluid animations when switching between ViewStates  &lt;li&gt;Items can be added directly via XAML or in code using the Children property  &lt;li&gt;Supports data-binding via ElementsSource + ElementTemplate  &lt;li&gt;Detects changes to collection - Add/Remove/Update  &lt;li&gt;Various properties to control layout of items - ItemGap, FrontItemGap, PopoutDistance, TiltAngle. Changing these properties causes animated changes on the view.  &lt;li&gt;Mouse, Keyboard and Mousewheel interaction&lt;/ul&gt; &lt;p&gt;  &lt;p&gt;&lt;strong&gt;Future updates&lt;/strong&gt; &lt;ul&gt; &lt;li&gt;Virtualization of the view when dealing with a huge collection. Got to dig up those posts by Dan Crevier and Ben Constable :), think VirtualizingStackPanel and IScrollInfo !!  &lt;li&gt;I can't release the Source code yet but keep visiting back :)&lt;/ul&gt; &lt;p&gt;  &lt;div style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px"&gt;Technorati tags: &lt;a href="http://technorati.com/tags/wpf" rel=tag&gt;wpf&lt;/a&gt;, &lt;a href="http://technorati.com/tags/xaml" rel=tag&gt;xaml&lt;/a&gt;, &lt;a href="http://technorati.com/tags/elementflow" rel=tag&gt;elementflow&lt;/a&gt;, &lt;a href="http://technorati.com/tags/coverflow" rel=tag&gt;coverflow&lt;/a&gt;, &lt;a href="http://technorati.com/tags/itemscontrol" rel=tag&gt;itemscontrol&lt;/a&gt;, &lt;a href="http://technorati.com/tags/customcontrol" rel=tag&gt;customcontrol&lt;/a&gt;&lt;/div&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-7161136268153875560&amp;page=RSS%3a+The+ElementFlow+custom+control+-+can+do+CoverFlow+too!&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=pavanpodila.spaces.live.com&amp;amp;GT1=pavanpodila"&gt;</description><comments>http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!380.entry#comment</comments><guid isPermaLink="true">http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!380.entry</guid><pubDate>Tue, 05 Jun 2007 12:15:39 GMT</pubDate><slash:comments>19</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://pavanpodila.spaces.live.com/blog/cns!9C9E888164859398!380/comments/feed.rss</wfw:commentRss><wfw:comment>http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!380.entry#comment</wfw:comment><dcterms:modified>2007-06-05T13:21:22Z</dcterms:modified></item><item><title>Structuring a WPF User Interface</title><link>http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!368.entry</link><description>&lt;p&gt;When creating a typical user interface, say a Window, Page or UserControl, we start with the top-level container and nest other containers or controls inside it. This is a good approach for a first attempt. But just like we refactor our code to make it more maintainable, we should also be refactoring the User Interface by applying similar principles. Such a refactoring leads to a more maintainable view. Also since we are only refactoring, the final view looks the same but the internal construction is different. In this blog post I'll present some such refactorings in the context of the WPF User Interface. Note that the concepts I present here are &lt;a href="http://www.adobe.com/devnet/flex/articles/architecture_print.html"&gt;already popular&lt;/a&gt; when developing with Adobe Flex. &lt;p&gt;  &lt;p&gt;&lt;strong&gt;The IM Client example&lt;/strong&gt; &lt;p&gt;Lets say for example we want to create a Contact-list window for an IM client.  &lt;p&gt;&lt;img height=369 src="http://tkfiles.storage.msn.com/y1paKH4DC0WasJNZCHowFMgC1jEqMd3IqqcKj76hl72KXl69gVlUAZ0_CGioLQnMYjk" width=300&gt;  &lt;p&gt;This view could be created with the following nesting of components: &lt;p&gt;&lt;img height=767 src="http://tkfiles.storage.msn.com/y1paKH4DC0WasLe6Jk6BKrEGuC0u-qSjVcDmfMJzHz8-DOIhnIuOaANeohWPjjQRLFk" width=697&gt;  &lt;p&gt;In this simple structuring we have just used a Grid and laid out all the controls inside it. Since we will also be data-binding we can set up all the bindings directly in this view. This works for now but is not very amenable when your designer comes up with a better layout for the view.  &lt;p&gt;The next logical step is to group related controls together inside panels. So I could put the top 3 Label controls inside a vertically-oriented StackPanel. I could then group the Icon and the StackPanel into a DockPanel and so on. Grouping these controls helps in making the view more organized. However we are still dealing with a pretty big tree of UI components. It may seem very manageable right now and you will also find it easy to set up the bindings. However if you try navigating this view after a week or more you will see that it takes some time to gear up to how things are nested. &lt;p&gt;  &lt;p&gt;&lt;strong&gt;Making the &amp;quot;UserControl&amp;quot; work for you&lt;/strong&gt; &lt;p&gt;UserControls come in very handy when structuring views and work very well as organizing containers. Also since a UserControls has a DataContext property we can also set up data-bindings easily. The primary purpose of the UserControl is to contain related controls and present them as one single abstracted control. Lets look at our IM client example. If we take a step back we can imagine a more high-level organization of controls like so: &lt;p&gt;&lt;img height=767 src="http://tk4.storage.msn.com/y1p2Wh678arNGqFv4T5Qf66T8dLhh6ZAiyiVIx-D8iXO40JQpgvdpda68odFH8IvEv7bCJ0X_56tVbGU0BKX3SzVQ" width=697&gt;  &lt;p&gt;Now the Window looks more readable and we can easily identify its core UI components. Each of the views in the above figure represent a UserControl. By organizing the controls inside such UserControls we can even reuse peices like the UserInfoView, ContactInfoView in other Windows/Pages/UserControls. &lt;p&gt;  &lt;p&gt;&lt;strong&gt;Communicating between UserControls&lt;/strong&gt; &lt;p&gt;The UserControls by themselves have no clue about the presence of other UserControls, so it is left to a top-level container to orchestrate the communication. We can create a top-level UserControl, say the DashboardView which would internally host all the other views. All the logic of communicating between views could now be contained inside DashboardView. The UserControls themselves inform to the outside world about interesting things by firing events. This is done by setting up &lt;strong&gt;RoutedEvents&lt;/strong&gt;. For example in our SearchView, we could have a SearchChanged event being fired whenever the user presses the Enter key on the TextBox. This abstracts the view and delivers the required information in the form of a RoutedEvent. Here is the sample code from the SearchView UserControl: &lt;p&gt;  &lt;div style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px"&gt;&lt;pre style="width:100%;background-color:#EEEEEE;font-size:130%"&gt;&lt;div&gt;&lt;span style="color:#000000"&gt;  &lt;/span&gt;&lt;span style="color:#0000FF"&gt;public&lt;/span&gt;&lt;span style="color:#000000"&gt; &lt;/span&gt;&lt;span style="color:#0000FF"&gt;partial&lt;/span&gt;&lt;span style="color:#000000"&gt; &lt;/span&gt;&lt;span style="color:#0000FF"&gt;class&lt;/span&gt;&lt;span style="color:#000000"&gt; SearchView : UserControl
  {
    &lt;/span&gt;&lt;span style="color:#0000FF"&gt;public&lt;/span&gt;&lt;span style="color:#000000"&gt; &lt;/span&gt;&lt;span style="color:#0000FF"&gt;static&lt;/span&gt;&lt;span style="color:#000000"&gt; RoutedEvent SearchChangedEvent &lt;/span&gt;&lt;span style="color:#000000"&gt;=&lt;/span&gt;&lt;span style="color:#000000"&gt;
      EventManager.RegisterRoutedEvent(&lt;/span&gt;&lt;span style="color:#800000"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:#800000"&gt;SearchChanged&lt;/span&gt;&lt;span style="color:#800000"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:#000000"&gt;, RoutingStrategy.Bubble, 
&lt;/span&gt;&lt;span style="color:#0000FF"&gt;typeof&lt;/span&gt;&lt;span style="color:#000000"&gt;(SearchChangedEventHandler), &lt;/span&gt;&lt;span style="color:#0000FF"&gt;typeof&lt;/span&gt;&lt;span style="color:#000000"&gt;(SearchView));

    &lt;/span&gt;&lt;span style="color:#0000FF"&gt;public&lt;/span&gt;&lt;span style="color:#000000"&gt; &lt;/span&gt;&lt;span style="color:#0000FF"&gt;event&lt;/span&gt;&lt;span style="color:#000000"&gt; SearchChangedEventHandler SearchChanged
    {
      add
      {
        AddHandler(SearchChangedEvent, value);
      }
      remove
      {
        RemoveHandler(SearchChangedEvent, value);
      }
    }

    &lt;/span&gt;&lt;span style="color:#0000FF"&gt;public&lt;/span&gt;&lt;span style="color:#000000"&gt; SearchView()
    {
      &lt;/span&gt;&lt;span style="color:#0000FF"&gt;this&lt;/span&gt;&lt;span style="color:#000000"&gt;.InitializeComponent();

      &lt;/span&gt;&lt;span style="color:#008000"&gt;//&lt;/span&gt;&lt;span style="color:#008000"&gt; Insert code required on object creation below this point.&lt;/span&gt;&lt;span style="color:#008000"&gt;
&lt;/span&gt;&lt;span style="color:#000000"&gt;    }

    &lt;/span&gt;&lt;span style="color:#0000FF"&gt;public&lt;/span&gt;&lt;span style="color:#000000"&gt; &lt;/span&gt;&lt;span style="color:#0000FF"&gt;string&lt;/span&gt;&lt;span style="color:#000000"&gt; SearchText
    {
      &lt;/span&gt;&lt;span style="color:#0000FF"&gt;get&lt;/span&gt;&lt;span style="color:#000000"&gt;
      {
        &lt;/span&gt;&lt;span style="color:#0000FF"&gt;return&lt;/span&gt;&lt;span style="color:#000000"&gt; _text.Text;
      }
    }

    &lt;/span&gt;&lt;span style="color:#0000FF"&gt;private&lt;/span&gt;&lt;span style="color:#000000"&gt; &lt;/span&gt;&lt;span style="color:#0000FF"&gt;void&lt;/span&gt;&lt;span style="color:#000000"&gt; Textbox_KeyDown(&lt;/span&gt;&lt;span style="color:#0000FF"&gt;object&lt;/span&gt;&lt;span style="color:#000000"&gt; sender, KeyEventArgs args)
    {
      &lt;/span&gt;&lt;span style="color:#0000FF"&gt;if&lt;/span&gt;&lt;span style="color:#000000"&gt; (args.Key &lt;/span&gt;&lt;span style="color:#000000"&gt;==&lt;/span&gt;&lt;span style="color:#000000"&gt; Key.Enter)
      {
        SearchChangedEventArgs evtArgs &lt;/span&gt;&lt;span style="color:#000000"&gt;=&lt;/span&gt;&lt;span style="color:#000000"&gt; &lt;/span&gt;&lt;span style="color:#0000FF"&gt;new&lt;/span&gt;&lt;span style="color:#000000"&gt; SearchChangedEventArgs();
        evtArgs.RoutedEvent &lt;/span&gt;&lt;span style="color:#000000"&gt;=&lt;/span&gt;&lt;span style="color:#000000"&gt; SearchChangedEvent;
        evtArgs.SearchText &lt;/span&gt;&lt;span style="color:#000000"&gt;=&lt;/span&gt;&lt;span style="color:#000000"&gt; _text.Text;
        RaiseEvent(evtArgs);  
      }
    }

  }
&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Similarly such RoutedEvents could be set up for other views.
&lt;p&gt; 
&lt;p&gt;&lt;strong&gt;Setting up Databindings&lt;/strong&gt;
&lt;p&gt;Typically you would have a model object-tree for your top-level view. For setting up data-bindings, you could pass the model-object as the DataContext for the UserControl. In the above example, I could have a root model-object as IMClientModel, which has a property CurrentUser of type Person. The Person object has properties such as FirstName, LastName, Availability, Email, Address, etc. In my DashboardView I could then pass the IMClientModel.CurrentUser as DataContext to the UserInfoView.
&lt;p&gt;
&lt;div style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px"&gt;&lt;pre style="width:100%;background-color:#EEEEEE;font-size:130%"&gt;&lt;div&gt;&lt;span style="color:#000000"&gt;    &lt;/span&gt;&lt;span style="color:#0000FF"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000"&gt;views:UserInfoView &lt;/span&gt;&lt;span style="color:#FF0000"&gt;HorizontalAlignment&lt;/span&gt;&lt;span style="color:#0000FF"&gt;=&amp;quot;Stretch&amp;quot;&lt;/span&gt;&lt;span style="color:#FF0000"&gt;
                        VerticalAlignment&lt;/span&gt;&lt;span style="color:#0000FF"&gt;=&amp;quot;Stretch&amp;quot;&lt;/span&gt;&lt;span style="color:#FF0000"&gt;
                        Background&lt;/span&gt;&lt;span style="color:#0000FF"&gt;=&amp;quot;{StaticResource DarkBlueGradient}&amp;quot;&lt;/span&gt;&lt;span style="color:#FF0000"&gt;
                        Grid.Row&lt;/span&gt;&lt;span style="color:#0000FF"&gt;=&amp;quot;0&amp;quot;&lt;/span&gt;&lt;span style="color:#FF0000"&gt;
                        DataContext&lt;/span&gt;&lt;span style="color:#0000FF"&gt;=&amp;quot;{Binding CurrentUser}&amp;quot;&lt;/span&gt;&lt;span style="color:#0000FF"&gt;/&amp;gt;&lt;/span&gt;&lt;span style="color:#000000"&gt;
&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The DataContext of the DashboardView is set to the instance of IMClientModel, which is why I can simply use {Binding CurrentUser} on UserInfoView. When inside the UserInfoView, you would have Bindings to FirstName, LastName, Availability etc. Notice how the UserInfoView is self-contained and only concerned with the Person object.
&lt;p&gt; 
&lt;p&gt;&lt;strong&gt;Summary&lt;/strong&gt;
&lt;p&gt;The basic idea behind such view-refactoring is to make things easy for Developers and Designers. It makes the view more digestible and keeps it simple. By &lt;strong&gt;assembling views, instead of assembling primitive controls&lt;/strong&gt;, we have greater flexibility in modifying the view. By adding RoutedEvents to UserControls, we can establish communication with rest of the views/outside-world. Databinding can set up using the DataContext property of the UserControl.
&lt;p&gt; 
&lt;p&gt; 
&lt;div style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px"&gt;Technorati tags: &lt;a href="http://technorati.com/tags/wpf" rel=tag&gt;wpf&lt;/a&gt;, &lt;a href="http://technorati.com/tags/usercontrol" rel=tag&gt;usercontrol&lt;/a&gt;, &lt;a href="http://technorati.com/tags/view" rel=tag&gt;view&lt;/a&gt;, &lt;a href="http://technorati.com/tags/routedevent" rel=tag&gt;routedevent&lt;/a&gt;, &lt;a href="http://technorati.com/tags/datacontext" rel=tag&gt;datacontext&lt;/a&gt;&lt;/div&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-7161136268153875560&amp;page=RSS%3a+Structuring+a+WPF+User+Interface&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=pavanpodila.spaces.live.com&amp;amp;GT1=pavanpodila"&gt;</description><comments>http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!368.entry#comment</comments><guid isPermaLink="true">http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!368.entry</guid><pubDate>Tue, 29 May 2007 15:16:15 GMT</pubDate><slash:comments>5</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://pavanpodila.spaces.live.com/blog/cns!9C9E888164859398!368/comments/feed.rss</wfw:commentRss><wfw:comment>http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!368.entry#comment</wfw:comment><dcterms:modified>2007-05-29T15:16:15Z</dcterms:modified></item><item><title>XamlXporter - Formatting numbers for German Locale</title><link>http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!355.entry</link><description>&lt;p&gt;&lt;a href="http://ealex-world.spaces.live.com/"&gt;Alexander Ullrich&lt;/a&gt; from Germany has been kind enough to share a patch of the XamlXporter library (Exporter.Core), which fixes the formatting of the floating point numbers for German locale. &lt;p&gt;If you are facing such an issue you can download the patch &lt;a href="http://www.codeplex.com/xamlxporter/WorkItem/View.aspx?WorkItemId=9982"&gt;here&lt;/a&gt;. &lt;p&gt;  &lt;p&gt;Thanks Alex! &lt;p&gt;  &lt;p&gt;  &lt;div style="padding-right:0px;display:inline;padding-left:0px;padding-bottom:0px;margin:0px;padding-top:0px"&gt;Technorati tags: &lt;a href="http://technorati.com/tags/xaml" rel=tag&gt;xaml&lt;/a&gt;, &lt;a href="http://technorati.com/tags/xamlxporter" rel=tag&gt;xamlxporter&lt;/a&gt;&lt;/div&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-7161136268153875560&amp;page=RSS%3a+XamlXporter+-+Formatting+numbers+for+German+Locale&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=pavanpodila.spaces.live.com&amp;amp;GT1=pavanpodila"&gt;</description><comments>http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!355.entry#comment</comments><guid isPermaLink="true">http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!355.entry</guid><pubDate>Thu, 10 May 2007 15:21:05 GMT</pubDate><slash:comments>1</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://pavanpodila.spaces.live.com/blog/cns!9C9E888164859398!355/comments/feed.rss</wfw:commentRss><wfw:comment>http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!355.entry#comment</wfw:comment><dcterms:modified>2007-05-10T15:21:05Z</dcterms:modified></item><item><title>Custom Window Control - GlassWindow - Source Code</title><link>http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!345.entry</link><description>&lt;p&gt;Sometime back I had posted about the &lt;a href="http://pavanpodila.spaces.live.com/blog/cns!9C9E888164859398!208.entry"&gt;Custom Window Control&lt;/a&gt; but was a little lazy in putting up the source code as it was part of a bigger library. I have finally taken it out, changed the namespaces and removed some dependencies. Feel free to use the code as you wish. If you add any extra cool stuff, I would love to hear back :) &lt;p&gt;The zip contains the GlassWindow control with the Vista and the MacOSX window templates. It should give you a good idea about creating your own templates. &lt;p&gt;The executable has two XAML Windows for the Vista and MacOSX style. By switching the StartupUri in App.xaml you can test both. &lt;p&gt;&lt;img height=300 src="http://tk4.storage.msn.com/x1pUXuoQw6UT5_lWK8toAz6R38fFBeOmz-I8FMmQMe64qmipdTgSteCtJhJa1RlVEsfc4V8D96NMRk245unironvi2FEng6N1NRSpt_GRPfxoM8YXhDyyHIWZaUccYZfZYvEQyjC51t70MJIiIeVmP5yA" width=450&gt;  &lt;p&gt;  &lt;p&gt;&lt;img height=300 src="http://tk4.storage.msn.com/x1pUXuoQw6UT5_lWK8toAz6R38fFBeOmz-I8FMmQMe64qmT2ZaIoi9tXszyUx_oK5QPt_iNJAef80UDC4fPnUtUvwfXpilKYQ_h_zI9PSDj1lfl2MnYU8StnFQxEdGcoJFlhQ8o-9iSvwe_W8rQVAnEow" width=450&gt;  &lt;p&gt;  &lt;p&gt;&lt;a href="http://www.podila.net/files/GlassWindow.zip"&gt;Download Source&lt;/a&gt; &lt;p&gt;  &lt;p&gt;  &lt;div style="padding-right:0px;display:inline;padding-left:0px;padding-bottom:0px;margin:0px;padding-top:0px"&gt;Technorati tags: &lt;a href="http://technorati.com/tags/wpf" rel=tag&gt;wpf&lt;/a&gt;, &lt;a href="http://technorati.com/tags/xaml" rel=tag&gt;xaml&lt;/a&gt;, &lt;a href="http://technorati.com/tags/customcontrol" rel=tag&gt;customcontrol&lt;/a&gt;, &lt;a href="http://technorati.com/tags/glasswindow" rel=tag&gt;glasswindow&lt;/a&gt;&lt;/div&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-7161136268153875560&amp;page=RSS%3a+Custom+Window+Control+-+GlassWindow+-+Source+Code&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=pavanpodila.spaces.live.com&amp;amp;GT1=pavanpodila"&gt;</description><comments>http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!345.entry#comment</comments><guid isPermaLink="true">http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!345.entry</guid><pubDate>Tue, 10 Apr 2007 14:47:44 GMT</pubDate><slash:comments>23</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://pavanpodila.spaces.live.com/blog/cns!9C9E888164859398!345/comments/feed.rss</wfw:commentRss><wfw:comment>http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!345.entry#comment</wfw:comment><dcterms:modified>2007-04-10T14:47:44Z</dcterms:modified></item><item><title>Reusing decorative panels with ContentControl + ControlTemplate</title><link>http://pavanpodila.spaces.live.com/Blog/cns!9C9E888164859398!339.entry</link><description>&lt;p&gt;Of late I found a new use for ContentControl, which is to use it as a decorator (note the small-case 'd'). Lets take an example to illustrate this idea. Imagine you want to use a panel decoration like the one below: &lt;p&gt;&lt;img height=284 src="http://tk4.storage.msn.com/x1pUXuoQw6UT5_lWK8toAz6R38fFBeOmz-I8FMmQMe64qmPxoQB0h-Tb4OjvGh9xNie-axspyYXDOKQ-OB6dhgNZjFEIn3kynBRWNhmeKFFIQmsFA-05O81IzdhQ3ANEkBEmGGaLQwFwB6sXg95-FOQ1g" width=350&gt;  &lt;p&gt;There are couple of ways in which this can be achieved. &lt;ul&gt; &lt;li&gt;&lt;strong&gt;Build the Visual tree of the decoration around every control that needs to be decorated&lt;/strong&gt; -- too much duplication if it needs to be reused at lot of places  &lt;li&gt;&lt;strong&gt;Create a custom Decorator and override the OnRender() method&lt;/strong&gt; -- too tedious to modify the visual aspects (colors, gradients, bitmap-effects, etc) since we are building the decoration in code  &lt;li&gt;&lt;strong&gt;Make the visual tree as a ControlTemplate and use it for a ContentControl&lt;/strong&gt;. The child of the ContentControl will be the control you want to decorate.&lt;/ul&gt; &lt;p&gt;The last option is the most interesting one. Lets reproduce the XAML used to build the decoration above. &lt;p&gt;  &lt;p&gt; &lt;div style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px"&gt;&lt;pre style="width:100%;background-color:#EEEEEE;font-size:130%"&gt;&lt;div&gt;&lt;span style="color:#000000"&gt;    &lt;/span&gt;&lt;span style="color:#0000FF"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000"&gt;Grid&lt;/span&gt;&lt;span style="color:#0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#000000"&gt;
      &lt;/span&gt;&lt;span style="color:#0000FF"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000"&gt;Border &lt;/span&gt;&lt;span style="color:#FF0000"&gt;Background&lt;/span&gt;&lt;span style="color:#0000FF"&gt;=&amp;quot;#FFFFFFFF&amp;quot;&lt;/span&gt;&lt;span style="color:#FF0000"&gt;
              BorderBrush&lt;/span&gt;&lt;span style="color:#0000FF"&gt;=&amp;quot;{StaticResource PanelBorderBrush}&amp;quot;&lt;/span&gt;&lt;span style="color:#FF0000"&gt;
              BorderThickness&lt;/span&gt;&lt;span style="color:#0000FF"&gt;=&amp;quot;1,1,1,1&amp;quot;&lt;/span&gt;&lt;span style="color:#FF0000"&gt;
              CornerRadius&lt;/span&gt;&lt;span style="color:#0000FF"&gt;=&amp;quot;5,5,5,5&amp;quot;&lt;/span&gt;&lt;span style="color:#0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#000000"&gt;
        &lt;/span&gt;&lt;span style="color:#0000FF"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000"&gt;Border &lt;/span&gt;&lt;span style="color:#FF0000"&gt;Margin&lt;/span&gt;&lt;span style="color:#0000FF"&gt;=&amp;quot;3,3,3,3&amp;quot;&lt;/span&gt;&lt;span style="color:#FF0000"&gt;
                Background&lt;/span&gt;&lt;span style="color:#0000FF"&gt;=&amp;quot;#FF000000&amp;quot;&lt;/span&gt;&lt;span style="color:#FF0000"&gt;
                BorderBrush&lt;/span&gt;&lt;span style="color:#0000FF"&gt;=&amp;quot;{StaticResource PanelBorderBrush}&amp;quot;&lt;/span&gt;&lt;span style="color:#FF0000"&gt;
                BorderThickness&lt;/span&gt;&lt;span style="color:#0000FF"&gt;=&amp;quot;1,1,1,1&amp;quot;&lt;/span&gt;&lt;span style="color:#FF0000"&gt;
                CornerRadius&lt;/span&gt;&lt;span style="color:#0000FF"&gt;=&amp;quot;5,5,5,5&amp;quot;&lt;/span&gt;&lt;span style="color:#0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#000000"&gt;
        &lt;/span&gt;&lt;span style="color:#0000FF"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#800000"&gt;Border&lt;/span&gt;&lt;span style="color:#0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#000000"&gt;
      &lt;/span&gt;&lt;span style="color:#0000FF"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#800000"&gt;Border&lt;/span&gt;&lt;span style="color:#0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#000000"&gt;

      &lt;/span&gt;&lt;span style="color:#0000FF"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000"&gt;Rectangle &lt;/span&gt;&lt;span style="color:#FF0000"&gt;Stroke&lt;/span&gt;&lt;span style="color:#0000FF"&gt;=&amp;quot;{x:Null}&amp;quot;&lt;/span&gt;&lt;span style="color:#FF0000"&gt;
                 VerticalAlignment&lt;/span&gt;&lt;span style="color:#0000FF"&gt;=&amp;quot;Top&amp;quot;&lt;/span&gt;&lt;span style="color:#FF0000"&gt;
                 Height&lt;/span&gt;&lt;span style="color:#0000FF"&gt;=&amp;quot;54&amp;quot;&lt;/span&gt;&lt;span style="color:#0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#000000"&gt;
        &lt;/span&gt;&lt;span style="color:#0000FF"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000"&gt;Rectangle&lt;/span&gt;&lt;span style="color:#FF0000"&gt;.Fill&lt;/span&gt;&lt;span style="color:#0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#000000"&gt;
          &lt;/span&gt;&lt;span style="color:#0000FF"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000"&gt;LinearGradientBrush &lt;/span&gt;&lt;span style="color:#FF0000"&gt;EndPoint&lt;/span&gt;&lt;span style="color:#0000FF"&gt;=&amp;quot;0.5,0.815&amp;quot;&lt;/span&gt;&lt;span style="color:#FF0000"&gt;
                               StartPoint&lt;/span&gt;&lt;span style="color:#0000FF"&gt;=&amp;quot;0.5,0.241&amp;quot;&lt;/span&gt;&lt;span style="color:#0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#000000"&gt;
            &lt;/span&gt;&lt;span style="color:#0000FF"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000"&gt;GradientStop &lt;/span&gt;&lt;span style="color:#FF0000"&gt;Color&lt;/span&gt;&lt;span style="color:#0000FF"&gt;=&amp;quot;#57FFFFFF&amp;quot;&lt;/span&gt;&lt;span style="color:#FF0000"&gt;
                          Offset&lt;/span&gt;&lt;span style="color:#0000FF"&gt;=&amp;quot;0&amp;quot;&lt;/span&gt;&lt;span style="color:#0000FF"&gt;/&amp;gt;&lt;/span&gt;&lt;span style="color:#000000"&gt;
            &lt;/span&gt;&lt;span style="color:#0000FF"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000"&gt;GradientStop &lt;/span&gt;&lt;span style="color:#FF0000"&gt;Color&lt;/span&gt;&lt;span style="color:#0000FF"&gt;=&amp;quot;#00FFFFFF&amp;quot;&lt;/span&gt;&lt;span style="color:#FF0000"&gt;
                          Offset&lt;/span&gt;&lt;span style="color:#0000FF"&gt;=&amp;quot;1&amp;quot;&lt;/span&gt;&lt;span style="color:#0000FF"&gt;/&amp;gt;&lt;/span&gt;&lt;span style="color:#000000"&gt;
          &lt;/span&gt;&lt;span style="color:#0000FF"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#800000"&gt;LinearGradientBrush&lt;/span&gt;&lt;span style="color:#0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#000000"&gt;
        &lt;/span&gt;&lt;span style="color:#0000FF"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#800000"&gt;Rectangle.Fill&lt;/span&gt;&lt;span style="color:#0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#000000"&gt;
      &lt;/span&gt;&lt;span style="color:#0000FF"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#800000"&gt;Rectangle&lt;/span&gt;&lt;span style="color:#0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#000000"&gt;

      &lt;/span&gt;&lt;span style="color:#0000FF"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000"&gt;Grid&lt;/span&gt;&lt;span style="color:#FF0000"&gt;.BitmapEffect&lt;/span&gt;&lt;span style="color:#0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#000000"&gt;
        &lt;/span&gt;&lt;span style="color:#0000FF"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000"&gt;DropShadowBitmapEffect &lt;/span&gt;&lt;span style="color:#FF0000"&gt;Color&lt;/span&gt;&lt;span style="color:#0000FF"&gt;=&amp;quot;Black&amp;quot;&lt;/span&gt;&lt;span style="color:#FF0000"&gt;
                                Direction&lt;/span&gt;&lt;span style="color:#0000FF"&gt;=&amp;quot;315&amp;quot;&lt;/span&gt;&lt;span style="color:#FF0000"&gt;
                                ShadowDepth&lt;/span&gt;&lt;span style="color:#0000FF"&gt;=&amp;quot;1&amp;quot;&lt;/span&gt;&lt;span style="color:#FF0000"&gt;
                                Softness&lt;/span&gt;&lt;span style="color:#0000FF"&gt;=&amp;quot;0.5&amp;quot;&lt;/span&gt;&lt;span style="color:#FF0000"&gt;
                                Opacity&lt;/span&gt;&lt;span style="color:#0000FF"&gt;=&amp;quot;0.5&amp;quot;&lt;/span&gt;&lt;span style="color:#0000FF"&gt;/&amp;gt;&lt;/span&gt;&lt;span style="color:#000000"&gt;
      &lt;/span&gt;&lt;span style="color:#0000FF"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#800000"&gt;Grid.BitmapEffect&lt;/span&gt;&lt;span style="color:#0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#000000"&gt;
    &lt;/span&gt;&lt;span style="color:#0000FF"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#800000"&gt;Grid&lt;/span&gt;&lt;span style="color:#0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#000000"&gt;
&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;
&lt;p&gt;If you had to use this decoration for many controls, you would have to reproduce this visual tree many times, resulting in serious amount of duplication. What we would like to see is a much simpler way of adding decoration (similar in principle to Decorator), something like so:
&lt;p&gt; 
&lt;p&gt;
&lt;div style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px"&gt;&lt;pre style="width:100%;background-color:#EEEEEE;font-size:130%"&gt;&lt;div&gt;&lt;span style="color:#000000"&gt;    &lt;/span&gt;&lt;span style="color:#0000FF"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000"&gt;ContentControl &lt;/span&gt;&lt;span style="color:#FF0000"&gt;Template&lt;/span&gt;&lt;span style="color:#0000FF"&gt;=&amp;quot;{StaticResource BlackPanelBorderTemplate}&amp;quot;&lt;/span&gt;&lt;span style="color:#FF0000"&gt;
                    Grid.Row&lt;/span&gt;&lt;span style="color:#0000FF"&gt;=&amp;quot;3&amp;quot;&lt;/span&gt;&lt;span style="color:#FF0000"&gt;
                    Grid.ColumnSpan&lt;/span&gt;&lt;span style="color:#0000FF"&gt;=&amp;quot;2&amp;quot;&lt;/span&gt;&lt;span style="color:#FF0000"&gt;
                    Margin&lt;/span&gt;&lt;span style="color:#0000FF"&gt;=&amp;quot;10,10,10,10&amp;quot;&lt;/span&gt;&lt;span style="color:#0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#000000"&gt;

      &lt;/span&gt;&lt;span style="color:#0000FF"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000"&gt;views:StatusInfo&lt;/span&gt;&lt;span style="color:#0000FF"&gt;/&amp;gt;&lt;/span&gt;&lt;span style="color:#000000"&gt;
    &lt;/span&gt;&lt;span style="color:#0000FF"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#800000"&gt;ContentControl&lt;/span&gt;&lt;span style="color:#0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#000000"&gt;
&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;
&lt;p&gt;What we are doing here is abstracting the visual decoration into a ControlTemplate and then using the ContentControl as a Decorator !! This makes the markup more readable and maintainable. If you have to make any changes to the decoration, it happens inside the ControlTemplate and automatically updates all the places where it is referred. As a developer, that is exactly what I want -- central point of control. Note that this sounds like the &lt;a href="http://www.ddj.com/blog/architectblog/archives/2006/06/single_responsi.html"&gt;Single Responsibility Principle (SRP)&lt;/a&gt;.
&lt;p&gt;The ControlTemplate looks as  below. Note the use of the &lt;strong&gt;&amp;lt;ContentPresenter/&amp;gt;&lt;/strong&gt;, which will hold the child content.
&lt;p&gt; 
&lt;p&gt;
&lt;div style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px"&gt;&lt;pre style="width:100%;background-color:#EEEEEE;font-size:130%"&gt;&lt;div&gt;&lt;span style="color:#000000"&gt;  &lt;/span&gt;&lt;span style="color:#0000FF"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000"&gt;ControlTemplate &lt;/span&gt;&lt;span style="color:#FF0000"&gt;x:Key&lt;/span&gt;&lt;span style="color:#0000FF"&gt;=&amp;quot;BlackPanelBorderTemplate&amp;quot;&lt;/span&gt;&lt;span style="color:#FF0000"&gt;
                   TargetType&lt;/span&gt;&lt;span style="color:#0000FF"&gt;=&amp;quot;{x:Type ContentControl}&amp;quot;&lt;/span&gt;&lt;span style="color:#0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#000000"&gt;
    &lt;/span&gt;&lt;span style="color:#0000FF"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000"&gt;Grid&lt;/span&gt;&lt;span style="color:#0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#000000"&gt;
      &lt;/span&gt;&lt;span style="color:#0000FF"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000"&gt;Border &lt;/span&gt;&lt;span style="color:#FF0000"&gt;Background&lt;/span&gt;&lt;span style="color:#0000FF"&gt;=&amp;quot;#FFFFFFFF&amp;quot;&lt;/span&gt;&lt;span style="color:#FF0000"&gt;
              BorderBrush&lt;/span&gt;&lt;span style="color:#0000FF"&gt;=&amp;quot;{StaticResource PanelBorderBrush}&amp;quot;&lt;/span&gt;&lt;span style="color:#FF0000"&gt;
              BorderThickness&lt;/span&gt;&lt;span style="color:#0000FF"&gt;=&amp;quot;1,1,1,1&amp;quot;&lt;/span&gt;&lt;span style="color:#FF0000"&gt;
              CornerRadius&lt;/span&gt;&lt;span style="color:#0000FF"&gt;=&amp;quot;5,5,5,5&amp;quot;&lt;/span&gt;&lt;span style="color:#0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#000000"&gt;
        &lt;/span&gt;&lt;span style="color:#0000FF"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000"&gt;Border &lt;/span&gt;&lt;span style="color:#FF0000"&gt;Margin&lt;/span&gt;&lt;span style="color:#0000FF"&gt;=&amp;quot;3,3,3,3&amp;quot;&lt;/span&gt;&lt;span style="color:#FF0000"&gt;
                Background&lt;/span&gt;&lt;span style="color:#0000FF"&gt;=&amp;quot;#FF000000&amp;quot;&lt;/span&gt;&lt;span style="color:#FF0000"&gt;
                BorderBrush&lt;/span&gt;&lt;span style="color:#0000FF"&gt;=&amp;quot;{StaticResource PanelBorderBrush}&amp;quot;&lt;/span&gt;&lt;span style="color:#FF0000"&gt;
                BorderThickness&lt;/span&gt;&lt;span style="color:#0000FF"&gt;=&amp;quot;1,1,1,1&amp;quot;&lt;/span&gt;&lt;span style="color:#FF0000"&gt;
                CornerRadius&lt;/span&gt;&lt;span style="color:#0000FF"&gt;=&amp;quot;5,5,5,5&amp;quot;&lt;/span&gt;&lt;span style="color:#0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#000000"&gt;
          &lt;/span&gt;&lt;span style="color:#0000FF"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000"&gt;ContentPresenter&lt;/span&gt;&lt;span style="color:#0000FF"&gt;/&amp;gt;&lt;/span&gt;&lt;span style="color:#000000"&gt;
        &lt;/span&gt;&lt;span style="color:#0000FF"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#800000"&gt;Border&lt;/span&gt;&lt;span style="color:#0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#000000"&gt;
      &lt;/span&gt;&lt;span style="color:#0000FF"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#800000"&gt;Border&lt;/span&gt;&lt;span style="color:#0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#000000"&gt;

      &lt;/span&gt;&lt;span style="color:#0000FF"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000"&gt;Rectangle &lt;/span&gt;&lt;span style="color:#FF0000"&gt;Stroke&lt;/span&gt;&lt;span style="color:#0000FF"&gt;=&amp;quot;{x:Null}&amp;quot;&lt;/span&gt;&lt;span style="color:#FF0000"&gt;
                 VerticalAlignment&lt;/span&gt;&lt;span style="color:#0000FF"&gt;=&amp;quot;Top&amp;quot;&lt;/span&gt;&lt;span style="color:#FF0000"&gt;
                 Height&lt;/span&gt;&lt;span style="color:#0000FF"&gt;=&amp;quot;54&amp;quot;&lt;/span&gt;&lt;span style="color:#0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#000000"&gt;
        &lt;/span&gt;&lt;span style="color:#0000FF"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000"&gt;Rectangle&lt;/span&gt;&lt;span style="color:#FF0000"&gt;.Fill&lt;/span&gt;&lt;span style="color:#0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#000000"&gt;
          &lt;/span&gt;&lt;span style="color:#0000FF"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000"&gt;LinearGradientBrush &lt;/span&gt;&lt;span style="color:#FF0000"&gt;EndPoint&lt;/span&gt;&lt;span style="color:#0000FF"&gt;=&amp;quot;0.5,0.815&amp;quot;&lt;/span&gt;&lt;span style="color:#FF0000"&gt;
                               StartPoint&lt;/span&gt;&lt;span style="color:#0000FF"&gt;=&amp;quot;0.5,0.241&amp;quot;&lt;/span&gt;&lt;span style="color:#0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#000000"&gt;
 