<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>App Development</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/patrickdanino/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/patrickdanino/feed.xml</link>
    <description>Experiences using client technologies to develop quality applications</description>
    <lastBuildDate>Wed, 17 Apr 2019 04:07:03 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Introduction to MVVM Hands-on-lab</title>
      <link>https://docs.microsoft.com/archive/blogs/patrickdanino/introduction-to-mvvm-hands-on-lab</link>
      <pubDate>Wed, 24 Aug 2011 16:03:00 GMT</pubDate>
      <dc:creator><![CDATA[Patrick Danino [Microsoft]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/patrickdanino/2011/08/24/introduction-to-mvvm-hands-on-lab/</guid>
      <description><![CDATA[I am happy to announce the release of an "Introduction to MVVM" hands-on-lab, in the form of a...]]></description>
      <content:encoded><![CDATA[<p>I am happy to announce the release of an "Introduction to MVVM" hands-on-lab, in the form of a Visual Studio 2010 extension. You can download it from the Visual Studio Gallery <a href="http://visualstudiogallery.msdn.microsoft.com/af12ce3b-8337-4bbb-853f-9fdad7105ec8" title="here" target="_blank">here</a>. I will be posting additional information (as time permits) on this dedicated <a href="http://blogs.msdn.com/b/patrickdanino/p/mvvm.aspx" title="MVVM" target="_blank">MVVM</a> page.</p>
<p>The hands-on-lab is intended to be an introduction to the Model-View-ViewModel (MVVM) pattern. It integrates directly inside Visual Studio, with documentation, examples and even automatic code snippet copying, all in one place. The hands-on-lab walks through the pattern step-by-step using examples that are easy to understand, and illustrates the benefits of MVVM in a concrete way.</p>
<p>As was the case with the VS2008 MVVM Toolkit, it is not intended to replace community libraries. I hope you find it useful!</p>]]></content:encoded>
    </item>
    <item>
      <title>Model-View-ViewModel Toolkit - What happened?</title>
      <link>https://docs.microsoft.com/archive/blogs/patrickdanino/model-view-viewmodel-toolkit-what-happened</link>
      <pubDate>Tue, 18 Jan 2011 04:59:00 GMT</pubDate>
      <dc:creator><![CDATA[Patrick Danino [Microsoft]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/patrickdanino/2011/01/18/model-view-viewmodel-toolkit-what-happened/</guid>
      <description><![CDATA[Originally released in 2009, the MVVM Toolkit was intended to be an introduction to the MVVM...]]></description>
      <content:encoded><![CDATA[<p>Originally released in 2009, the <a title="MVVM Toolkit" href="http://wpf.codeplex.com/wikipage?title=WPF%20Model-View-ViewModel%20Toolkit&amp;referringTitle=Home" target="_blank">MVVM Toolkit </a>was intended to be an introduction to the MVVM Pattern. Although a number of people within the WPF team contributed, including John Gossman, the development was primarily done by Ivo Manolov and myself. This blog post, which is probably overdue, is intended to clarify my point of view on the project (note: not the official WPF/Microsoft point of view).</p>
<p>At the time we started working on the toolkit, there were a multitude of MVVM libraries in development, but few had documentation or samples, and even less were targetting people who had never tried MVVM before. We felt the ramp up needed to try MVVM and get the basics of the pattern with these libraries were such that it hindered adoption. At the same time, as a member of the WPF team, it was difficult to justify spending too much time writing libraries and templates, given we had more than enough work on the platform itself.</p>
<p>For that reason, we decided to invest some limited resources in developing a toolkit for VS2008, in the hope that it would justify changing the default WPF template in Visual Studio, given VS2010 was still in development. The positive outcome is that the toolkit was more successful than we had hoped, but the templates unfortunately didn't make the cut for VS2010. &nbsp;I moved shortly afterwards to a different role and team; in fact, I also physically moved to a different country and a different continent.</p>
<p>I also wanted to say thanks to the numerous people who took the time to provide feedback.&nbsp;Although I realize it was far from perfect, I hope many found the VS2008 MVVM toolkit useful!</p>]]></content:encoded>
    </item>
    <item>
      <title>Mix 2010 - Silverlight - Windows Phone 7 - Expression Blend - VS 2010</title>
      <link>https://docs.microsoft.com/archive/blogs/patrickdanino/mix-2010-silverlight-windows-phone-7-expression-blend-vs-2010</link>
      <pubDate>Mon, 15 Mar 2010 11:50:00 GMT</pubDate>
      <dc:creator><![CDATA[Patrick Danino [Microsoft]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/patrickdanino/2010/03/15/mix-2010-silverlight-windows-phone-7-expression-blend-vs-2010/</guid>
      <description><![CDATA[Mix 2010 kicked off on a strong note today, as ScottGu made a number of announcements in his...]]></description>
      <content:encoded><![CDATA[<P>Mix 2010 kicked off on a strong note today, as ScottGu made a number of announcements in his keynote. More details will likely emerge as the Mix 2010 conference progresses, but some of the highlights so far include:</P>
<UL>
<LI>Silverlight 4.0 RC available <A href="http://silverlight.net/getstarted/silverlight-4/" target=_blank mce_href="http://silverlight.net/getstarted/silverlight-4/">here</A>.</LI>
<LI>Windows Phone platform tools available <A href="http://developer.windowsphone.com/windows-phone-7-series/" target=_blank mce_href="http://developer.windowsphone.com/windows-phone-7-series/">here</A>.</LI>
<UL>
<LI>VS 2010 Express</LI>
<LI>Windows Phone Emulator</LI>
<LI>Silverlight for Windows Phone</LI>
<LI>XNA 4.0 Game Studio</LI></UL>
<LI>Expression Blend 4.0 Beta, available <A href="http://go.microsoft.com/fwlink/?LinkId=169446" target=_blank mce_href="http://go.microsoft.com/fwlink/?LinkId=169446">here</A>.</LI>
<UL>
<LI>Windows Phone add-in for Expression Blend 4.0 Beta available <A href="http://www.microsoft.com/downloads/details.aspx?FamilyID=47f5c718-9dec-4557-9687-619c0fdd3d4f" target=_blank mce_href="http://www.microsoft.com/downloads/details.aspx?FamilyID=47f5c718-9dec-4557-9687-619c0fdd3d4f">here</A>.</LI>
<LI>Expression Blend SDK for Windows Phone available <A href="http://www.microsoft.com/downloads/details.aspx?FamilyID=86370108-4c14-42ee-8855-226e5dd9b85b" target=_blank mce_href="http://www.microsoft.com/downloads/details.aspx?FamilyID=86370108-4c14-42ee-8855-226e5dd9b85b">here</A>.</LI></UL></UL>
<P>There were a number of other announcements made already, including the Pivot control for Silverlight 4.0, which lets you slice and visualize large amounts of data in a seamless and intuitive way. Very impressive, and I'm looking forward to seeing the samples and applications developers will be creating!</P>]]></content:encoded>
    </item>
    <item>
      <title>WPF Toolkit Released</title>
      <link>https://docs.microsoft.com/archive/blogs/patrickdanino/wpf-toolkit-released</link>
      <pubDate>Mon, 22 Feb 2010 15:38:15 GMT</pubDate>
      <dc:creator><![CDATA[Patrick Danino [Microsoft]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/patrickdanino/2010/02/22/wpf-toolkit-released/</guid>
      <description><![CDATA[It has been a while since my last post! I’ve been spending time working on the WPF Toolkit, helping...]]></description>
      <content:encoded><![CDATA[<p>It has been a while since my last post! I’ve been spending time working on the WPF Toolkit, helping port some of the controls over from SL to WPF. With the help of the SL toolkit team as well as the WPF toolkit team, three of the controls were ported and are now part of the latest WPF toolkit release, which you can find <a href="http://wpf.codeplex.com/releases/view/40535">here</a>.</p>  <p>The three controls in question are:</p>  <ul>   <li><font color="#ff8000"><strong><a href="http://www.sitechno.com/Blog/AccordionPart1.aspx">Accordion</a></strong></font></li>    <li><font color="#ff8000"><strong><a href="http://www.jeff.wilcox.name/2008/10/introducing-autocompletebox/">AutoCompleteBox</a></strong></font></li>    <li><font color="#ff8000"><strong><a href="http://themechanicalbride.blogspot.com/2009/07/introducing-rating-control.html">Rating</a></strong></font></li> </ul>  <p>The controls are nearly identical to their SL counterparts, with an explicit goal of maintaining compatibility between the two. This will hopefully make it easier to take a dependency on either toolkit, and allow the application to be ported from SL to WPF, or WPF to SL, without having to come up with creative solutions.</p>  <p>Many thanks to David Anson, who wrote a great <a href="http://blogs.msdn.com/delay/archive/2010/02/22/this-is-what-happens-when-two-toolkits-fall-in-love-the-february-2010-release-of-the-wpf-toolkit-is-now-available.aspx">blog post</a> on the new release, for his continued support and help, as well as both the SL and WPF toolkit teams. We hope you find the newly added controls useful, and always appreciate the feedback!</p>]]></content:encoded>
    </item>
    <item>
      <title>Apps and the PDC</title>
      <link>https://docs.microsoft.com/archive/blogs/patrickdanino/apps-and-the-pdc</link>
      <pubDate>Fri, 20 Nov 2009 10:22:00 GMT</pubDate>
      <dc:creator><![CDATA[Patrick Danino [Microsoft]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/patrickdanino/2009/11/20/apps-and-the-pdc/</guid>
      <description><![CDATA[There has been quite a bit of activity surrounding the PDC event that ended today. I wanted to call...]]></description>
      <content:encoded><![CDATA[<p>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 <a href="http://www.silverlight.net/getstarted/silverlight-4-beta/" target="_blank" mce_href="http://www.silverlight.net/getstarted/silverlight-4-beta/">Silverlight 4.0 is right around the corner</a> is great news, but I'm sure there's a number of other people and blogs have that one covered :)</p>  <p>First, a new <a href="http://msdn.microsoft.com/en-us/windows/ee388574.aspx" target="_blank" mce_href="http://msdn.microsoft.com/en-us/windows/ee388574.aspx">Facebook SDK</a> 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!</p>  <p>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 <a href="http://www.fishbowlclient.com/" target="_blank" mce_href="http://www.fishbowlclient.com">here</a> and read more about it <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">here</a>. There unfortunately isn't a Silverlight version available, but that may very well change!</p>  <p>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 <a href="http://www.getpivot.com/" target="_blank" mce_href="http://www.getpivot.com">its website</a> if you want to learn more. For the time being, here's a video that demonstrates some of the things you can do:</p>  <p><object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="509" height="382" id="video-player">
 <param name="source" value="http://www.getpivot.com/silverlight/video-player.xap" />
 <param name="onError" value="onSilverlightError" />
 <param name="background" value="white" />
 <param name="minRuntimeVersion" value="3.0.40624.0" /> 
<param name="autoUpgrade" value="true" />
 <param name="enableHtmlAccess" value="true" />
 <param name="enableGPUAcceleration" value="true" />
 <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 = &lt;Playlist&gt;&lt;AutoLoad&gt;false&lt;/AutoLoad&gt;&lt;AutoPlay&gt;false&lt;/AutoPlay&gt;&lt;DisplayTimeCode&gt;false&lt;/DisplayTimeCode&gt;&lt;EnableCachedComposition&gt;false&lt;/EnableCachedComposition&gt;&lt;EnableCaptions&gt;false&lt;/EnableCaptions&gt;&lt;EnableOffline&gt;false&lt;/EnableOffline&gt;&lt;EnablePopOut&gt;false&lt;/EnablePopOut&gt;&lt;StartMuted&gt;false&lt;/StartMuted&gt;&lt;StretchMode&gt;0&lt;/StretchMode&gt;&lt;Items&gt;&lt;PlaylistItem&gt;&lt;IsAdaptiveStreaming&gt;false&lt;/IsAdaptiveStreaming&gt;&lt;MediaSource&gt;http://content.getpivot.com/wmv/1002290_LiveLabs_111109_v03_512x384_600kbps_VBR.wmv&lt;/MediaSource&gt;&lt;ThumbSource&gt;http://www.getpivot.com/silverlight/images/videos/hero-02-pivot-screenshot-play-btn.jpg&lt;/ThumbSource&gt;&lt;Description&gt;Clicking this takes you to video 2&lt;/Description&gt;&lt;/PlaylistItem&gt;&lt;/Items&gt;&lt;/Playlist&gt;" />
 <a href="http://go.microsoft.com/fwlink/?LinkID=149156&amp;v=3.0.40624.0" style="text-decoration:none">
 <img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style:none" />
 </a>
 </object></p>]]></content:encoded>
    </item>
    <item>
      <title>Custom Controls and UI Automation</title>
      <link>https://docs.microsoft.com/archive/blogs/patrickdanino/custom-controls-and-ui-automation</link>
      <pubDate>Wed, 11 Nov 2009 14:16:00 GMT</pubDate>
      <dc:creator><![CDATA[Patrick Danino [Microsoft]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/patrickdanino/2009/11/11/custom-controls-and-ui-automation/</guid>
      <description><![CDATA[We came across an interesting problem a customer hit when trying to write a custom control. The...]]></description>
      <content:encoded><![CDATA[<P>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.</P>
<P>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&nbsp;“just work”, that’s not always the case.</P>
<P>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:</P>
<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><PRE style="BACKGROUND-COLOR: white; OVERFLOW: auto"><SPAN style="COLOR: #000000">   </SPAN><SPAN style="COLOR: #0000ff">&lt;</SPAN><SPAN style="COLOR: #800000">local:CustomTabControl </SPAN><SPAN style="COLOR: #ff0000">Style</SPAN><SPAN style="COLOR: #0000ff">="</SPAN><SPAN style="COLOR: #808000">{StaticResource TabControlStyle}</SPAN><SPAN style="COLOR: #0000ff">"</SPAN><SPAN style="COLOR: #0000ff">&gt;</SPAN><SPAN style="COLOR: #000000">
      </SPAN><SPAN style="COLOR: #0000ff">&lt;</SPAN><SPAN style="COLOR: #800000">local:CustomTabControl.Header</SPAN><SPAN style="COLOR: #0000ff">&gt;</SPAN><SPAN style="COLOR: #000000">
         </SPAN><SPAN style="COLOR: #008000">&lt;!--</SPAN><SPAN style="COLOR: #008000"> Any content can go here </SPAN><SPAN style="COLOR: #008000">--&gt;</SPAN><SPAN style="COLOR: #000000">
         </SPAN><SPAN style="COLOR: #0000ff">&lt;</SPAN><SPAN style="COLOR: #800000">Button </SPAN><SPAN style="COLOR: #ff0000">Content</SPAN><SPAN style="COLOR: #0000ff">="Header Button"</SPAN><SPAN style="COLOR: #ff0000"> </SPAN><SPAN style="COLOR: #0000ff">/&gt;</SPAN><SPAN style="COLOR: #000000">
      </SPAN><SPAN style="COLOR: #0000ff">&lt;/</SPAN><SPAN style="COLOR: #800000">local:CustomTabControl.Header</SPAN><SPAN style="COLOR: #0000ff">&gt;</SPAN><SPAN style="COLOR: #000000">
      </SPAN><SPAN style="COLOR: #0000ff">&lt;</SPAN><SPAN style="COLOR: #800000">local:CustomTabControl.Items</SPAN><SPAN style="COLOR: #0000ff">&gt;</SPAN><SPAN style="COLOR: #000000">
         </SPAN><SPAN style="COLOR: #0000ff">&lt;</SPAN><SPAN style="COLOR: #800000">TabItem </SPAN><SPAN style="COLOR: #ff0000">Header</SPAN><SPAN style="COLOR: #0000ff">="Tab 1"</SPAN><SPAN style="COLOR: #ff0000"> </SPAN><SPAN style="COLOR: #0000ff">/&gt;</SPAN><SPAN style="COLOR: #000000">
         </SPAN><SPAN style="COLOR: #0000ff">&lt;</SPAN><SPAN style="COLOR: #800000">TabItem </SPAN><SPAN style="COLOR: #ff0000">Header</SPAN><SPAN style="COLOR: #0000ff">="Tab 2"</SPAN><SPAN style="COLOR: #ff0000"> </SPAN><SPAN style="COLOR: #0000ff">/&gt;</SPAN><SPAN style="COLOR: #000000">
      </SPAN><SPAN style="COLOR: #0000ff">&lt;/</SPAN><SPAN style="COLOR: #800000">local:CustomTabControl.Items</SPAN><SPAN style="COLOR: #0000ff">&gt;</SPAN><SPAN style="COLOR: #000000">
   </SPAN><SPAN style="COLOR: #0000ff">&lt;/</SPAN><SPAN style="COLOR: #800000">local:CustomTabControl</SPAN><SPAN style="COLOR: #0000ff">&gt;</SPAN></PRE><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --></DIV>
<P>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.</P>
<P>This is done through the <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"><STRONG>AutomationPeer</STRONG></A> class. All the major control classes in WPF, such as <STRONG>TabControl</STRONG>, have a corresponding <STRONG>AutomationPeer</STRONG> class that exposes the control’s functionality to UIA, creatively named <STRONG>TabControlAutomationPeer</STRONG> in this case. This is explained in some detail in <A href="http://msdn.microsoft.com/en-us/library/cc165614.aspx" mce_href="http://msdn.microsoft.com/en-us/library/cc165614.aspx">this MSDN page</A>.</P>
<P>When a UIA client looks at the structure of the application, WPF will raise the <STRONG>OnCreateAutomationPeer</STRONG> event on elements in the WPF application tree. In the case of a regular <STRONG>TabControl</STRONG>, when the event is raised, a <STRONG>TabControlAutomationPeer</STRONG> 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 <STRONG>TabControlAutomationPeer </STRONG>doesn’t know about the newly added Header property in <STRONG>CustomTabControl</STRONG>, it doesn’t expose it to UIA.</P>
<P>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:</P>
<P mce_keep="true">&nbsp;</P>
<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><PRE style="BACKGROUND-COLOR: #ffffff; OVERFLOW: auto"><SPAN style="COLOR: #000000">   </SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">class</SPAN><SPAN style="COLOR: #000000"> CustomTabControlAutomationPeer : TabControlAutomationPeer
   {
      </SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000"> CustomTabControlAutomationPeer(TabControl owner)
         : </SPAN><SPAN style="COLOR: #0000ff">base</SPAN><SPAN style="COLOR: #000000">(owner)
      {
      }
      
      </SPAN><SPAN style="COLOR: #0000ff">protected</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">override</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">string</SPAN><SPAN style="COLOR: #000000"> GetClassNameCore()
      {
         </SPAN><SPAN style="COLOR: #0000ff">return</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #800000">"</SPAN><SPAN style="COLOR: #800000">CustomTabControl</SPAN><SPAN style="COLOR: #800000">"</SPAN><SPAN style="COLOR: #000000">;
      }
      
      </SPAN><SPAN style="COLOR: #0000ff">protected</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">override</SPAN><SPAN style="COLOR: #000000"> List</SPAN><SPAN style="COLOR: #000000">&lt;</SPAN><SPAN style="COLOR: #000000">AutomationPeer</SPAN><SPAN style="COLOR: #000000">&gt;</SPAN><SPAN style="COLOR: #000000"> GetChildrenCore()
      {
         List</SPAN><SPAN style="COLOR: #000000">&lt;</SPAN><SPAN style="COLOR: #000000">AutomationPeer</SPAN><SPAN style="COLOR: #000000">&gt;</SPAN><SPAN style="COLOR: #000000"> automationPeers </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">base</SPAN><SPAN style="COLOR: #000000">.GetChildrenCore();
         CustomTabControl owner </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">base</SPAN><SPAN style="COLOR: #000000">.Owner </SPAN><SPAN style="COLOR: #0000ff">as</SPAN><SPAN style="COLOR: #000000"> CustomTabControl;
         </SPAN><SPAN style="COLOR: #0000ff">if</SPAN><SPAN style="COLOR: #000000"> (owner </SPAN><SPAN style="COLOR: #000000">!=</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">null</SPAN><SPAN style="COLOR: #000000">)
         {
            UIElement headerUIElement </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> owner.Header </SPAN><SPAN style="COLOR: #0000ff">as</SPAN><SPAN style="COLOR: #000000"> UIElement;
            </SPAN><SPAN style="COLOR: #0000ff">if</SPAN><SPAN style="COLOR: #000000"> (headerUIElement </SPAN><SPAN style="COLOR: #000000">!=</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">null</SPAN><SPAN style="COLOR: #000000">)
            {
               AutomationPeer peer </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> UIElementAutomationPeer.CreatePeerForElement(headerUIElement);
               </SPAN><SPAN style="COLOR: #0000ff">if</SPAN><SPAN style="COLOR: #000000"> (peer </SPAN><SPAN style="COLOR: #000000">!=</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">null</SPAN><SPAN style="COLOR: #000000">)
               {
                  automationPeers.Add(peer);
               }
            }
         }
      
         </SPAN><SPAN style="COLOR: #0000ff">return</SPAN><SPAN style="COLOR: #000000"> automationPeers;
      }
   }</SPAN></PRE><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --></DIV>The CustomTabControl now needs to create an instance of the new CustomTabControlAutomationPeer: 
<P mce_keep="true">&nbsp;</P>
<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><PRE style="BACKGROUND-COLOR: #ffffff; OVERFLOW: auto"><SPAN style="COLOR: #000000">   </SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">class</SPAN><SPAN style="COLOR: #000000"> CustomTabControl : TabControl
   {
      ...
      </SPAN><SPAN style="COLOR: #0000ff">protected</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">override</SPAN><SPAN style="COLOR: #000000"> AutomationPeer OnCreateAutomationPeer()
      {
         </SPAN><SPAN style="COLOR: #0000ff">return</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">new</SPAN><SPAN style="COLOR: #000000"> CustomTabControlAutomationPeer(</SPAN><SPAN style="COLOR: #0000ff">this</SPAN><SPAN style="COLOR: #000000">);
      }
   }</SPAN></PRE><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --></DIV>
<P>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:</P>
<P><IMG src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Components.PostAttachments/00/09/92/10/38/CustomTabControl-Before.jpg" original-url="http://blogs.msdn.com/photos/patrick_danino/images/9921038/500x201.aspx" mce_src="http://blogs.msdn.com/photos/patrick_danino/images/9921038/500x201.aspx"></P>
<P>This is what you can see after the change, with the Header button properly exposed:</P>
<P mce_keep="true"><IMG src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Components.PostAttachments/00/09/92/10/39/CustomTabControl-After.jpg" original-url="http://blogs.msdn.com/photos/patrick_danino/images/9921039/500x199.aspx" mce_src="http://blogs.msdn.com/photos/patrick_danino/images/9921039/500x199.aspx"></P>
<P>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.</P>
<P>To solve this, you need to find a way to notify UIA of the change. Luckily, WPF makes this fairly straightforward when using a <A href="http://msdn.microsoft.com/en-us/library/ms752914.aspx" mce_href="http://msdn.microsoft.com/en-us/library/ms752914.aspx">DependencyProperty</A>, 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:</P>
<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><PRE style="BACKGROUND-COLOR: #ffffff; OVERFLOW: auto"><SPAN style="COLOR: #000000">   </SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">class</SPAN><SPAN style="COLOR: #000000"> CustomTabControl : TabControl
   {
      ...
      </SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">static</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">readonly</SPAN><SPAN style="COLOR: #000000"> DependencyProperty HeaderProperty </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> DependencyProperty.Register(</SPAN><SPAN style="COLOR: #800000">"</SPAN><SPAN style="COLOR: #800000">Header</SPAN><SPAN style="COLOR: #800000">"</SPAN><SPAN style="COLOR: #000000">, </SPAN><SPAN style="COLOR: #0000ff">typeof</SPAN><SPAN style="COLOR: #000000">(</SPAN><SPAN style="COLOR: #0000ff">object</SPAN><SPAN style="COLOR: #000000">), </SPAN><SPAN style="COLOR: #0000ff">typeof</SPAN><SPAN style="COLOR: #000000">(CustomTabControl),
         </SPAN><SPAN style="COLOR: #0000ff">new</SPAN><SPAN style="COLOR: #000000"> FrameworkPropertyMetadata(OnPropertyChanged));
      </SPAN><SPAN style="COLOR: #0000ff">private</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">static</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">void</SPAN><SPAN style="COLOR: #000000"> OnPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
      {
         CustomTabControl tabControl </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> d </SPAN><SPAN style="COLOR: #0000ff">as</SPAN><SPAN style="COLOR: #000000"> CustomTabControl;
         </SPAN><SPAN style="COLOR: #0000ff">if</SPAN><SPAN style="COLOR: #000000"> (tabControl </SPAN><SPAN style="COLOR: #000000">!=</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">null</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">&amp;&amp;</SPAN><SPAN style="COLOR: #000000"> (e.OldValue </SPAN><SPAN style="COLOR: #000000">!=</SPAN><SPAN style="COLOR: #000000"> e.NewValue))
         {
            </SPAN><SPAN style="COLOR: #0000ff">if</SPAN><SPAN style="COLOR: #000000"> (AutomationPeer.ListenerExists(AutomationEvents.StructureChanged))
            {
               </SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000"> Notify the UI automation client that the content changed</SPAN><SPAN style="COLOR: #008000">
</SPAN><SPAN style="COLOR: #000000">               TabControlAutomationPeer peer </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> UIElementAutomationPeer.FromElement(tabControl) </SPAN><SPAN style="COLOR: #0000ff">as</SPAN><SPAN style="COLOR: #000000"> TabControlAutomationPeer;
               </SPAN><SPAN style="COLOR: #0000ff">if</SPAN><SPAN style="COLOR: #000000"> (peer </SPAN><SPAN style="COLOR: #000000">!=</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">null</SPAN><SPAN style="COLOR: #000000">)
               {
                  peer.RaiseAutomationEvent(AutomationEvents.StructureChanged);
               }
            }
         }
      }
   }</SPAN></PRE><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --></DIV>
<P>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!</P>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Components.PostAttachments/00/09/92/10/91/CustomTabControlSample.zip" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-components-postattachments/00-09-92-10-91/CustomTabControlSample.zip">CustomTabControlSample.zip</a></p>]]></content:encoded>
    </item>
    <item>
      <title>Custom Scrollable Panels</title>
      <link>https://docs.microsoft.com/archive/blogs/patrickdanino/custom-scrollable-panels</link>
      <pubDate>Thu, 01 Oct 2009 15:43:21 GMT</pubDate>
      <dc:creator><![CDATA[Patrick Danino [Microsoft]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/patrickdanino/2009/10/01/custom-scrollable-panels/</guid>
      <description><![CDATA[Thought I’d share an interesting (albeit rather old) series of blog posts on how to write scrollable...]]></description>
      <content:encoded><![CDATA[<p>Thought I’d share an interesting (albeit rather old) series of blog posts on how to write scrollable custom panels.</p>  <p>The set of 4 posts walk through how to write a simple panel that implements part of the <font color="#ff8000">IScrollInfo</font> interface, which is needed to allow the <font color="#ff8000">ScrollViewer</font> control to delegate the responsibility of scrolling.</p>  <p><a href="http://blogs.msdn.com/bencon/archive/2006/01/05/509991.aspx">Part 1</a>, <a href="http://blogs.msdn.com/bencon/archive/2006/01/06/510355.aspx">Part 2</a>, <a href="http://blogs.msdn.com/bencon/archive/2006/01/07/510530.aspx">Part 3</a>, <a href="http://blogs.msdn.com/bencon/archive/2006/12/09/iscrollinfo-tutorial-part-iv.aspx">Part 4</a></p>]]></content:encoded>
    </item>
    <item>
      <title>TestAPI 0.3 Released</title>
      <link>https://docs.microsoft.com/archive/blogs/patrickdanino/testapi-0-3-released</link>
      <pubDate>Thu, 23 Jul 2009 18:56:44 GMT</pubDate>
      <dc:creator><![CDATA[Patrick Danino [Microsoft]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/patrickdanino/2009/07/23/testapi-0-3-released/</guid>
      <description><![CDATA[A new version of the TestAPI library has just been released. The new release contains fault...]]></description>
      <content:encoded><![CDATA[<p>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.</p>  <p>We encourage you to try it out and give us your feedback! You can find the latest release of the TestAPI library <a href="http://testapi.codeplex.com/">here</a>.</p>]]></content:encoded>
    </item>
    <item>
      <title>Model-View-ViewModel Toolkit 0.1 Released!</title>
      <link>https://docs.microsoft.com/archive/blogs/patrickdanino/model-view-viewmodel-toolkit-0-1-released</link>
      <pubDate>Fri, 01 May 2009 18:10:51 GMT</pubDate>
      <dc:creator><![CDATA[Patrick Danino [Microsoft]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/patrickdanino/2009/05/01/model-view-viewmodel-toolkit-0-1-released/</guid>
      <description><![CDATA[It’s been a while since my last update. I’ve been busy working on a new WPF Model-View-ViewModel...]]></description>
      <content:encoded><![CDATA[<p>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 <a href="http://wpf.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=14962">WPF Futures</a> site.</p>  <p>The template is meant to introduce the Model-View-ViewModel (M-V-VM) design pattern to the WPF community. It includes:</p>  <ul>   <li>A Visual Studio 2008 template (Visual C# Express 2008 also supported) </li>    <li>Documentation </li>    <ul>     <li>General introduction to M-V-VM</li>      <li>Walkthrough using the VS template </li>   </ul>    <li>A complete WPF application demonstrating the MVVM pattern</li> </ul>  <p>We hope you find it useful. Feel free to <a href="http://wpf.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=14962#DownloadId=67235">try it out</a> and share your comments/suggestions!</p>]]></content:encoded>
    </item>
    <item>
      <title>Silverlight 3.0 Beta is Released!</title>
      <link>https://docs.microsoft.com/archive/blogs/patrickdanino/silverlight-3-0-beta-is-released</link>
      <pubDate>Thu, 19 Mar 2009 14:31:09 GMT</pubDate>
      <dc:creator><![CDATA[Patrick Danino [Microsoft]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/patrickdanino/2009/03/19/silverlight-3-0-beta-is-released/</guid>
      <description><![CDATA[Silverlight 3.0 Beta was unveiled at Mix09 yesterday, along with a preview of Expression Blend 3.0....]]></description>
      <content:encoded><![CDATA[<p><a href="http://silverlight.net/getstarted/silverlight3/default.aspx">Silverlight 3.0 Beta</a> was unveiled at Mix09 yesterday, along with a preview of <a href="http://www.microsoft.com/expression/try-it/blendpreview.aspx">Expression Blend 3.0</a>. </p>  <p>The list of new features being released in the products is nothing short of impressive. <a href="http://www.webmonkey.com/blog/MIX09%3A_Silverlight_3_Brings_HD__Multitouch__Offline_Apps_to_the_Web">This article</a> 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:</p>  <p>Silverlight:</p>  <ul>   <li>HD Streaming of 720p without buffering </li>    <li>Standalone application support (aka out of browser!) </li>    <li>Hardware acceleration </li>    <li>3D visual features </li>    <li>Multi-touch support </li>    <li><a href="http://eclipse4sl.org/download/mac">Eclipse for Silverlight</a> support on the Mac </li> </ul>  <p>Expression Blend:</p>  <ul>   <li>Sketchflow feature allows for quick prototyping of workflow by defining states and transitions between states </li>    <li>Import files directly from Adobe Illustrator/Photoshop </li>    <li>Export workflow to an automatically generated Word document </li> </ul>  <p>If you’ve been holding off trying out Silverlight, this seems like a great time to take a closer look!</p>]]></content:encoded>
    </item>
  </channel>
</rss>