<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/atom.xsl" media="screen"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-US"><title type="html">WPF Client Development</title><subtitle type="html">Experiences using WPF</subtitle><id>http://blogs.msdn.com/patrickdanino/atom.xml</id><link rel="alternate" type="text/html" href="http://blogs.msdn.com/patrickdanino/default.aspx" /><link rel="self" type="application/atom+xml" href="http://blogs.msdn.com/patrickdanino/atom.xml" /><generator uri="http://communityserver.org" version="2.1.61025.2">Community Server</generator><updated>2008-07-23T23:57:54Z</updated><entry><title>Apps and the PDC</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/patrickdanino/archive/2009/11/20/apps-and-the-pdc.aspx" /><id>http://blogs.msdn.com/patrickdanino/archive/2009/11/20/apps-and-the-pdc.aspx</id><published>2009-11-20T18:22:00Z</published><updated>2009-11-20T18:22:00Z</updated><content type="html">&lt;p&gt;There has been quite a bit of activity surrounding the PDC event that ended today. I wanted to call out a few applications that were worth trying, which leverage either WPF or Silverlight. Of course, the fact &lt;a href="http://www.silverlight.net/getstarted/silverlight-4-beta/" target="_blank" mce_href="http://www.silverlight.net/getstarted/silverlight-4-beta/"&gt;Silverlight 4.0 is right around the corner&lt;/a&gt; is great news, but I'm sure there's a number of other people and blogs have that one covered :)&lt;/p&gt;  &lt;p&gt;First, a new &lt;a href="http://msdn.microsoft.com/en-us/windows/ee388574.aspx" target="_blank" mce_href="http://msdn.microsoft.com/en-us/windows/ee388574.aspx"&gt;Facebook SDK&lt;/a&gt; was unveiled last week, making it easy to develop .Net applications that interact with the popular website. The SDK has support for both WPF and SL. If you're not sure which technology to pick, why not both? At least, that's what we're going for!&lt;/p&gt;  &lt;p&gt;We recently released a WPF application called Fishbowl, which makes use of the SDK and provides a great client experience. You can get the application &lt;a href="http://www.fishbowlclient.com/" target="_blank" mce_href="http://www.fishbowlclient.com"&gt;here&lt;/a&gt; and read more about it &lt;a href="http://windowsteamblog.com/blogs/windowsexperience/archive/2009/11/19/the-windows-platform-silverlight-4-and-facebook.aspx" target="_blank" mce_href="http://windowsteamblog.com/blogs/windowsexperience/archive/2009/11/19/the-windows-platform-silverlight-4-and-facebook.aspx"&gt;here&lt;/a&gt;. There unfortunately isn't a Silverlight version available, but that may very well change!&lt;/p&gt;  &lt;p&gt;One of the reasons I've been working with WPF for so long is because I believe it's one of the few platforms that enables truly compelling user experiences. One such application is called Pivot, from the MS Live Labs team. The chrome of the application was done in WPF, and the application leverages DirectX as well. Although the app is currently only available by invitation, I still recommend checking &lt;a href="http://www.getpivot.com/" target="_blank" mce_href="http://www.getpivot.com"&gt;its website&lt;/a&gt; if you want to learn more. For the time being, here's a video that demonstrates some of the things you can do:&lt;/p&gt;  &lt;p&gt;&lt;object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="509" height="382" id="video-player"&gt;
 &lt;param name="source" value="http://www.getpivot.com/silverlight/video-player.xap" /&gt;
 &lt;param name="onError" value="onSilverlightError" /&gt;
 &lt;param name="background" value="white" /&gt;
 &lt;param name="minRuntimeVersion" value="3.0.40624.0" /&gt; 
&lt;param name="autoUpgrade" value="true" /&gt;
 &lt;param name="enableHtmlAccess" value="true" /&gt;
 &lt;param name="enableGPUAcceleration" value="true" /&gt;
 &lt;param name="initparams" value="sdStreamUrl=http://content.getpivot.com/wmv/PivotVideo_SD.wmv,sdDownloadUrl=http://content.getpivot.com/wmv/PivotVideo_SD.zip,hdStreamUrl=http://content.getpivot.com/wmv/PivotVideo_HD.wmv,hdDownloadUrl=http://content.getpivot.com/wmv/PivotVideo_HD.zip,playerSettings = &amp;lt;Playlist&amp;gt;&amp;lt;AutoLoad&amp;gt;false&amp;lt;/AutoLoad&amp;gt;&amp;lt;AutoPlay&amp;gt;false&amp;lt;/AutoPlay&amp;gt;&amp;lt;DisplayTimeCode&amp;gt;false&amp;lt;/DisplayTimeCode&amp;gt;&amp;lt;EnableCachedComposition&amp;gt;false&amp;lt;/EnableCachedComposition&amp;gt;&amp;lt;EnableCaptions&amp;gt;false&amp;lt;/EnableCaptions&amp;gt;&amp;lt;EnableOffline&amp;gt;false&amp;lt;/EnableOffline&amp;gt;&amp;lt;EnablePopOut&amp;gt;false&amp;lt;/EnablePopOut&amp;gt;&amp;lt;StartMuted&amp;gt;false&amp;lt;/StartMuted&amp;gt;&amp;lt;StretchMode&amp;gt;0&amp;lt;/StretchMode&amp;gt;&amp;lt;Items&amp;gt;&amp;lt;PlaylistItem&amp;gt;&amp;lt;IsAdaptiveStreaming&amp;gt;false&amp;lt;/IsAdaptiveStreaming&amp;gt;&amp;lt;MediaSource&amp;gt;http://content.getpivot.com/wmv/1002290_LiveLabs_111109_v03_512x384_600kbps_VBR.wmv&amp;lt;/MediaSource&amp;gt;&amp;lt;ThumbSource&amp;gt;http://www.getpivot.com/silverlight/images/videos/hero-02-pivot-screenshot-play-btn.jpg&amp;lt;/ThumbSource&amp;gt;&amp;lt;Description&amp;gt;Clicking this takes you to video 2&amp;lt;/Description&amp;gt;&amp;lt;/PlaylistItem&amp;gt;&amp;lt;/Items&amp;gt;&amp;lt;/Playlist&amp;gt;" /&gt;
 &lt;a href="http://go.microsoft.com/fwlink/?LinkID=149156&amp;amp;v=3.0.40624.0" style="text-decoration:none"&gt;
 &lt;img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style:none" /&gt;
 &lt;/a&gt;
 &lt;/object&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9926376" width="1" height="1"&gt;</content><author><name>Patrick Danino</name><uri>http://blogs.msdn.com/members/Patrick+Danino.aspx</uri></author></entry><entry><title>Custom Controls and UI Automation</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/patrickdanino/archive/2009/11/11/custom-controls-and-ui-automation.aspx" /><link rel="enclosure" type="application/x-zip-compressed" length="11480" href="http://blogs.msdn.com/patrickdanino/attachment/9921091.ashx" /><id>http://blogs.msdn.com/patrickdanino/archive/2009/11/11/custom-controls-and-ui-automation.aspx</id><published>2009-11-11T22:16:00Z</published><updated>2009-11-11T22:16:00Z</updated><content type="html">&lt;P&gt;We came across an interesting problem a customer hit when trying to write a custom control. The issue was that although the control appeared to work correctly in the application, when it came time to do out-of-process testing using UI Automation (UIA), the newly added functionality of the custom control wasn’t being exposed, and therefore couldn’t be tested. In this post, I’ll explain a little what the problem is, and offer a possible solution.&lt;/P&gt;
&lt;P&gt;First, kudos to the customer for taking the time to test the custom control, and realizing there was an issue to begin with. This is a good example of why it's important to do software testing and verify assumptions, as although things seem to&amp;nbsp;“just work”, that’s not always the case.&lt;/P&gt;
&lt;P&gt;The custom control in question is a modified tab control, with a Header property that allows you to specify content in addition to the usual tab items. This is a little similar to the concept of a HeaderedContentControl, and the markup would look like this:&lt;/P&gt;
&lt;DIV style="PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; DISPLAY: inline; FLOAT: none; PADDING-TOP: 0px" id=scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:751a80b0-97d5-4b0f-8ad1-11ea9049053e class=wlWriterEditableSmartContent&gt;&lt;PRE style="BACKGROUND-COLOR: white; OVERFLOW: auto"&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;local:CustomTabControl &lt;/SPAN&gt;&lt;SPAN style="COLOR: #ff0000"&gt;Style&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;="&lt;/SPAN&gt;&lt;SPAN style="COLOR: #808000"&gt;{StaticResource TabControlStyle}&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;"&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;local:CustomTabControl.Header&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: #008000"&gt;&amp;lt;!--&lt;/SPAN&gt;&lt;SPAN style="COLOR: #008000"&gt; Any content can go here &lt;/SPAN&gt;&lt;SPAN style="COLOR: #008000"&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;Button &lt;/SPAN&gt;&lt;SPAN style="COLOR: #ff0000"&gt;Content&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;="Header Button"&lt;/SPAN&gt;&lt;SPAN style="COLOR: #ff0000"&gt; &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;local:CustomTabControl.Header&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;local:CustomTabControl.Items&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;TabItem &lt;/SPAN&gt;&lt;SPAN style="COLOR: #ff0000"&gt;Header&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;="Tab 1"&lt;/SPAN&gt;&lt;SPAN style="COLOR: #ff0000"&gt; &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;TabItem &lt;/SPAN&gt;&lt;SPAN style="COLOR: #ff0000"&gt;Header&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;="Tab 2"&lt;/SPAN&gt;&lt;SPAN style="COLOR: #ff0000"&gt; &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;local:CustomTabControl.Items&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;local:CustomTabControl&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --&gt;&lt;/DIV&gt;
&lt;P&gt;As you may have guessed, the problem is that although the custom tab control exposed the tab items properly to UIA, it didn’t also expose the Header content. Is this expected? Yes, because controls in WPF are responsible for exposing their UIA items themselves.&lt;/P&gt;
&lt;P&gt;This is done through the &lt;A href="http://msdn.microsoft.com/en-us/library/system.windows.automation.peers.automationpeer.aspx" mce_href="http://msdn.microsoft.com/en-us/library/system.windows.automation.peers.automationpeer.aspx"&gt;&lt;STRONG&gt;AutomationPeer&lt;/STRONG&gt;&lt;/A&gt; class. All the major control classes in WPF, such as &lt;STRONG&gt;TabControl&lt;/STRONG&gt;, have a corresponding &lt;STRONG&gt;AutomationPeer&lt;/STRONG&gt; class that exposes the control’s functionality to UIA, creatively named &lt;STRONG&gt;TabControlAutomationPeer&lt;/STRONG&gt; in this case. This is explained in some detail in &lt;A href="http://msdn.microsoft.com/en-us/library/cc165614.aspx" mce_href="http://msdn.microsoft.com/en-us/library/cc165614.aspx"&gt;this MSDN page&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;When a UIA client looks at the structure of the application, WPF will raise the &lt;STRONG&gt;OnCreateAutomationPeer&lt;/STRONG&gt; event on elements in the WPF application tree. In the case of a regular &lt;STRONG&gt;TabControl&lt;/STRONG&gt;, when the event is raised, a &lt;STRONG&gt;TabControlAutomationPeer&lt;/STRONG&gt; instance is created. If you write a custom control but don’t handle this event, the behavior of the base class your control derives from is the behavior that will be exposed to UIA. Since &lt;STRONG&gt;TabControlAutomationPeer &lt;/STRONG&gt;doesn’t know about the newly added Header property in &lt;STRONG&gt;CustomTabControl&lt;/STRONG&gt;, it doesn’t expose it to UIA.&lt;/P&gt;
&lt;P&gt;Now that the problem is clearer, lets focus on a solution. In order for CustomTabControl to behave as expected, you would need to create its CustomTabControlAutomationPeer counterpart. Since we’re only adding one property to TabControl, we can derive from TabControlAutomationPeer and reuse most of the base class functionality:&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV style="PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; DISPLAY: inline; FLOAT: none; PADDING-TOP: 0px" id=scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:a6642d60-9671-42b3-b8c8-ddbe8866564f class=wlWriterEditableSmartContent&gt;&lt;PRE style="BACKGROUND-COLOR: #ffffff; OVERFLOW: auto"&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;class&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt; CustomTabControlAutomationPeer : TabControlAutomationPeer
   {
      &lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;public&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt; CustomTabControlAutomationPeer(TabControl owner)
         : &lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;base&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt;(owner)
      {
      }
      
      &lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;protected&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;override&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; GetClassNameCore()
      {
         &lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;return&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #800000"&gt;"&lt;/SPAN&gt;&lt;SPAN style="COLOR: #800000"&gt;CustomTabControl&lt;/SPAN&gt;&lt;SPAN style="COLOR: #800000"&gt;"&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt;;
      }
      
      &lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;protected&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;override&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt; List&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt;AutomationPeer&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt; GetChildrenCore()
      {
         List&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt;AutomationPeer&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt; automationPeers &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;base&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt;.GetChildrenCore();
         CustomTabControl owner &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;base&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt;.Owner &lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;as&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt; CustomTabControl;
         &lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;if&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt; (owner &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;null&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt;)
         {
            UIElement headerUIElement &lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt;=&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt; owner.Header &lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;as&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt; UIElement;
            &lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;if&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt; (headerUIElement &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;null&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt;)
            {
               AutomationPeer peer &lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt;=&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt; UIElementAutomationPeer.CreatePeerForElement(headerUIElement);
               &lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;if&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt; (peer &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;null&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt;)
               {
                  automationPeers.Add(peer);
               }
            }
         }
      
         &lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;return&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt; automationPeers;
      }
   }&lt;/SPAN&gt;&lt;/PRE&gt;&lt;!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --&gt;&lt;/DIV&gt;The CustomTabControl now needs to create an instance of the new CustomTabControlAutomationPeer: 
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV style="PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; DISPLAY: inline; FLOAT: none; PADDING-TOP: 0px" id=scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:324fc3e9-c59b-4f04-97fc-5ec9d1bac783 class=wlWriterEditableSmartContent&gt;&lt;PRE style="BACKGROUND-COLOR: #ffffff; OVERFLOW: auto"&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;class&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt; CustomTabControl : TabControl
   {
      ...
      &lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;protected&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;override&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt; AutomationPeer OnCreateAutomationPeer()
      {
         &lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;return&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; CustomTabControlAutomationPeer(&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;this&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt;);
      }
   }&lt;/SPAN&gt;&lt;/PRE&gt;&lt;!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --&gt;&lt;/DIV&gt;
&lt;P&gt;If you launch a UIA tool like UI Spy (great tool which is available in the .Net Framework SDK), this is what you would see before the change, with a view scoped to the custom tab control:&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://blogs.msdn.com/photos/patrick_danino/images/9921038/500x201.aspx" mce_src="http://blogs.msdn.com/photos/patrick_danino/images/9921038/500x201.aspx"&gt;&lt;/P&gt;
&lt;P&gt;This is what you can see after the change, with the Header button properly exposed:&lt;/P&gt;
&lt;P mce_keep="true"&gt;&lt;IMG src="http://blogs.msdn.com/photos/patrick_danino/images/9921039/500x199.aspx" mce_src="http://blogs.msdn.com/photos/patrick_danino/images/9921039/500x199.aspx"&gt;&lt;/P&gt;
&lt;P&gt;So is that all we need? Actually, no. There is an issue with the solution I have described so far. What happens if the content of the Header property is changed to something else? At the moment, nothing from a UIA perspective. Because UIA doesn’t keep track of changes, and because you didn’t notify it of any changes, the image you see above would remain the same, and it would incorrectly believe the Header content is the same.&lt;/P&gt;
&lt;P&gt;To solve this, you need to find a way to notify UIA of the change. Luckily, WPF makes this fairly straightforward when using a &lt;A href="http://msdn.microsoft.com/en-us/library/ms752914.aspx" mce_href="http://msdn.microsoft.com/en-us/library/ms752914.aspx"&gt;DependencyProperty&lt;/A&gt;, which is how you would expose a Header property in the custom control. When you declare the property, you can specify a PropertyChanged handler for the Header which would look like this:&lt;/P&gt;
&lt;DIV style="PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; DISPLAY: inline; FLOAT: none; PADDING-TOP: 0px" id=scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:9d1cd349-f6cd-4968-957c-a2dc8bcd3d68 class=wlWriterEditableSmartContent&gt;&lt;PRE style="BACKGROUND-COLOR: #ffffff; OVERFLOW: auto"&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;class&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt; CustomTabControl : TabControl
   {
      ...
      &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; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;readonly&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt; DependencyProperty HeaderProperty &lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt;=&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt; DependencyProperty.Register(&lt;/SPAN&gt;&lt;SPAN style="COLOR: #800000"&gt;"&lt;/SPAN&gt;&lt;SPAN style="COLOR: #800000"&gt;Header&lt;/SPAN&gt;&lt;SPAN style="COLOR: #800000"&gt;"&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt;, &lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;typeof&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt;(&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;object&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt;), &lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;typeof&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt;(CustomTabControl),
         &lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;new&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt; FrameworkPropertyMetadata(OnPropertyChanged));
      &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;static&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; OnPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
      {
         CustomTabControl tabControl &lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt;=&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt; d &lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;as&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt; CustomTabControl;
         &lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;if&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt; (tabControl &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;null&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt;&amp;amp;&amp;amp;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt; (e.OldValue &lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt;!=&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt; e.NewValue))
         {
            &lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;if&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt; (AutomationPeer.ListenerExists(AutomationEvents.StructureChanged))
            {
               &lt;/SPAN&gt;&lt;SPAN style="COLOR: #008000"&gt;//&lt;/SPAN&gt;&lt;SPAN style="COLOR: #008000"&gt; Notify the UI automation client that the content changed&lt;/SPAN&gt;&lt;SPAN style="COLOR: #008000"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt;               TabControlAutomationPeer peer &lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt;=&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt; UIElementAutomationPeer.FromElement(tabControl) &lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;as&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt; TabControlAutomationPeer;
               &lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;if&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt; (peer &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;null&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt;)
               {
                  peer.RaiseAutomationEvent(AutomationEvents.StructureChanged);
               }
            }
         }
      }
   }&lt;/SPAN&gt;&lt;/PRE&gt;&lt;!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --&gt;&lt;/DIV&gt;
&lt;P&gt;When the Header content changes, this raises an event which lets UIA know it needs to perform an update. A VS 2008 sample with all the code in this post can be found below, and hope you found this useful!&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9921091" width="1" height="1"&gt;</content><author><name>Patrick Danino</name><uri>http://blogs.msdn.com/members/Patrick+Danino.aspx</uri></author><category term="WPF" scheme="http://blogs.msdn.com/patrickdanino/archive/tags/WPF/default.aspx" /><category term="Client" scheme="http://blogs.msdn.com/patrickdanino/archive/tags/Client/default.aspx" /></entry><entry><title>Custom Scrollable Panels</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/patrickdanino/archive/2009/10/01/custom-scrollable-panels.aspx" /><id>http://blogs.msdn.com/patrickdanino/archive/2009/10/01/custom-scrollable-panels.aspx</id><published>2009-10-01T22:43:21Z</published><updated>2009-10-01T22:43:21Z</updated><content type="html">&lt;p&gt;Thought I’d share an interesting (albeit rather old) series of blog posts on how to write scrollable custom panels.&lt;/p&gt;  &lt;p&gt;The set of 4 posts walk through how to write a simple panel that implements part of the &lt;font color="#ff8000"&gt;IScrollInfo&lt;/font&gt; interface, which is needed to allow the &lt;font color="#ff8000"&gt;ScrollViewer&lt;/font&gt; control to delegate the responsibility of scrolling.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/bencon/archive/2006/01/05/509991.aspx"&gt;Part 1&lt;/a&gt;, &lt;a href="http://blogs.msdn.com/bencon/archive/2006/01/06/510355.aspx"&gt;Part 2&lt;/a&gt;, &lt;a href="http://blogs.msdn.com/bencon/archive/2006/01/07/510530.aspx"&gt;Part 3&lt;/a&gt;, &lt;a href="http://blogs.msdn.com/bencon/archive/2006/12/09/iscrollinfo-tutorial-part-iv.aspx"&gt;Part 4&lt;/a&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9902013" width="1" height="1"&gt;</content><author><name>Patrick Danino</name><uri>http://blogs.msdn.com/members/Patrick+Danino.aspx</uri></author></entry><entry><title>TestAPI 0.3 Released</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/patrickdanino/archive/2009/07/23/testapi-0-3-released.aspx" /><id>http://blogs.msdn.com/patrickdanino/archive/2009/07/23/testapi-0-3-released.aspx</id><published>2009-07-24T01:56:44Z</published><updated>2009-07-24T01:56:44Z</updated><content type="html">&lt;p&gt;A new version of the TestAPI library has just been released. The new release contains fault injection APIs, combinatorial variation generation APIs and application control APIs.&lt;/p&gt;  &lt;p&gt;We encourage you to try it out and give us your feedback! You can find the latest release of the TestAPI library &lt;a href="http://testapi.codeplex.com/"&gt;here&lt;/a&gt;.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9846869" width="1" height="1"&gt;</content><author><name>Patrick Danino</name><uri>http://blogs.msdn.com/members/Patrick+Danino.aspx</uri></author></entry><entry><title>Model-View-ViewModel Toolkit 0.1 Released!</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/patrickdanino/archive/2009/05/01/model-view-viewmodel-toolkit-0-1-released.aspx" /><id>http://blogs.msdn.com/patrickdanino/archive/2009/05/01/model-view-viewmodel-toolkit-0-1-released.aspx</id><published>2009-05-02T01:10:51Z</published><updated>2009-05-02T01:10:51Z</updated><content type="html">&lt;p&gt;It’s been a while since my last update. I’ve been busy working on a new WPF Model-View-ViewModel toolkit, which you can find on the Codeplex &lt;a href="http://wpf.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=14962"&gt;WPF Futures&lt;/a&gt; site.&lt;/p&gt;  &lt;p&gt;The template is meant to introduce the Model-View-ViewModel (M-V-VM) design pattern to the WPF community. It includes:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;A Visual Studio 2008 template (Visual C# Express 2008 also supported) &lt;/li&gt;    &lt;li&gt;Documentation &lt;/li&gt;    &lt;ul&gt;     &lt;li&gt;General introduction to M-V-VM&lt;/li&gt;      &lt;li&gt;Walkthrough using the VS template &lt;/li&gt;   &lt;/ul&gt;    &lt;li&gt;A complete WPF application demonstrating the MVVM pattern&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;We hope you find it useful. Feel free to &lt;a href="http://wpf.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=14962#DownloadId=67235"&gt;try it out&lt;/a&gt; and share your comments/suggestions!&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9583048" width="1" height="1"&gt;</content><author><name>Patrick Danino</name><uri>http://blogs.msdn.com/members/Patrick+Danino.aspx</uri></author></entry><entry><title>Silverlight 3.0 Beta is Released!</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/patrickdanino/archive/2009/03/19/silverlight-3-0-beta-is-released.aspx" /><id>http://blogs.msdn.com/patrickdanino/archive/2009/03/19/silverlight-3-0-beta-is-released.aspx</id><published>2009-03-19T21:31:09Z</published><updated>2009-03-19T21:31:09Z</updated><content type="html">&lt;p&gt;&lt;a href="http://silverlight.net/getstarted/silverlight3/default.aspx"&gt;Silverlight 3.0 Beta&lt;/a&gt; was unveiled at Mix09 yesterday, along with a preview of &lt;a href="http://www.microsoft.com/expression/try-it/blendpreview.aspx"&gt;Expression Blend 3.0&lt;/a&gt;. &lt;/p&gt;  &lt;p&gt;The list of new features being released in the products is nothing short of impressive. &lt;a href="http://www.webmonkey.com/blog/MIX09%3A_Silverlight_3_Brings_HD__Multitouch__Offline_Apps_to_the_Web"&gt;This article&lt;/a&gt; at Wired Magazine does a good job of going through the main features, but if you’re short on time, the highlights are as follows:&lt;/p&gt;  &lt;p&gt;Silverlight:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;HD Streaming of 720p without buffering &lt;/li&gt;    &lt;li&gt;Standalone application support (aka out of browser!) &lt;/li&gt;    &lt;li&gt;Hardware acceleration &lt;/li&gt;    &lt;li&gt;3D visual features &lt;/li&gt;    &lt;li&gt;Multi-touch support &lt;/li&gt;    &lt;li&gt;&lt;a href="http://eclipse4sl.org/download/mac"&gt;Eclipse for Silverlight&lt;/a&gt; support on the Mac &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Expression Blend:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Sketchflow feature allows for quick prototyping of workflow by defining states and transitions between states &lt;/li&gt;    &lt;li&gt;Import files directly from Adobe Illustrator/Photoshop &lt;/li&gt;    &lt;li&gt;Export workflow to an automatically generated Word document &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;If you’ve been holding off trying out Silverlight, this seems like a great time to take a closer look!&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9490825" width="1" height="1"&gt;</content><author><name>Patrick Danino</name><uri>http://blogs.msdn.com/members/Patrick+Danino.aspx</uri></author><category term="Silverlight" scheme="http://blogs.msdn.com/patrickdanino/archive/tags/Silverlight/default.aspx" /></entry><entry><title>Great WPF App</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/patrickdanino/archive/2009/02/26/great-wpf-app.aspx" /><id>http://blogs.msdn.com/patrickdanino/archive/2009/02/26/great-wpf-app.aspx</id><published>2009-02-26T03:11:00Z</published><updated>2009-02-26T03:11:00Z</updated><content type="html">&lt;p&gt;I was recently taking a look at the apps &lt;a href="http://www.thirteen23.com/"&gt;thirteen23&lt;/a&gt; has been working on. The company specializes in designing and developing rich applications, primarily focused around .Net, whether it be for desktop, touch or mobile devices.&lt;/p&gt;  &lt;p&gt;While perusing the experiences they offer, I stumbled on &lt;a href="http://www.thirteen23.com/experiences/desktop/drama/"&gt;Drama&lt;/a&gt;. In short, it’s a desktop application that allows you to search and view Netflix movies. You can sign into your account, giving you access to your personalized queue, and allowing you to you re-organize it using intuitive drag &amp;amp; drop. You can also watch movies available for instant viewing.&lt;/p&gt;  &lt;p&gt;Aside from the fact it’s visually stunning, I particularly liked the fact the app does a great job of seamlessly integrating with the publicly available &lt;a href="http://developer.netflix.com/"&gt;Netflix API&lt;/a&gt;, resulting in a truly compelling desktop experience.&lt;/p&gt;  &lt;p&gt;It goes to show that even if a company is primarily known for its web presence, there’s nothing preventing it from also getting a branded desktop presence. If you were to include a few premium features that can be done on the desktop but difficult to do in a web browser (multiple windows, minimizing, disk access, etc.), you could potentially increase the amount of time users spend actively interacting with your services. If you include some well-placed context-aware advertising (new movie releases in a theater near you, for example), you might even be generating a new revenue stream.&lt;/p&gt;  &lt;p&gt;Wouldn’t it be nice to have a clean, well-designed &lt;a href="http://experience.thirteen23.com/2008/08/26/facebook-the-way-it-should-be/"&gt;Facebook app&lt;/a&gt; without having to use a web browser?&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9444857" width="1" height="1"&gt;</content><author><name>Patrick Danino</name><uri>http://blogs.msdn.com/members/Patrick+Danino.aspx</uri></author></entry><entry><title>Debugging Optimized Code</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/patrickdanino/archive/2009/01/12/debugging-optimized-code.aspx" /><id>http://blogs.msdn.com/patrickdanino/archive/2009/01/12/debugging-optimized-code.aspx</id><published>2009-01-13T00:36:35Z</published><updated>2009-01-13T00:36:35Z</updated><content type="html">&lt;p&gt;At one point or another, you run in the situation where you need to debug an application that makes use of optimized binaries, as is the case with WPF binaries.&lt;/p&gt;  &lt;p&gt;Although you have the right symbols, and even have source code (through Source Server or other means), you can't see values in Visual Studio, which frustratingly reports that them as &amp;quot;unavailable&amp;quot;.&lt;/p&gt;  &lt;p&gt;Shawn Burke posted a great &lt;a href="http://blogs.msdn.com/sburke/archive/2008/01/29/how-to-disable-optimizations-when-debugging-reference-source.aspx"&gt;blog entry&lt;/a&gt; that explains, step by step, how to work around the issue. I hope it proves useful to others!&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9310433" width="1" height="1"&gt;</content><author><name>Patrick Danino</name><uri>http://blogs.msdn.com/members/Patrick+Danino.aspx</uri></author></entry><entry><title>TestAPI Released!</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/patrickdanino/archive/2008/12/10/testapi-released.aspx" /><id>http://blogs.msdn.com/patrickdanino/archive/2008/12/10/testapi-released.aspx</id><published>2008-12-10T03:54:11Z</published><updated>2008-12-10T03:54:11Z</updated><content type="html">&lt;p&gt;As part of our effort to make it easier to test applications, we would like to share some of the test technology we use internally on the WPF team with the community.&lt;/p&gt;  &lt;p&gt;We are making a library available, and although this first release is fairly small, it can already provide value to existing applications. New features will be added in no small part based on the feedback we receive from the community!&lt;/p&gt;  &lt;p&gt;Some of the current APIs in the library include:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;strong&gt;&lt;font color="#ff8000"&gt;Command Line Parsing&lt;/font&gt;&lt;/strong&gt;: Arguments are parsed and can be strongly typed&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;&lt;font color="#ff8000"&gt;Visual Verification&lt;/font&gt;&lt;/strong&gt;: Screenshot comparison&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;&lt;font color="#ff8000"&gt;WPF Dispatcher Helper&lt;/font&gt;&lt;/strong&gt;: Manage the dispatcher queue to make testing more predictable&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;&lt;font color="#ff8000"&gt;Input Helpers&lt;/font&gt;&lt;/strong&gt;: Keyboard, Mouse input APIs&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;&lt;font color="#ff8000"&gt;Accessibility Helpers&lt;/font&gt;&lt;/strong&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;The project is called &lt;font color="#ff8000"&gt;TestApi&lt;/font&gt;. Binaries, source code and samples were released on CodePlex at &lt;a href="http://codeplex.com/TestApi"&gt;http://codeplex.com/TestApi&lt;/a&gt;.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9188535" width="1" height="1"&gt;</content><author><name>Patrick Danino</name><uri>http://blogs.msdn.com/members/Patrick+Danino.aspx</uri></author><category term="WPF" scheme="http://blogs.msdn.com/patrickdanino/archive/tags/WPF/default.aspx" /><category term="Winforms" scheme="http://blogs.msdn.com/patrickdanino/archive/tags/Winforms/default.aspx" /><category term="Client" scheme="http://blogs.msdn.com/patrickdanino/archive/tags/Client/default.aspx" /></entry><entry><title>Managed Extensibility Framework (MEF)</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/patrickdanino/archive/2008/11/21/managed-extensibility-framework-mef.aspx" /><id>http://blogs.msdn.com/patrickdanino/archive/2008/11/21/managed-extensibility-framework-mef.aspx</id><published>2008-11-22T02:37:09Z</published><updated>2008-11-22T02:37:09Z</updated><content type="html">&lt;p&gt;One of the many announcements made at the PDC was that Visual Studio 10 will be built on top of WPF. In addition, VS will be using MEF as an extensibility mechanism. I just wanted to take a few minutes to explain what MEF is all about.&lt;/p&gt; &lt;p&gt;&lt;font color="#ff8000"&gt;The Managed Extensibility Framework&lt;/font&gt; (&lt;font color="#ff8000"&gt;MEF&lt;/font&gt;) is a library that makes it easy to develop reusable components. The framework provides a standard way for a host application to discover, expose and consume component extensions without the need for each of them to be coupled together.&lt;/p&gt; &lt;p&gt;At the heart of &lt;font color="#ff8000"&gt;MEF&lt;/font&gt; is a &lt;strong&gt;ComposablePart&lt;/strong&gt;, which exposes services or consumes externally provided services. This is done using a Contract, which can be as simple as adding an Import (to consume) or Export (to expose) attribute.&lt;/p&gt; &lt;p&gt;Although &lt;font color="#ff8000"&gt;MEF&lt;/font&gt; is still in development, it already provides a number of key benefits, and would be worth a look if you are, or plan on working on extensible applications. Full source and documentation can be found on &lt;a href="http://www.codeplex.com/MEF"&gt;CodePlex&lt;/a&gt;. It also includes samples, but if there’s interest I’ll add a sample on my blog as a step-by-step walk through.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9132405" width="1" height="1"&gt;</content><author><name>Patrick Danino</name><uri>http://blogs.msdn.com/members/Patrick+Danino.aspx</uri></author><category term="WPF" scheme="http://blogs.msdn.com/patrickdanino/archive/tags/WPF/default.aspx" /><category term="Client" scheme="http://blogs.msdn.com/patrickdanino/archive/tags/Client/default.aspx" /></entry><entry><title>Silverlight 2.0 Released</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/patrickdanino/archive/2008/10/15/silverlight-2-0-released.aspx" /><id>http://blogs.msdn.com/patrickdanino/archive/2008/10/15/silverlight-2-0-released.aspx</id><published>2008-10-15T23:37:35Z</published><updated>2008-10-15T23:37:35Z</updated><content type="html">&lt;p&gt;Silverlight 2.0 has been released, and you can install it &lt;a href="http://go.microsoft.com/fwlink/?LinkId=124807"&gt;here&lt;/a&gt;. The link will work for both PC and Mac versions.&lt;/p&gt;  &lt;p&gt;If you had any doubts about Silverlight, I highly recommend you check out the &lt;a href="http://memorabilia.hardrock.com/"&gt;Hard Rock Memorabilia&lt;/a&gt; site. The user experience and performance are both extremely impressive!&lt;/p&gt;  &lt;p&gt;You can find more info about Silverlight at &lt;a href="http://www.microsoft.com/silverlight"&gt;www.microsoft.com/silverlight&lt;/a&gt;.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9000990" width="1" height="1"&gt;</content><author><name>Patrick Danino</name><uri>http://blogs.msdn.com/members/Patrick+Danino.aspx</uri></author><category term="Silverlight" scheme="http://blogs.msdn.com/patrickdanino/archive/tags/Silverlight/default.aspx" /></entry><entry><title>Service Pack 1 released</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/patrickdanino/archive/2008/08/12/service-pack-1-released.aspx" /><id>http://blogs.msdn.com/patrickdanino/archive/2008/08/12/service-pack-1-released.aspx</id><published>2008-08-12T21:34:44Z</published><updated>2008-08-12T21:34:44Z</updated><content type="html">&lt;p&gt;In case you haven't heard, the &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=AB99342F-5D1A-413D-8319-81DA479AB0D7"&gt;.Net FX 3.5 Service Pack 1&lt;/a&gt; and &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=FBEE1648-7106-44A7-9649-6D9F6D58056E"&gt;VS 2008 Service Pack 1&lt;/a&gt; have been released! The VS 2008 Express Edition with SP1 is also available &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=F3FBB04E-92C2-4701-B4BA-92E26E408569"&gt;here&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;In addition to providing bug fixes, the update also includes a number of new WPF features. One of these is the &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=992CFFCB-F8CE-41D9-8BD6-31F3E216285C"&gt;.Net Client Profile&lt;/a&gt;, which improves the setup experience of client applications in both speed of installation and size of the redistributable, reduced from 197 MB to 26.5 MB.&lt;/p&gt;  &lt;p&gt;You can read more about the SP1 update on &lt;a href="http://blogs.msdn.com/somasegar/archive/2008/08/11/service-pack-1-for-vs-2008-and-net-fx-3-5-released.aspx"&gt;Somasegar's blog&lt;/a&gt;.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8852857" width="1" height="1"&gt;</content><author><name>Patrick Danino</name><uri>http://blogs.msdn.com/members/Patrick+Danino.aspx</uri></author><category term="WPF" scheme="http://blogs.msdn.com/patrickdanino/archive/tags/WPF/default.aspx" /><category term="Client" scheme="http://blogs.msdn.com/patrickdanino/archive/tags/Client/default.aspx" /></entry><entry><title>WPF Debugging in VS</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/patrickdanino/archive/2008/08/06/wpf-debugging-in-vs.aspx" /><id>http://blogs.msdn.com/patrickdanino/archive/2008/08/06/wpf-debugging-in-vs.aspx</id><published>2008-08-06T22:33:26Z</published><updated>2008-08-06T22:33:26Z</updated><content type="html">&lt;p&gt;If you ever debug WPF elements or use the QuickWatch feature in VS, I suggest you try out &lt;a href="http://www.codeproject.com/KB/macros/MoleForVisualStudioEdit/MoleVisualizer_4_2_VS2008_Release.zip"&gt;Mole&lt;/a&gt;. It&amp;#8217;s a visualizer similar to Snoop, allowing you to view the visual/logical trees, as well as an extended set of properties, directly from VS.&lt;/p&gt;  &lt;p&gt;I was particularly impressed by the number of cool features, such as being able to add &amp;#8220;favorite&amp;#8221; properties to debug (always annoying in VS to have to scroll) or being able to dynamically view a collection&amp;#8217;s items in a data grid. You can also get a visual representation of the element you're debugging, as well as its Xaml. It is also reported to work with XBAPs, although I haven&amp;#8217;t tried that.&lt;/p&gt;  &lt;p&gt;&lt;font color="#ff8000"&gt;Install:&lt;/font&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;For X64: Copy the assembly to %ProgramFiles(x86)%\Microsoft Visual Studio 9.0\Common7\Packages\Debugger\Visualizers&lt;/li&gt;    &lt;li&gt;For X86: Copy the assembly to %ProgramFiles%\Microsoft Visual Studio 9.0\Common7\Packages\Debugger\Visualizers&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;font color="#ff8000"&gt;Usage:&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;After setting a breakpoint near a WPF element, you should be able to highlight the object and click on the magnifying lens icon. To make this easier, you can temporarily add a PreviewMouseLeftButtonDown event to your top-most window and Ctrl-Click an item.&lt;/p&gt;  &lt;p&gt;You can find videos and more documentation &lt;a href="http://www.codeproject.com/KB/macros/MoleForVisualStudioEdit.aspx"&gt;here&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;&lt;font color="#ff8000"&gt;Screenshot:&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/patrickdanino/WindowsLiveWriter/WPFDebugginginVS_B08D/Mole_2.jpg"&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="339" alt="Mole" src="http://blogs.msdn.com/blogfiles/patrickdanino/WindowsLiveWriter/WPFDebugginginVS_B08D/Mole_thumb.jpg" width="525" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8838670" width="1" height="1"&gt;</content><author><name>Patrick Danino</name><uri>http://blogs.msdn.com/members/Patrick+Danino.aspx</uri></author><category term="WPF" scheme="http://blogs.msdn.com/patrickdanino/archive/tags/WPF/default.aspx" /><category term="Winforms" scheme="http://blogs.msdn.com/patrickdanino/archive/tags/Winforms/default.aspx" /></entry><entry><title>Commands</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/patrickdanino/archive/2008/08/05/commands.aspx" /><id>http://blogs.msdn.com/patrickdanino/archive/2008/08/05/commands.aspx</id><published>2008-08-05T23:08:51Z</published><updated>2008-08-05T23:08:51Z</updated><content type="html">&lt;p&gt;If you are trying to write an application in WPF that separates the UI from the underlying business logic (otherwise known as Model-View patterns), you may have noticed that some of the features in WPF don't always make that easy.&lt;/p&gt;  &lt;p&gt;Commands are an example of this. Although defining and using a command in Xaml is fairly straightforward, you are currently pushed to declare the handlers that do the work in the code-behind, going against the mantra of separation, and making harder to get some of the benefits of encapsulation.&lt;/p&gt;  &lt;p&gt;There's a few options you might consider:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;font color="#ff8000"&gt;Command Binding in Xaml, Handlers in code-behind:&lt;/font&gt; By implement the business logic somewhere else than your view, you can always re-direct to it in the code-behind methods. (Simplest)&lt;/li&gt;    &lt;li&gt;&lt;font color="#ff8000"&gt;Command Binding in Code-Behind:&lt;/font&gt; Creating the binding through code allows you to avoid having to implement handlers in code-behind. An example of how to do that can be found on &lt;a href="http://blogs.conchango.com/richardgriffin/archive/2007/02/23/WPF-Commands-a-scenic-tour-part-I.aspx"&gt;Richard Griffin's blog&lt;/a&gt;. (Less Declarative)&lt;/li&gt;    &lt;li&gt;&lt;font color="#ff8000"&gt;Command Binding in Xaml using Attached Properties:&lt;/font&gt; The idea is to use an attached property in Xaml to create the command binding. I'll give credit to &lt;a href="http://blogs.msdn.com/dancre/"&gt;Dan Crevier&lt;/a&gt; for coming up with the idea, which you can read in more detail &lt;a href="http://blogs.msdn.com/dancre/archive/2006/09/15/dm-v-vm-part-7-encapsulating-commands.aspx"&gt;here&lt;/a&gt;. (Harder)&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt; Another option I didn't list above is using the &lt;a href="http://www.codeplex.com/CompositeWPF"&gt;WPF Composite Application Library&lt;/a&gt; (CAL), which has support for &lt;a href="http://msdn.microsoft.com/en-us/library/cc707894.aspx"&gt;Delegate Commands&lt;/a&gt;. It's somewhat more heavy-weight, primarily geared towards enterprise application development, so I'll likely create a separate post on the topic.&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8834834" width="1" height="1"&gt;</content><author><name>Patrick Danino</name><uri>http://blogs.msdn.com/members/Patrick+Danino.aspx</uri></author><category term="WPF" scheme="http://blogs.msdn.com/patrickdanino/archive/tags/WPF/default.aspx" /><category term="Client" scheme="http://blogs.msdn.com/patrickdanino/archive/tags/Client/default.aspx" /></entry><entry><title>User Settings in WPF</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/patrickdanino/archive/2008/07/23/user-settings-in-wpf.aspx" /><id>http://blogs.msdn.com/patrickdanino/archive/2008/07/23/user-settings-in-wpf.aspx</id><published>2008-07-24T01:57:54Z</published><updated>2008-07-24T01:57:54Z</updated><content type="html">&lt;p&gt;It's been a while since my last post, so I figured I'd write something I just recently had to work on: user settings.&lt;/p&gt; &lt;p&gt;In many client applications, you quickly run into the need to store application or user settings. There are a few options on how to do that, some of which are more complex than others, and I'll provide links at the end on a other options I found. In this post, I'll describe one of the simpler solutions, which takes advantage of existing functionality in Visual Studio, makes use of data-binding in Xaml, and also allows you to retrieve or set settings through code.&lt;/p&gt; &lt;p&gt;Visual Studio has design-time support for application and user settings, described quite well in the &lt;a href="http://msdn.microsoft.com/en-us/library/k4s6c3a0.aspx"&gt;MSDN documentation&lt;/a&gt;. The VS designer creates as &lt;font color="#ff8000"&gt;Settings&lt;/font&gt; class and automatically generates properties based on the setting names. Moreover, the settings will work in a ClickOnce application. As for the limitations mentioned in the article, I would add that design-time implies you need to know the user settings ahead of time. Not usually a big problem, but it can be for more complex scenarios. For example, if your application supports plug-ins that have custom settings, you wouldn't necessarily know this ahead of time.&lt;/p&gt; &lt;p&gt;Assuming you’ve already created settings for your application, how could you go about making use of them in a WPF application? In order to access the properties in Xaml, you could add an entry in the application's resource dictionary:&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;&amp;lt;Application x:Class="SampleApp.App"&lt;br&gt;&amp;nbsp;&amp;nbsp; xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"&lt;br&gt;&amp;nbsp;&amp;nbsp; xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"&lt;br&gt;&amp;nbsp;&amp;nbsp; xmlns:properties="clr-namespace:SampleApp.Properties"&lt;br&gt;&amp;nbsp;&amp;nbsp; Exit="OnExit"&lt;br&gt;&amp;nbsp;&amp;nbsp; StartupUri="MainWindow.xaml"&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Application.Resources&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;properties:Settings x:Key="Settings" /&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/Application.Resources&amp;gt;&lt;br&gt;&amp;lt;/Application&amp;gt;&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;If you had added a setting named &lt;font color="#ff8000"&gt;Username&lt;/font&gt; as a string type, you could bind a TextBox in Xaml this way: &lt;blockquote&gt; &lt;p&gt;&amp;lt;TextBox Text="{Binding Source={StaticResource Settings}, Path=Default.Username}" /&amp;gt;&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;As you enter text in the TextBox, the two-way binding automatically updates the &lt;font color="#ff8000"&gt;Username&lt;/font&gt; setting, and similarly at startup, the TextBox will be populated with the most recently saved &lt;font color="#ff8000"&gt;Username&lt;/font&gt; value. &lt;p&gt;Finally, in order to ensure your settings are properly saved, you could implement the OnExit handler declared above, or alternatively you could put the settings in a dedicated window and save at the appropriate time. &lt;blockquote&gt; &lt;p&gt;private void OnExit(object sender, ExitEventArgs e)&lt;br&gt;{&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Properties.Settings.Default.Save();&lt;/p&gt; &lt;p&gt;}&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;To access the current property value through code:&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;Properties.Settings.Default[“Username”]&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;Now, for the additional links I promised. &lt;a href="http://www.codeproject.com/KB/dotnet/user_settings.aspx"&gt;This article&lt;/a&gt; offers a more complex and complete solution. Although it’s relatively heavy-weight, it adds support for specific WPF controls, such as saving column positions in a ListView.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8767948" width="1" height="1"&gt;</content><author><name>Patrick Danino</name><uri>http://blogs.msdn.com/members/Patrick+Danino.aspx</uri></author><category term="Data Binding" scheme="http://blogs.msdn.com/patrickdanino/archive/tags/Data+Binding/default.aspx" /><category term="WPF" scheme="http://blogs.msdn.com/patrickdanino/archive/tags/WPF/default.aspx" /><category term="Client" scheme="http://blogs.msdn.com/patrickdanino/archive/tags/Client/default.aspx" /></entry></feed>