<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Vincent Sibal's Blog</title><link>http://blogs.msdn.com/b/vinsibal/</link><description>WPF Programming Topics</description><dc:language>en-US</dc:language><generator>Telligent Community 5.6.583.21163 (Build: 5.6.583.21163)</generator><item><title>New and updated test tools for WPF: TestApi v0.3 and WPF Control Verifier</title><link>http://blogs.msdn.com/b/vinsibal/archive/2009/08/04/new-and-updated-test-tools-for-wpf-testapi-v0-3-and-wpf-control-verifier.aspx</link><pubDate>Tue, 04 Aug 2009 15:09:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9857068</guid><dc:creator>Vincent Sibal - MSFT</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/vinsibal/rsscomments.aspx?WeblogPostID=9857068</wfw:commentRss><comments>http://blogs.msdn.com/b/vinsibal/archive/2009/08/04/new-and-updated-test-tools-for-wpf-testapi-v0-3-and-wpf-control-verifier.aspx#comments</comments><description>&lt;P&gt;&lt;STRONG&gt;TestApi v0.3&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;The WPF test team has recently released a new version of TestApi!&amp;nbsp; This version includes libraries for fault injection, combinatorial varitation generation, new application control APIs, and updated tests and documentation.&amp;nbsp; I think all the new libraries are really cool, especially the fault injection libraries.&amp;nbsp; Learn more about it &lt;A href="http://testapi.codeplex.com/" mce_href="http://testapi.codeplex.com/"&gt;here&lt;/A&gt;. &lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;WPF Control Verifier&amp;nbsp;v0.1&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;In addition to TestApi, the test team has also developed a tool to verify the behavior of WPF controls.&amp;nbsp; &lt;A href="http://wpf.codeplex.com/Wiki/View.aspx?title=WPF%20Control%20Verifier" mce_href="http://wpf.codeplex.com/Wiki/View.aspx?title=WPF%20Control%20Verifier"&gt;WPF Control Verifier&lt;/A&gt; is a tool that verifies the correctness of WPF Controls. This tool is geared towards WPF Control developers with the goal of providing a set of verifications that all controls can run and consume. Version 0.1 includes one category for verification – default style verification. These tests verify that your control can be styled such that its dependency properties are inheriting or template binding correctly. Future versions will include additional categories of verification.&amp;nbsp; You can download the tool &lt;A href="http://wpf.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=30923" mce_href="http://wpf.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=30923"&gt;here&lt;/A&gt;.&amp;nbsp; This is our first beta and we will be updating it based on your feedback. We have a planned set of features for future iterations but this will evolve based on your suggestions. Please send your feedback to wpfcvt@microsoft.com.&lt;BR&gt;&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9857068" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/vinsibal/archive/tags/TestApi/">TestApi</category><category domain="http://blogs.msdn.com/b/vinsibal/archive/tags/ControlVerifier/">ControlVerifier</category></item><item><title>The Control Local Values Bug Solution and new WPF 4.0 related APIs</title><link>http://blogs.msdn.com/b/vinsibal/archive/2009/05/21/the-control-local-values-bug-solution-and-new-wpf-4-0-related-apis.aspx</link><pubDate>Thu, 21 May 2009 17:57:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9633846</guid><dc:creator>Vincent Sibal - MSFT</dc:creator><slash:comments>8</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/vinsibal/rsscomments.aspx?WeblogPostID=9633846</wfw:commentRss><comments>http://blogs.msdn.com/b/vinsibal/archive/2009/05/21/the-control-local-values-bug-solution-and-new-wpf-4-0-related-apis.aspx#comments</comments><description>&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Intro 
&lt;P mce_keep="true"&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;FONT size=3 face=Calibri&gt;Previously I did a post on the &lt;/FONT&gt;&lt;A href="http://blogs.msdn.com/vinsibal/archive/2009/03/24/the-control-local-values-bug.aspx" mce_href="http://blogs.msdn.com/vinsibal/archive/2009/03/24/the-control-local-values-bug.aspx"&gt;&lt;FONT size=3 face=Calibri&gt;“Control Local Values bug”&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3 face=Calibri&gt; and how a subtle bug can be introduced when setting dependency properties of controls to local values.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;In WPF 4.0 (dev10), a mechanism was added to the property engine to solve this problem.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Here are the new APIs in dev10:&lt;/FONT&gt;&lt;/P&gt;
&lt;DIV style="BORDER-BOTTOM: #4f6228 1pt dashed; BORDER-LEFT: #4f6228 1pt dashed; PADDING-BOTTOM: 5pt; PADDING-LEFT: 5pt; PADDING-RIGHT: 5pt; BACKGROUND: #f6f5f0; MARGIN-LEFT: 0.1in; BORDER-TOP: #4f6228 1pt dashed; MARGIN-RIGHT: 0in; BORDER-RIGHT: #4f6228 1pt dashed; PADDING-TOP: 5pt; mso-border-alt: dash-small-gap #4f6228 .5pt; mso-border-themecolor: accent3; mso-border-themeshade: 128; mso-element: para-border-div"&gt;
&lt;P style="MARGIN: 12pt 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpFirst&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: blue; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;public&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt; &lt;SPAN style="COLOR: blue"&gt;class&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;DependencyObject &lt;/P&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: blue; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;{&amp;nbsp;&lt;/SPAN&gt; 
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: blue; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: green; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;// Sets the value of a dependency property without changing its value source.&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: blue; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt; &lt;/P&gt;&lt;/SPAN&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: blue; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;public&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt; &lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; SetCurrentValue(&lt;SPAN style="COLOR: #2b91af"&gt;DependencyProperty&lt;/SPAN&gt; dp, &lt;SPAN style="COLOR: blue"&gt;object&lt;/SPAN&gt; value);&lt;SPAN style="COLOR: blue"&gt; &lt;BR&gt;} &lt;/SPAN&gt;&lt;/SPAN&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp;&lt;/P&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: blue; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;&lt;/P&gt;&lt;/SPAN&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: blue; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;public&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt; &lt;SPAN style="COLOR: blue"&gt;struct&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;ValueSource &lt;/SPAN&gt;&lt;/SPAN&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: #2b91af; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;{&amp;nbsp;&lt;/SPAN&gt; 
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: #2b91af; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: blue; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;public&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt; &lt;SPAN style="COLOR: blue"&gt;bool&lt;/SPAN&gt; IsCurrent { &lt;SPAN style="COLOR: blue"&gt;get&lt;/SPAN&gt;; }&lt;SPAN style="COLOR: #2b91af"&gt; &lt;/P&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;
&lt;P style="MARGIN: 0in 0in 12pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpLast&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: #2b91af; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;}&lt;/SPAN&gt;&lt;SPAN style="mso-no-proof: yes"&gt; &lt;/P&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;/FONT&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Basically, when using DependencyObject.SetCurrentValue instead of DependencyObject.SetValue you set its effective value but its ValueSource remains the same.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;This is very similar to coercion.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Sample Test App &lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/B&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;To make it more clear, I wrote a sample test app that shows the BaseValueSource and ValueSource properties when changing a DependencyProperty (DP) via SetCurrentValue. &lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;I created a custom control with a DP, TitleProperty, where I track its values.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;In addition, I setup several scenarios where the TitleProperty is initially set by a particular BaseValueSource.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;I’ll go through one scenario here.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;I setup the custom control where the TitleProperty is set from a Style with a binding.&lt;SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: consolas; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt; &lt;/P&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;
&lt;DIV style="BORDER-BOTTOM: #4f6228 1pt dashed; BORDER-LEFT: #4f6228 1pt dashed; PADDING-BOTTOM: 5pt; PADDING-LEFT: 5pt; PADDING-RIGHT: 5pt; BACKGROUND: #f6f5f0; MARGIN-LEFT: 0.1in; BORDER-TOP: #4f6228 1pt dashed; MARGIN-RIGHT: 0in; BORDER-RIGHT: #4f6228 1pt dashed; PADDING-TOP: 5pt; mso-border-alt: dash-small-gap #4f6228 .5pt; mso-border-themecolor: accent3; mso-border-themeshade: 128; mso-element: para-border-div"&gt;
&lt;P style="MARGIN: 12pt 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpFirst&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: blue; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: #a31515; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;Style&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: red; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt; x&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: blue; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;:&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: red; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;Key&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: blue; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;="StyleBindingCustomControlStyle"&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: red; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt; TargetType&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: blue; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;="{&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: #a31515; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;x&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: blue; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;:&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: #a31515; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;Type&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: red; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt; local&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: blue; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;:&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: red; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;CustomControl&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: blue; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;}"&amp;gt; &lt;/P&gt;&lt;/SPAN&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: blue; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: #a31515; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;Setter&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: red; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt; Property&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: blue; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;="Title"&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: red; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt; &lt;/P&gt;&lt;/SPAN&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: red; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Value&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: blue; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;="{&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: #a31515; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;Binding&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: red; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt; RelativeSource&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: blue; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;={&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: #a31515; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;RelativeSource&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: red; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt; Self&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: blue; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;},&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: red; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt; &lt;/P&gt;&lt;/SPAN&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: red; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;&lt;SPAN style="mso-tab-count: 9"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;Path&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: blue; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;=WorkingTag,&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: red; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt; &lt;/P&gt;&lt;/SPAN&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: red; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;&lt;SPAN style="mso-tab-count: 9"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;StringFormat&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: blue; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;='Set&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: red; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt; via Style w&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;/&lt;SPAN style="COLOR: blue"&gt; Binding: {&lt;/SPAN&gt;0&lt;SPAN style="COLOR: blue"&gt;}'}" /&amp;gt; &lt;/P&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: blue; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: #a31515; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;Setter&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: red; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt; Property&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: blue; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;="Template"&amp;gt; &lt;/P&gt;&lt;/SPAN&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: blue; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: #a31515; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;Setter.Value&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: blue; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;&amp;gt; &lt;/P&gt;&lt;/SPAN&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: blue; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;&lt;SPAN style="mso-tab-count: 5"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: #a31515; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;ControlTemplate&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: red; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt; TargetType&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: blue; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;="{&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: #a31515; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;x&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: blue; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;:&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: #a31515; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;Type&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: red; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt; local&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: blue; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;:&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: red; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;CustomControl&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: blue; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;}"&amp;gt; &lt;/P&gt;&lt;/SPAN&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: blue; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;&lt;SPAN style="mso-tab-count: 7"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: #a31515; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;Button&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: red; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt; Content&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: blue; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;="{&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: #a31515; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;TemplateBinding&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: red; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt; Title&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: blue; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;}"&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: red; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt; &lt;/P&gt;&lt;/SPAN&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: red; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;&lt;SPAN style="mso-tab-count: 8"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;Background&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: blue; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;="{&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: #a31515; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;TemplateBinding&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: red; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt; Background&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: blue; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;}" /&amp;gt; &lt;/P&gt;&lt;/SPAN&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: blue; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;&lt;SPAN style="mso-tab-count: 5"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: #a31515; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;ControlTemplate&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: blue; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;&amp;gt; &lt;/P&gt;&lt;/SPAN&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: blue; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: #a31515; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;Setter.Value&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: blue; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;&amp;gt; &lt;/P&gt;&lt;/SPAN&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: blue; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: #a31515; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;Setter&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: blue; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: #a31515; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt; &lt;/P&gt;&lt;/SPAN&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: blue; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: #a31515; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;Style&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: blue; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;&amp;gt; &lt;/SPAN&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: blue; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;&amp;nbsp;&lt;/P&gt;&lt;/SPAN&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: blue; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;&lt;/P&gt;&lt;/SPAN&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: blue; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: #a31515; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;GroupBox&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: red; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt; Header&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: blue; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;="Style Binding"&amp;gt; &lt;/P&gt;&lt;/SPAN&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: blue; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: #a31515; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;local&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: blue; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;:&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: #a31515; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;CustomControl&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: red; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt; x&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: blue; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;:&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: red; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;Name&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: blue; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;="CustomControl_Style_Binding"&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: red; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt; &lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: red; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;&lt;/P&gt;&lt;/SPAN&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: red; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;&lt;SPAN style="mso-tab-count: 8"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Style&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: blue; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;="{&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: #a31515; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;StaticResource&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: red; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt; StyleBindingCustomControlStyle&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: blue; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;}"/&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: #a31515; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt; &lt;/P&gt;&lt;/SPAN&gt;
&lt;P style="MARGIN: 0in 0in 12pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpLast&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: blue; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: #a31515; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;GroupBox&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: consolas; COLOR: blue; FONT-SIZE: 9.5pt; mso-bidi-font-family: consolas"&gt;&amp;gt; &lt;/P&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;Initially it will look like this:&lt;/FONT&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;SHAPETYPE id=_x0000_t75 stroked="f" filled="f" path="m@4@5l@4@11@9@11@9@5xe" o:preferrelative="t" o:spt="75" coordsize="21600,21600"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt; &lt;/FONT&gt;&lt;/FONT&gt;&lt;/SHAPETYPE&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;SHAPETYPE stroked="f" filled="f" path="m@4@5l@4@11@9@11@9@5xe" o:preferrelative="t" o:spt="75" coordsize="21600,21600"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;STROKE joinstyle="miter"&gt;&lt;/STROKE&gt;&lt;FORMULAS&gt;&lt;F eqn="if lineDrawn pixelLineWidth 0"&gt;&lt;/F&gt;&lt;F eqn="sum @0 1 0"&gt;&lt;/F&gt;&lt;F eqn="sum 0 0 @1"&gt;&lt;/F&gt;&lt;F eqn="prod @2 1 2"&gt;&lt;/F&gt;&lt;F eqn="prod @3 21600 pixelWidth"&gt;&lt;/F&gt;&lt;F eqn="prod @3 21600 pixelHeight"&gt;&lt;/F&gt;&lt;F eqn="sum @0 0 1"&gt;&lt;/F&gt;&lt;F eqn="prod @6 1 2"&gt;&lt;/F&gt;&lt;F eqn="prod @7 21600 pixelWidth"&gt;&lt;/F&gt;&lt;F eqn="sum @8 21600 0"&gt;&lt;/F&gt;&lt;F eqn="prod @7 21600 pixelHeight"&gt;&lt;/F&gt;&lt;F eqn="sum @10 21600 0"&gt;&lt;/F&gt;&lt;/FORMULAS&gt;&lt;PATH o:connecttype="rect" gradientshapeok="t" o:extrusionok="f"&gt;&lt;/PATH&gt;&lt;LOCK aspectratio="t" v:ext="edit"&gt;&lt;/LOCK&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SHAPETYPE&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;A href="http://blogs.msdn.com/blogfiles/vinsibal/WindowsLiveWriter/TheControlLocalValuesBugSol.0relatedAPIs_7368/CLV_1_2.jpg" mce_href="http://blogs.msdn.com/blogfiles/vinsibal/WindowsLiveWriter/TheControlLocalValuesBugSol.0relatedAPIs_7368/CLV_1_2.jpg"&gt;&lt;IMG style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; DISPLAY: inline; BORDER-TOP: 0px; BORDER-RIGHT: 0px" title=CLV_1 border=0 alt=CLV_1 src="http://blogs.msdn.com/blogfiles/vinsibal/WindowsLiveWriter/TheControlLocalValuesBugSol.0relatedAPIs_7368/CLV_1_thumb.jpg" width=422 height=189 mce_src="http://blogs.msdn.com/blogfiles/vinsibal/WindowsLiveWriter/TheControlLocalValuesBugSol.0relatedAPIs_7368/CLV_1_thumb.jpg"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;Notice the BaseValueSource is ‘Style’, IsExpression is ‘True’, and IsCurrent is ‘False’ as expected.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;After pressing the “Set Current Value” button the values will update accordingly:&lt;/FONT&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=3 face=Calibri&gt;&amp;nbsp;&lt;A href="http://blogs.msdn.com/blogfiles/vinsibal/WindowsLiveWriter/TheControlLocalValuesBugSol.0relatedAPIs_7368/CLV_2_2.jpg" mce_href="http://blogs.msdn.com/blogfiles/vinsibal/WindowsLiveWriter/TheControlLocalValuesBugSol.0relatedAPIs_7368/CLV_2_2.jpg"&gt;&lt;IMG style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; DISPLAY: inline; BORDER-TOP: 0px; BORDER-RIGHT: 0px" title=CLV_2 border=0 alt=CLV_2 src="http://blogs.msdn.com/blogfiles/vinsibal/WindowsLiveWriter/TheControlLocalValuesBugSol.0relatedAPIs_7368/CLV_2_thumb.jpg" width=428 height=191 mce_src="http://blogs.msdn.com/blogfiles/vinsibal/WindowsLiveWriter/TheControlLocalValuesBugSol.0relatedAPIs_7368/CLV_2_thumb.jpg"&gt;&lt;/A&gt; &lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;Now the local value has updated to a new string that I set and IsCurrent has updated to ‘True’.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Also notice that BaseValueSource and IsExpression have not changed which is also expected.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;If you press “Clear Local Value” the values will update back to their initial values.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Now to bring back the original issue with the control local values bug, if you were to set or clear the local value any previous BaseValueSource would be overwritten and any expression lost.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;I have created other scenarios in the sample with different BaseValueSource behavior so you can understand how setting the current value behaves in those scenarios.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Please be sure to check it out below.&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Usage Recommendation &lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/B&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;For a control developer, the general recommendation is to always use DependencyObject.SetCurrentValue over DependencyObject.SetValue in Control code.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;You’ll notice that our stock controls in the 4.0 framework have all been updated to use this API instead of setting the properties with local values.&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;&lt;A href="http://blogs.msdn.com/vinsibal/attachment/9633846.ashx" mce_href="http://blogs.msdn.com/vinsibal/attachment/9633846.ashx"&gt;Here&lt;/A&gt; is the sample app which works with &lt;/FONT&gt;&lt;A href="http://www.microsoft.com/downloads/details.aspx?FamilyID=75cbcbcd-b0e8-40ea-adae-85714e8984e3&amp;amp;displaylang=en" mce_href="http://www.microsoft.com/downloads/details.aspx?FamilyID=75cbcbcd-b0e8-40ea-adae-85714e8984e3&amp;amp;displaylang=en"&gt;&lt;FONT size=3 face=Calibri&gt;VS 2010 beta 1&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3 face=Calibri&gt;.&lt;/FONT&gt;&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9633846" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-components-postattachments/00-09-63-38-46/ControlLocalValuesSample.zip" length="28660" type="application/x-zip-compressed" /><category domain="http://blogs.msdn.com/b/vinsibal/archive/tags/ControlLocalValues/">ControlLocalValues</category><category domain="http://blogs.msdn.com/b/vinsibal/archive/tags/wpf+4-0/">wpf 4.0</category></item><item><title>VS 2010 and .NET Framework 4.0 Beta1 are out now!</title><link>http://blogs.msdn.com/b/vinsibal/archive/2009/05/21/vs-2010-and-net-framework-4-0-beta1-are-out-now.aspx</link><pubDate>Thu, 21 May 2009 17:54:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9633839</guid><dc:creator>Vincent Sibal - MSFT</dc:creator><slash:comments>4</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/vinsibal/rsscomments.aspx?WeblogPostID=9633839</wfw:commentRss><comments>http://blogs.msdn.com/b/vinsibal/archive/2009/05/21/vs-2010-and-net-framework-4-0-beta1-are-out-now.aspx#comments</comments><description>&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;As many of you probably already know, &lt;/FONT&gt;&lt;A href="http://www.microsoft.com/visualstudio/en-us/products/2010/default.mspx"&gt;&lt;FONT size=3 face=Calibri&gt;dev10 beta1&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3 face=Calibri&gt; is available for public download.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Some of the additions to Beta1 on the WPF Controls side include:&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo1" class=MsoListParagraphCxSpFirst&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT size=3 face=Calibri&gt;MultiTouch&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo1" class=MsoListParagraphCxSpMiddle&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT size=3 face=Calibri&gt;EasingFunctions for animations&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo1" class=MsoListParagraphCxSpMiddle&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT size=3 face=Calibri&gt;DataGrid, Calendar, DatePicker, and VisualStateManager in PresentationFramework.dll &lt;/FONT&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo1" class=MsoListParagraphCxSpMiddle&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT size=3 face=Calibri&gt;New APIs to support the control local values bug&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 10pt 0.5in; mso-list: l0 level1 lfo1" class=MsoListParagraphCxSpLast&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT size=3 face=Calibri&gt;And tons of bug fixes on the new controls as well as existing control and element services areas&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;I’ll be going over some of these new features in more depth so stay tuned!&lt;/FONT&gt;&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9633839" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/vinsibal/archive/tags/wpf+4-0/">wpf 4.0</category></item><item><title>WPF Model-View-ViewModel (MVVM) Toolkit 0.1</title><link>http://blogs.msdn.com/b/vinsibal/archive/2009/05/02/wpf-model-view-viewmodel-mvvm-toolkit-0-1.aspx</link><pubDate>Sat, 02 May 2009 17:59:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9583756</guid><dc:creator>Vincent Sibal - MSFT</dc:creator><slash:comments>7</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/vinsibal/rsscomments.aspx?WeblogPostID=9583756</wfw:commentRss><comments>http://blogs.msdn.com/b/vinsibal/archive/2009/05/02/wpf-model-view-viewmodel-mvvm-toolkit-0-1.aspx#comments</comments><description>The WPF team has just released an MVVM Toolkit which contains an overview and walkthrough of the MVVM pattern, a full Messenger sample app using MVVM, as well as a Visual Studio template for MVVM.&amp;nbsp; The template creates a WPF application with folders for Views, ViewModels, Models, and Commands.&amp;nbsp; What I really like about it is the DelegateCommand class which is similar to &lt;A href="http://msdn.microsoft.com/en-us/magazine/dd419663.aspx#id0090030" mce_href="http://msdn.microsoft.com/en-us/magazine/dd419663.aspx#id0090030"&gt;RelayCommand&lt;/A&gt;.&amp;nbsp; One addition to this version of the Command implementation is the ability to manually control&amp;nbsp;when OnCanExecuteChanged is called or let the CommandManager control it.&amp;nbsp; The common scenario will be the latter, but&amp;nbsp;allowing the option for the former will allow greater control over application performance due to the many calls to OnCanExecuteChanged.&amp;nbsp; In the future, the plan is to get this as well as other MVVM concepts into the WPF framework.&amp;nbsp; You can learn more about it &lt;A href="http://wpf.codeplex.com/Wiki/View.aspx?title=WPF%20Model-View-ViewModel%20Toolkit" mce_href="http://wpf.codeplex.com/Wiki/View.aspx?title=WPF%20Model-View-ViewModel%20Toolkit"&gt;here&lt;/A&gt;&amp;nbsp;and download it &lt;A href="http://www.codeplex.com/wpf/Release/ProjectReleases.aspx?ReleaseId=14962" mce_href="http://www.codeplex.com/wpf/Release/ProjectReleases.aspx?ReleaseId=14962"&gt;here&lt;/A&gt;.&amp;nbsp; Check it out and we would love to hear your feedback.&amp;nbsp;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9583756" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/vinsibal/archive/tags/MVVM/">MVVM</category></item><item><title>WPF TestApi v0.2 has released!</title><link>http://blogs.msdn.com/b/vinsibal/archive/2009/04/24/wpf-testapi-v0-2-has-released.aspx</link><pubDate>Fri, 24 Apr 2009 20:39:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9567088</guid><dc:creator>Vincent Sibal - MSFT</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/vinsibal/rsscomments.aspx?WeblogPostID=9567088</wfw:commentRss><comments>http://blogs.msdn.com/b/vinsibal/archive/2009/04/24/wpf-testapi-v0-2-has-released.aspx#comments</comments><description>&lt;P&gt;The WPF test team is hard at work to provide value through a simple and componetized library of&amp;nbsp;public test APIs.&amp;nbsp; The &lt;A class="" href="http://www.codeplex.com/TestApi" mce_href="http://www.codeplex.com/TestApi"&gt;WPF TestAp&lt;/A&gt;i library has just released a &lt;A class="" href="http://testapi.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=26566" mce_href="http://testapi.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=26566"&gt;v0.2&lt;/A&gt; which includes new visual verification features, command line parsing features, an auomated application controller, and new unit test samples.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;Ivo has a great post about the visual verification APIs and usage&amp;nbsp;that you can view &lt;A class="" href="http://blogs.msdn.com/ivo_manolov/archive/2009/04/20/9557563.aspx" mce_href="http://blogs.msdn.com/ivo_manolov/archive/2009/04/20/9557563.aspx"&gt;here&lt;/A&gt;.&amp;nbsp; Please try it out and let us know your feedback!&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9567088" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/vinsibal/archive/tags/TestApi/">TestApi</category></item><item><title>5 More Random Gotchas with the WPF DataGrid</title><link>http://blogs.msdn.com/b/vinsibal/archive/2009/04/14/5-more-random-gotchas-with-the-wpf-datagrid.aspx</link><pubDate>Tue, 14 Apr 2009 16:21:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9548520</guid><dc:creator>Vincent Sibal - MSFT</dc:creator><slash:comments>17</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/vinsibal/rsscomments.aspx?WeblogPostID=9548520</wfw:commentRss><comments>http://blogs.msdn.com/b/vinsibal/archive/2009/04/14/5-more-random-gotchas-with-the-wpf-datagrid.aspx#comments</comments><description>&lt;P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 10pt 0.25in; mso-add-space: auto; mso-list: l0 level1 lfo1" class=MsoListParagraph&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3 face=Calibri&gt;1.&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;DataGridColumn.SortDirection does not actually sort the column.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;DataGridColumn.SortDirection is used to queue the visual arrow in the DataGridColumnHeader to point up, down, or to not show.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;To actually sort the columns other than clicking on the DataGridColumnHeader, you can set the DataGrid.Items.SortDescriptions programmatically.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Here is an example of an ICommand used to trigger grouping of a particular column in the DataGrid.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;In addition to grouping it, I also sort it on the same column name that I grouped it with.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Note that this code will programmatically sort the column but will not update the sorting arrow since I did not update SortDirection. &lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;DIV style="BORDER-BOTTOM: #4f6228 1pt dashed; BORDER-LEFT: #4f6228 1pt dashed; PADDING-BOTTOM: 5pt; PADDING-LEFT: 5pt; PADDING-RIGHT: 5pt; BACKGROUND: #f6f5f0; MARGIN-LEFT: 0.1in; BORDER-TOP: #4f6228 1pt dashed; MARGIN-RIGHT: 0in; BORDER-RIGHT: #4f6228 1pt dashed; PADDING-TOP: 5pt; mso-border-alt: dash-small-gap #4F6228 .5pt; mso-border-themecolor: accent3; mso-border-themeshade: 128; mso-element: para-border-div"&gt;
&lt;P style="MARGIN: 12pt 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpFirst&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;public&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: #2b91af"&gt;ICommand&lt;/SPAN&gt; GroupColumn&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;get&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;{&lt;SPAN style="mso-tab-count: 1"&gt; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; (_groupColumn == &lt;SPAN style="COLOR: blue"&gt;null&lt;/SPAN&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 6"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;_groupColumn = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;RelayCommand&lt;/SPAN&gt;&amp;lt;&lt;SPAN style="COLOR: blue"&gt;object&lt;/SPAN&gt;&amp;gt;(&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 7"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;(param) =&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 7"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 7"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;// the delegate is passed in the column header&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 7"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;// name which matches the Binding on the column&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 7"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;string&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; header = param &lt;SPAN style="COLOR: blue"&gt;as&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 7"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;// &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 7"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;// SearchResults is the ItemsSource that DataGrid&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 7"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;// is bound to. Below I programmatically group and&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 7"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;// sort the collection based on the header name&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 7"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;//&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 7"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;SearchResults.GroupDescriptions.Add(&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 8"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;PropertyGroupDescription&lt;/SPAN&gt;(header));&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 7"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;SearchResults.SortDescriptions.Add(&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 8"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;SortDescription&lt;/SPAN&gt;(header, &lt;SPAN style="COLOR: #2b91af"&gt;ListSortDirection&lt;/SPAN&gt;.Ascending));&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 7"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;});&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;return&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; _groupColumn;&lt;SPAN style="COLOR: blue"&gt;&lt;BR&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="mso-tab-count: 1"&gt; &lt;/SPAN&gt;}&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 12pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpLast&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;}&lt;/SPAN&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;
&lt;P style="MARGIN: 0in 0in 10pt 0.25in" class=MsoNormal&gt;&lt;o:p&gt;&lt;FONT size=3 face=Calibri&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt 0.25in" class=MsoNormal&gt;&lt;o:p&gt;&lt;FONT size=3 face=Calibri&gt;&lt;/FONT&gt;&lt;/o:p&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 10pt 0.25in; mso-add-space: auto; mso-list: l0 level1 lfo1" class=MsoListParagraph&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3 face=Calibri&gt;2.&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;DataGridColumns cannot be styled as they are not FrameworkElements.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;DataGridColumn derives from DependencyObject, not FrameworkElement, and therefore cannot be styled like many of the other elements on DataGrid.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;You can think of a DataGridColumn as data storage for what each cell’s content will be template with and a couple other properties like the width of each cell and how it is sorted.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;They are not meant to be visual elements like DataGridCell or DataGridRow.&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 10pt 0.25in; mso-add-space: auto; mso-list: l0 level1 lfo1" class=MsoListParagraph&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3 face=Calibri&gt;3.&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;While editing a row, the row is committed by pressing Enter, pressing tab on the last cell of the row, losing focus, clicking the column header to sort the column, programmatically calling DataGrid.CommitEdit, updating DataGrid.CurrentCell to a cell outside the current row, or updating DataGrid.CurrentItem.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;The actions described above are the default actions to commit a row.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;One action that deserves a little more clarification is the commit on losing focus. &lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;Each DataGridCell listens for changes to its IsKeyboardFocusWithin property and when it changes it updates the CurrentCell accordingly (which causes the row to commit).&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 10pt 0.25in; mso-add-space: auto; mso-list: l0 level1 lfo1" class=MsoListParagraph&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3 face=Calibri&gt;4.&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Disable commit behavior through the DataGrid.RowEditEnding event&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;In the previous gotcha I explain all the ways that a row can be committed.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;If you want to customize that behavior, the best way to do it is through DataGrid.RowEditEnding.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;This event is fired at the start of any and all row commits and you have the ability to cancel the commit behavior in this event through DataGridRowEditEndingEventArgs.Cancel.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;See more about editing behavior &lt;/FONT&gt;&lt;A href="http://blogs.msdn.com/vinsibal/archive/2008/10/01/overview-of-the-editing-features-in-the-wpf-datagrid.aspx" mce_href="http://blogs.msdn.com/vinsibal/archive/2008/10/01/overview-of-the-editing-features-in-the-wpf-datagrid.aspx"&gt;&lt;FONT size=3 face=Calibri&gt;here&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3 face=Calibri&gt;.&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 10pt 0.25in; mso-add-space: auto; mso-list: l0 level1 lfo1" class=MsoListParagraph&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3 face=Calibri&gt;5.&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Customize focus behavior after a row commit through the DataGrid.RowEditEnding event &lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;While there isn’t a DataGrid.RowEditEnded at this time (March 2009 Release), you can use the Dispatcher trick to get custom behavior after a row commit has occurred.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;In DataGrid.RowEditEnding, you can specify a Dispatcher.BeginInvoke so that the code in the delegate is executed after the row commit has completed.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Here is some example code which sets focus to the second cell of the next row and puts it in edit mode but only when I press tab on the last cell of the row before the NewItemPlaceholder.&lt;/FONT&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;DIV style="BORDER-BOTTOM: #4f6228 1pt dashed; BORDER-LEFT: #4f6228 1pt dashed; PADDING-BOTTOM: 5pt; PADDING-LEFT: 5pt; PADDING-RIGHT: 5pt; BACKGROUND: #f6f5f0; MARGIN-LEFT: 0.1in; BORDER-TOP: #4f6228 1pt dashed; MARGIN-RIGHT: 0in; BORDER-RIGHT: #4f6228 1pt dashed; PADDING-TOP: 5pt; mso-border-alt: dash-small-gap #4F6228 .5pt; mso-border-themecolor: accent3; mso-border-themeshade: 128; mso-element: para-border-div"&gt;
&lt;P style="MARGIN: 12pt 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpFirst&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;private&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; OnRowEditEnding(&lt;SPAN style="COLOR: blue"&gt;object&lt;/SPAN&gt; sender, &lt;SPAN style="COLOR: #2b91af"&gt;DataGridRowEditEndingEventArgs&lt;/SPAN&gt; e)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;{&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; (e.EditAction == &lt;SPAN style="COLOR: #2b91af"&gt;DataGridEditAction&lt;/SPAN&gt;.Commit)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;//&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;// custom commit action:&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;// tab specific behavior for editing workflow.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;// moves to the next row and opens the second cell for edit&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;// if the next row is the NewItemPlaceholder&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;//&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; (_isTabPressed &amp;amp;&amp;amp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;e.Row.Item == dataGrid.Items[dataGrid.Items.Count - 2])&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;// set the new cell to be the last row and the second column&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;int&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; colIndex = 1;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; rowToSelect = dataGrid.Items[dataGrid.Items.Count - 1];&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; colToSelect = dataGrid.Columns[colIndex];&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;int&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; rowIndex = dataGrid.Items.IndexOf(rowToSelect);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;// select the new cell&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;dataGrid.SelectedCells.Clear();&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;dataGrid.SelectedCells.Add(&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 5"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;DataGridCellInfo&lt;/SPAN&gt;(rowToSelect, colToSelect));&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;this&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;.Dispatcher.BeginInvoke(&lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;DispatcherOperationCallback&lt;/SPAN&gt;((param) =&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 6"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;// get the new cell, set focus, then open for edit&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 6"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; cell = &lt;SPAN style="COLOR: #2b91af"&gt;Helper&lt;/SPAN&gt;.GetCell(dataGrid, rowIndex, colIndex);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 6"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;cell.Focus();&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 6"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;dataGrid.BeginEdit();&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 6"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;return&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: blue"&gt;null&lt;/SPAN&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}), &lt;SPAN style="COLOR: #2b91af"&gt;DispatcherPriority&lt;/SPAN&gt;.Background, &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;object&lt;/SPAN&gt;[] { &lt;SPAN style="COLOR: blue"&gt;null&lt;/SPAN&gt; });&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 12pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpLast&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;}&lt;/SPAN&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;
&lt;P style="MARGIN: 0in 0in 10pt 0.25in" class=MsoNormal&gt;&lt;o:p&gt;&lt;FONT size=3 face=Calibri&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;See more &lt;/FONT&gt;&lt;A href="http://blogs.msdn.com/vinsibal/archive/2009/04/07/5-random-gotchas-with-the-wpf-datagrid.aspx" mce_href="http://blogs.msdn.com/vinsibal/archive/2009/04/07/5-random-gotchas-with-the-wpf-datagrid.aspx"&gt;&lt;FONT size=3 face=Calibri&gt;WPF DataGrid gotchas&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3 face=Calibri&gt;.&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt 0.25in" class=MsoNormal&gt;&lt;o:p&gt;&lt;FONT size=3 face=Calibri&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9548520" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/vinsibal/archive/tags/DataGrid/">DataGrid</category><category domain="http://blogs.msdn.com/b/vinsibal/archive/tags/DataGrid+Concepts/">DataGrid Concepts</category></item><item><title>Launching a custom Dialog to edit items in a DataGrid (with MVVM)</title><link>http://blogs.msdn.com/b/vinsibal/archive/2009/04/10/launching-a-custom-dialog-to-edit-items-in-a-datagrid-with-mvvm.aspx</link><pubDate>Fri, 10 Apr 2009 16:53:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9543268</guid><dc:creator>Vincent Sibal - MSFT</dc:creator><slash:comments>19</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/vinsibal/rsscomments.aspx?WeblogPostID=9543268</wfw:commentRss><comments>http://blogs.msdn.com/b/vinsibal/archive/2009/04/10/launching-a-custom-dialog-to-edit-items-in-a-datagrid-with-mvvm.aspx#comments</comments><description>&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;Launching a custom dialog for editing on the DataGrid is another somewhat common request that I see from the &lt;/FONT&gt;&lt;A href="http://wpf.codeplex.com/Thread/List.aspx" mce_href="http://wpf.codeplex.com/Thread/List.aspx"&gt;&lt;FONT size=3 face=Calibri&gt;discussion list&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3 face=Calibri&gt;.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;I thought I would provide a sample but at the same time implement it with the MVVM pattern.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;The requirement that I will use on the sample is that the editing mechanism can only come from the editing dialog that I provide.&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;I decided that the way to launch the custom dialog will be through double-clicking on the row.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;To get that behavior, I will use the &lt;/FONT&gt;&lt;A href="http://blogs.msdn.com/johngossman/archive/2008/05/07/the-attached-behavior-pattern.aspx" mce_href="http://blogs.msdn.com/johngossman/archive/2008/05/07/the-attached-behavior-pattern.aspx"&gt;&lt;FONT size=3 face=Calibri&gt;attached behavior pattern&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3 face=Calibri&gt; on DataGridRow.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;The behavior is defined like so:&lt;/FONT&gt;&lt;/P&gt;
&lt;DIV style="BORDER-BOTTOM: #4f6228 1pt dashed; BORDER-LEFT: #4f6228 1pt dashed; PADDING-BOTTOM: 5pt; PADDING-LEFT: 5pt; PADDING-RIGHT: 5pt; BACKGROUND: #f6f5f0; MARGIN-LEFT: 0.1in; BORDER-TOP: #4f6228 1pt dashed; MARGIN-RIGHT: 0in; BORDER-RIGHT: #4f6228 1pt dashed; PADDING-TOP: 5pt; mso-border-alt: dash-small-gap #4F6228 .5pt; mso-element: para-border-div; mso-border-themecolor: accent3; mso-border-themeshade: 128"&gt;
&lt;P style="MARGIN: 12pt 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpFirst&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;public&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: blue"&gt;class&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;DataGridRowBehavior&lt;/SPAN&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;public&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: blue"&gt;static&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;DependencyProperty&lt;/SPAN&gt; OnDoubleClickProperty = &lt;SPAN style="COLOR: #2b91af"&gt;DependencyProperty&lt;/SPAN&gt;.RegisterAttached(&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;"OnDoubleClick"&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;,&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;typeof&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;(&lt;SPAN style="COLOR: #2b91af"&gt;ICommand&lt;/SPAN&gt;),&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;typeof&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;(&lt;SPAN style="COLOR: #2b91af"&gt;DataGridRowBehavior&lt;/SPAN&gt;),&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;new&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: #2b91af"&gt;UIPropertyMetadata&lt;/SPAN&gt;(&lt;SPAN style="COLOR: #2b91af"&gt;DataGridRowBehavior&lt;/SPAN&gt;.OnDoubleClick));&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;public&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: blue"&gt;static&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; SetOnDoubleClick(&lt;SPAN style="COLOR: #2b91af"&gt;DependencyObject&lt;/SPAN&gt; target, &lt;SPAN style="COLOR: #2b91af"&gt;ICommand&lt;/SPAN&gt; value)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;target.SetValue(&lt;SPAN style="COLOR: #2b91af"&gt;DataGridRowBehavior&lt;/SPAN&gt;.OnDoubleClickProperty, value);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;private&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: blue"&gt;static&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; OnDoubleClick(&lt;SPAN style="COLOR: #2b91af"&gt;DependencyObject&lt;/SPAN&gt; target, &lt;SPAN style="COLOR: #2b91af"&gt;DependencyPropertyChangedEventArgs&lt;/SPAN&gt; e)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; element = target &lt;SPAN style="COLOR: blue"&gt;as&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;DataGridRow&lt;/SPAN&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; ((e.NewValue != &lt;SPAN style="COLOR: blue"&gt;null&lt;/SPAN&gt;) &amp;amp;&amp;amp; (e.OldValue == &lt;SPAN style="COLOR: blue"&gt;null&lt;/SPAN&gt;))&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 5"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp; &lt;/SPAN&gt;element.PreviewMouseDoubleClick += OnPreviewMouseDoubleClick;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;else&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: blue"&gt;if&lt;/SPAN&gt; ((e.NewValue == &lt;SPAN style="COLOR: blue"&gt;null&lt;/SPAN&gt;) &amp;amp;&amp;amp; (e.OldValue != &lt;SPAN style="COLOR: blue"&gt;null&lt;/SPAN&gt;))&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 5"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp; &lt;/SPAN&gt;element.PreviewMouseDoubleClick -= OnPreviewMouseDoubleClick;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;private&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: blue"&gt;static&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; OnPreviewMouseDoubleClick(&lt;SPAN style="COLOR: blue"&gt;object&lt;/SPAN&gt; sender, &lt;SPAN style="COLOR: #2b91af"&gt;MouseButtonEventArgs&lt;/SPAN&gt; e)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;{&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: #2b91af; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;UIElement&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; element = (&lt;SPAN style="COLOR: #2b91af"&gt;UIElement&lt;/SPAN&gt;)sender;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: #2b91af; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;ICommand&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; command = (&lt;SPAN style="COLOR: #2b91af"&gt;ICommand&lt;/SPAN&gt;)element.GetValue(&lt;SPAN style="COLOR: #2b91af"&gt;DataGridRowBehavior&lt;/SPAN&gt;.OnDoubleClickProperty);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;command.Execute(e);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 12pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpLast&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;}&lt;/SPAN&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;The behavior is then used on the DataGridRow like this:&lt;/FONT&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;DIV style="BORDER-BOTTOM: #4f6228 1pt dashed; BORDER-LEFT: #4f6228 1pt dashed; PADDING-BOTTOM: 5pt; PADDING-LEFT: 5pt; PADDING-RIGHT: 5pt; BACKGROUND: #f6f5f0; MARGIN-LEFT: 0.1in; BORDER-TOP: #4f6228 1pt dashed; MARGIN-RIGHT: 0in; BORDER-RIGHT: #4f6228 1pt dashed; PADDING-TOP: 5pt; mso-border-alt: dash-small-gap #4F6228 .5pt; mso-element: para-border-div; mso-border-themecolor: accent3; mso-border-themeshade: 128"&gt;
&lt;P style="MARGIN: 12pt 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpFirst&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;Style&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; TargetType&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;="{&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;x&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;Type&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; toolkit&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;DataGridRow&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;}"&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;Setter&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; Property&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;="local:DataGridRowBehavior.OnDoubleClick"&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 6"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;Value&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;="{&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;Binding&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; ShowEditItemDialogCommand&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;}" /&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 12pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpLast&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;Style&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;What’s happening is the OnDoubleClick attached property listens for a property change on itself.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;I define an ICommand, ShowEditItemDialogCommand, on OnDoubleClick which then hooks up the actual event handler, PreviewMouseDoubleClick, on the target element.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;In that event handler, OnPreviewMouseDoubleClick, I retrieve the value of OnDoubleClick which is my ICommand and execute it. &lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;So now we have the behavior to launch a dialog through a double-click action.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;The next thing is to define the ICommand ShowEditItemDialogCommand.&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;I have defined a DataGridRow ViewModel which hosts the actual item data as well as any properties that will drive the view (the DataGridRow).&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;It also will host any commands on a DataGridRow which for our purposes will be the ShowEditItemDialogCommand.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;My commands are also implemented using the RelayCommand mechanism that is discussed on this &lt;/FONT&gt;&lt;A href="http://msdn.microsoft.com/en-us/magazine/dd419663.aspx" mce_href="http://msdn.microsoft.com/en-us/magazine/dd419663.aspx"&gt;&lt;FONT size=3 face=Calibri&gt;MSDN article&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3 face=Calibri&gt;.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;So here is the basic implementation:&lt;/FONT&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;DIV style="BORDER-BOTTOM: #4f6228 1pt dashed; BORDER-LEFT: #4f6228 1pt dashed; PADDING-BOTTOM: 5pt; PADDING-LEFT: 5pt; PADDING-RIGHT: 5pt; BACKGROUND: #f6f5f0; MARGIN-LEFT: 0.1in; BORDER-TOP: #4f6228 1pt dashed; MARGIN-RIGHT: 0in; BORDER-RIGHT: #4f6228 1pt dashed; PADDING-TOP: 5pt; mso-border-alt: dash-small-gap #4F6228 .5pt; mso-element: para-border-div; mso-border-themecolor: accent3; mso-border-themeshade: 128"&gt;
&lt;P style="MARGIN: 12pt 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpFirst&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;public&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: blue"&gt;class&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;ItemViewModel&lt;/SPAN&gt; : &lt;SPAN style="COLOR: #2b91af"&gt;ViewModelBase&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;private&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: #2b91af"&gt;ICommand&lt;/SPAN&gt; _editItemCommand;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;public&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: #2b91af"&gt;ICommand&lt;/SPAN&gt; ShowEditItemDialogCommand&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp; &lt;/SPAN&gt;get&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&lt;/SPAN&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp; &lt;/SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; (_editItemCommand == &lt;SPAN style="COLOR: blue"&gt;null&lt;/SPAN&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&lt;/SPAN&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 5"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp; &lt;/SPAN&gt;_editItemCommand = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;RelayCommand&lt;/SPAN&gt;(&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 5"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;() =&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 7"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 8"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;// pass the item to the dialog&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 8"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; dlg = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;EditItemDialog&lt;/SPAN&gt;(Item);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 8"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; (dlg.ShowDialog() == &lt;SPAN style="COLOR: blue"&gt;true&lt;/SPAN&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 8"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 8"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;// retrieve the updated item from the dialog&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 8"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Item = dlg.Result.Item;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 8"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 7"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;});&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp; &lt;/SPAN&gt;return&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; _editItemCommand;&lt;SPAN style="COLOR: blue"&gt;&lt;BR&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="mso-tab-count: 1"&gt; &lt;/SPAN&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp; &lt;/SPAN&gt;}&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 12pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpLast&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;}&lt;/SPAN&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;So when DataGridRowBehavior.OnPreviewMouseDoubleClick executes the command, my ShowEditItemDialogCommand will initiate the launch of the new dialog.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;The dialog that is being launched is basically a new Window which is considered a View.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;From a MVVM purist perspective this does not belong in a ViewModel.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;To handle this you can use the &lt;/FONT&gt;&lt;A href="http://en.wikipedia.org/wiki/Mediator_pattern" mce_href="http://en.wikipedia.org/wiki/Mediator_pattern"&gt;&lt;FONT size=3 face=Calibri&gt;mediator&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3 face=Calibri&gt; design pattern to host the communication between the ViewModel and the View.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;There are a couple ways to implement this pattern which include implementing it as an observer pattern or using a specialized communication mechanism through interfaces and references. &lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;I’ve chosen the latter and in the sample code you can see I’ve named it EditDialogDirector to be clear on&amp;nbsp;its behavior.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;I won’t show all the details here.&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;Now, I said earlier that I set a requirement that editing can only come from the dialog that I provide.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;While there are a lot of ways to customize the editing behavior, I decided to keep it really simple and set DataGrid.IsReadOnly to true.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;It does mean that I will lose the default editing capabilities that DataGrid provides, but I won’t have to keep state on DataGrid begin and commit edits.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;There are some other details that I’m leaving out but the full sample code below will give you a good idea of how everything is pieced together.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Also, there is a lot of great reference material and samples on MVVM to further enhance your knowledge on the subject.&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;A href="http://blogs.msdn.com/johngossman/archive/2005/10/08/478683.aspx" mce_href="http://blogs.msdn.com/johngossman/archive/2005/10/08/478683.aspx"&gt;&lt;FONT size=3 face=Calibri&gt;http://blogs.msdn.com/johngossman/archive/2005/10/08/478683.aspx&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;A href="http://karlshifflett.wordpress.com/mvvm/" mce_href="http://karlshifflett.wordpress.com/mvvm/"&gt;&lt;FONT size=3 face=Calibri&gt;http://karlshifflett.wordpress.com/mvvm/&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;A href="http://www.codeproject.com/KB/WPF/InternationalizedWizard.aspx" mce_href="http://www.codeproject.com/KB/WPF/InternationalizedWizard.aspx"&gt;&lt;FONT size=3 face=Calibri&gt;http://www.codeproject.com/KB/WPF/InternationalizedWizard.aspx&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;Download the full sample &lt;A href="http://blogs.msdn.com/vinsibal/attachment/9543268.ashx" mce_href="http://blogs.msdn.com/vinsibal/attachment/9543268.ashx"&gt;here&lt;/A&gt;.&lt;/FONT&gt;&lt;o:p&gt;&lt;FONT size=3 face=Calibri&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;o:p&gt;&lt;FONT size=3 face=Calibri&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9543268" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-components-postattachments/00-09-54-32-68/DataGridMVVMEditingSample.zip" length="34256" type="application/x-zip-compressed" /><category domain="http://blogs.msdn.com/b/vinsibal/archive/tags/DataGrid/">DataGrid</category><category domain="http://blogs.msdn.com/b/vinsibal/archive/tags/DataGrid+Samples/">DataGrid Samples</category><category domain="http://blogs.msdn.com/b/vinsibal/archive/tags/MVVM/">MVVM</category></item><item><title>5 Random Gotchas with the WPF DataGrid</title><link>http://blogs.msdn.com/b/vinsibal/archive/2009/04/07/5-random-gotchas-with-the-wpf-datagrid.aspx</link><pubDate>Tue, 07 Apr 2009 16:54:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9535969</guid><dc:creator>Vincent Sibal - MSFT</dc:creator><slash:comments>8</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/vinsibal/rsscomments.aspx?WeblogPostID=9535969</wfw:commentRss><comments>http://blogs.msdn.com/b/vinsibal/archive/2009/04/07/5-random-gotchas-with-the-wpf-datagrid.aspx#comments</comments><description>&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;Since the release of the WPF DataGrid there have been several&amp;nbsp;common patterns of questions&amp;nbsp;that developers were asking on the&amp;nbsp;&lt;A href="http://wpf.codeplex.com/Thread/List.aspx" mce_href="http://wpf.codeplex.com/Thread/List.aspx"&gt;discussion list&lt;/A&gt;.&amp;nbsp; I thought that I would capture some of that here so it would be easy to find.&amp;nbsp; I'll also try to keep it as short as possible and refer to other links for more information.&amp;nbsp; These gotchas are in no particular order.&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;FONT size=3 face=Calibri&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 10pt 0.25in; mso-add-space: auto; mso-list: l0 level1 lfo1" class=MsoListParagraph&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3 face=Calibri&gt;1.&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;DataGridColumns are not part of the visual tree.&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;Since a DataGridColumn has a Binding DP it is easy to think that bindings to other DataGridColumn DPs will work just the same but they don't.&amp;nbsp; Below is an example showing a DataGridCheckBoxColumn setting the Binding DP and CanUserSort through data binding.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;While Binding will bind correctly, CanUserSort will not.&lt;/FONT&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;DIV style="BORDER-BOTTOM: #4f6228 1pt dashed; BORDER-LEFT: #4f6228 1pt dashed; PADDING-BOTTOM: 5pt; PADDING-LEFT: 5pt; PADDING-RIGHT: 5pt; BACKGROUND: #f6f5f0; MARGIN-LEFT: 0.1in; BORDER-TOP: #4f6228 1pt dashed; MARGIN-RIGHT: 0in; BORDER-RIGHT: #4f6228 1pt dashed; PADDING-TOP: 5pt; mso-border-alt: dash-small-gap #4F6228 .5pt; mso-border-themecolor: accent3; mso-border-themeshade: 128; mso-element: para-border-div"&gt;
&lt;P style="MARGIN: 12pt 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpFirst&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;dg&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;DataGridCheckBoxColumn&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; Header&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;="Selection"&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Binding&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;="{&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;Binding&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; IsSelected&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;}"&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 12pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpLast&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;CanUserSort&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="{&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;Binding&lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt; CanSort&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;}"/&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;Note that the reason Binding does work is because the internal code dynamically sets the binding of DataGridColumn.Binding to the DataGridCell.Content.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;It does not do so for the other DataGridColumn DPs.&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;Workaround =&amp;gt; Check out &lt;/FONT&gt;&lt;A href="http://blogs.msdn.com/jaimer/archive/2008/11/22/forwarding-the-datagrid-s-datacontext-to-its-columns.aspx"&gt;&lt;FONT size=3 face=Calibri&gt;Jaime’s post&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3 face=Calibri&gt; on how to get the DataGridColumns to use the same DataContext as the DataGrid. &lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;o:p&gt;&lt;FONT size=3 face=Calibri&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 10pt 0.25in; mso-add-space: auto; mso-list: l0 level1 lfo1" class=MsoListParagraph&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3 face=Calibri&gt;2.&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;DataGridColumn.Binding will automatically&amp;nbsp;coerce the binding to BindingMode.TwoWay and UpdateSourceTrigger.Explicit&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;No matter how you declare the binding for DataGridColumn.Binding, internally it will coerce the BindingMode to TwoWay and UpdateSourceTrigger to Explicit (even if you set them explicitly yourself).&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;This is because the DataGrid manages the binding operations itself for editing functionality.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Now, you might run into an issue when you have a read-only property with a TwoWay binding mode.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;If you set DataGridColumn.IsReadOnly to true, then the BindingMode will not be coerced to TwoWay.&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;o:p&gt;&lt;FONT size=3 face=Calibri&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 10pt 0.25in; mso-add-space: auto; mso-list: l0 level1 lfo1" class=MsoListParagraph&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3 face=Calibri&gt;3.&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;You manage the bindings when using a DataGridTemplateColumn.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;The DataGrid internal code does not coerce the bindings set on DataGridTemplateColumn because DataGridTemplateColumn doesn’t even have a Binding DP.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Since you are setting the bindings up yourself, you have to tell it when to commit.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;One common way to do this is to setup a OneWay binding on the UIElement in the CellTemplate and a TwoWay binding on the CellEditingTemplate.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;See this previous &lt;/FONT&gt;&lt;A href="http://blogs.msdn.com/vinsibal/archive/2008/08/19/wpf-datagrid-stock-and-template-columns.aspx"&gt;&lt;FONT size=3 face=Calibri&gt;post&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3 face=Calibri&gt; for example code (under “Template Columns”).&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;The example code uses an UpdateSourceTrigger of PropertyChanged.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;If that does not suite your needs for committing the data, you can mimic what the DataGrid internal code does and update the source yourself.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Set the UpdateSourceTrigger to Explicit and listen to the DataGrid.CellEditEnding event.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;You can then update the source explicitly in that event.&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;o:p&gt;&lt;FONT size=3 face=Calibri&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 10pt 0.25in; mso-add-space: auto; mso-list: l0 level1 lfo1" class=MsoListParagraph&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3 face=Calibri&gt;4.&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Use DataGridColumn.ElementStyle and DataGridColumn.EditingElementStyle to set properties on a cell’s Content.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;Each stock DataGridColumn type produces a specific type of Control as the content for each DataGridCell in the column.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;See this previous &lt;/FONT&gt;&lt;A href="http://blogs.msdn.com/vinsibal/archive/2008/08/19/wpf-datagrid-stock-and-template-columns.aspx"&gt;&lt;FONT size=3 face=Calibri&gt;post&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3 face=Calibri&gt; for more info on that.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;It seems that the first instinct to set properties on the cell’s content is to set them through the DataGridCell Style when they should instead be set on DataGridColumn.ElementStyle and/or DataGridColumn.EditingElementStyle.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;ElementStyle is the Style applied to the non-editing element.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;EditingElementStyle is for the editing element.&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;In a previous gotcha, I mention that DataGridColumns are not part of the visual tree.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;With that said, you can still create bindings that map to the same DataContext as DataGridColumn.Binding on DPs from a Style set on DataGridColumn.ElementStyle and DataGridColumn.EditingElementStyle.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;That is because these styles are applied dynamically to the cell’s content which has the correct DataContext. &lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;Below I am setting a DataGridTextBoxColumn’s ElementStyle.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Notice that I have a binding setup on Background with a “MyBrush” property path.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;I am assuming that property is coming from the DataContext of the DataGridCell (which is the same DataContext of the DataGridRow).&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;DIV style="BORDER-BOTTOM: #4f6228 1pt dashed; BORDER-LEFT: #4f6228 1pt dashed; PADDING-BOTTOM: 5pt; PADDING-LEFT: 5pt; PADDING-RIGHT: 5pt; BACKGROUND: #f6f5f0; MARGIN-LEFT: 0.1in; BORDER-TOP: #4f6228 1pt dashed; MARGIN-RIGHT: 0in; BORDER-RIGHT: #4f6228 1pt dashed; PADDING-TOP: 5pt; mso-border-alt: dash-small-gap #4F6228 .5pt; mso-border-themecolor: accent3; mso-border-themeshade: 128; mso-element: para-border-div"&gt;
&lt;P style="MARGIN: 12pt 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpFirst&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;dg&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;DataGridTextColumn&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; Header&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;="First Name"&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;Binding&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;="{&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;Binding&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; Path&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;=FirstName}"&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;dg&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;DataGridTextColumn.ElementStyle&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;Style&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; TargetType&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;="{&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;x&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;Type&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; TextBlock&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;}"&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 5"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;Setter&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; Property&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;="ToolTip"&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; Value&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;="{&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;StaticResource&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; TextToolTip&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;}" /&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 5"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;Setter&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; Property&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;="Background"&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; Value&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;="{&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;Binding&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; MyBrush&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;}" /&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 5"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;Setter&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; Property&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;="TextWrapping"&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; Value&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;="Wrap" /&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;Style&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;dg&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;DataGridTextColumn.ElementStyle&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 12pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpLast&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;dg&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;DataGridTextColumn&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;o:p&gt;&lt;FONT size=3 face=Calibri&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;o:p&gt;&lt;FONT size=3 face=Calibri&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 10pt 0.25in; mso-add-space: auto; mso-list: l0 level1 lfo1" class=MsoListParagraph&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3 face=Calibri&gt;5.&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Data source items should implement IEditableObject to get transactional editing functionality.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;If you are not familiar with IEditableObject, see this MSDN &lt;/FONT&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/system.componentmodel.ieditableobject.aspx"&gt;&lt;FONT size=3 face=Calibri&gt;article&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3 face=Calibri&gt; which has a good explanation and code sample.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;The DataGrid has baked in functionality for transactional editing via the IEditableObject interface.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;When you begin editing a cell, the DataGrid gets into cell editing mode as well as row editing mode.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;What this means is that you can cancel/commit cells as well as cancel/commit rows.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;For example, I edit cell 0 and press tab to the next cell.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Cell 0 is committed when pressing tab.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;I start typing in cell 1 and realize I want to cancel the operation.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;I press ‘Esc’ which reverts cell 1.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;I now realize I want to cancel the whole operation so I press ‘Esc’ again and now cell 0 is reverted back to its original value.&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;o:p&gt;&lt;FONT size=3 face=Calibri&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;o:p&gt;&lt;FONT size=3 face=Calibri&gt;See more &lt;A href="http://blogs.msdn.com/vinsibal/archive/2009/04/14/5-more-random-gotchas-with-the-wpf-datagrid.aspx" mce_href="http://blogs.msdn.com/vinsibal/archive/2009/04/14/5-more-random-gotchas-with-the-wpf-datagrid.aspx"&gt;WPF DataGrid&amp;nbsp;gotchas&lt;/A&gt;.&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;o:p&gt;&lt;FONT size=3 face=Calibri&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9535969" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/vinsibal/archive/tags/DataGrid/">DataGrid</category><category domain="http://blogs.msdn.com/b/vinsibal/archive/tags/DataGrid+Concepts/">DataGrid Concepts</category></item><item><title>The Control Local Values Bug!</title><link>http://blogs.msdn.com/b/vinsibal/archive/2009/03/24/the-control-local-values-bug.aspx</link><pubDate>Tue, 24 Mar 2009 23:06:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9505118</guid><dc:creator>Vincent Sibal - MSFT</dc:creator><slash:comments>4</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/vinsibal/rsscomments.aspx?WeblogPostID=9505118</wfw:commentRss><comments>http://blogs.msdn.com/b/vinsibal/archive/2009/03/24/the-control-local-values-bug.aspx#comments</comments><description>&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;FONT face=Calibri&gt;&lt;FONT size=3&gt;Intro&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/system.windows.dependencyproperty.aspx" mce_href="http://msdn.microsoft.com/en-us/library/system.windows.dependencyproperty.aspx"&gt;&lt;FONT size=3 face=Calibri&gt;WPF dependency properties&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3 face=Calibri&gt; are properties that are registered through the WPF property system.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;By registering with the property system, the property will be provided a set of services such as data binding, styling, change notifications, animation, expressions, invalidation, and coercion.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;What I will be discussing here is dynamic value resolution and the issue of setting local values in controls.&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;FONT face=Calibri&gt;&lt;FONT size=3&gt;Background&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;A dependency property’s value is dependent on multiple providers where there is a level of precedence for each provider.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;The &lt;/FONT&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/system.windows.basevaluesource.aspx" mce_href="http://msdn.microsoft.com/en-us/library/system.windows.basevaluesource.aspx"&gt;&lt;FONT size=3 face=Calibri&gt;BaseValueSource&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3 face=Calibri&gt; enum captures these providers (with the first being the lowest precedence and last being the highest)&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo1" class=MsoListParagraphCxSpFirst&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT size=3 face=Calibri&gt;Unknown&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo1" class=MsoListParagraphCxSpMiddle&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT size=3 face=Calibri&gt;Default&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo1" class=MsoListParagraphCxSpMiddle&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT size=3 face=Calibri&gt;Inherited&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo1" class=MsoListParagraphCxSpMiddle&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT size=3 face=Calibri&gt;ThemeStyle&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo1" class=MsoListParagraphCxSpMiddle&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT size=3 face=Calibri&gt;ThemeStyleTrigger&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo1" class=MsoListParagraphCxSpMiddle&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT size=3 face=Calibri&gt;Style&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo1" class=MsoListParagraphCxSpMiddle&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT size=3 face=Calibri&gt;TemplateTrigger&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo1" class=MsoListParagraphCxSpMiddle&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT size=3 face=Calibri&gt;StyleTrigger&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo1" class=MsoListParagraphCxSpMiddle&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT size=3 face=Calibri&gt;ImplicitStyleReference&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo1" class=MsoListParagraphCxSpMiddle&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT size=3 face=Calibri&gt;ParentTemplate&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo1" class=MsoListParagraphCxSpMiddle&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT size=3 face=Calibri&gt;PatentTemplateTrigger&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 10pt 0.5in; mso-list: l0 level1 lfo1" class=MsoListParagraphCxSpLast&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT size=3 face=Calibri&gt;Local&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;In addition to these base value sources, the dependency property can also come from an expression, animation, or coercion (which the internal WPF code represents them as ModifiedValues).&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Note that ModifiedValues are mutually exclusive from BaseValueSource.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;For example you can have a value that is set locally and coerced at the same time. &lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;So how does this relate to the control local values bug?&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;As a control author, dependency properties are the general mechanism to communicate the state and behavior of the control.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;They will be used in data binding scenarios, visual representation, interaction, etc.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;This means that you will possibly and most likely be setting values on your dependency properties internally as state changes about your control.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;So as you are setting new values to a dependency property that you own, you may not realize that you are introducing a very subtle bug relating to dynamic value resolution precedence.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;I’ll use an example to clarify. &lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;The DatePicker control from WPFToolkit has a DP called IsDropDownOpen.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;It is used by the DatePicker control to update when the calendar popup opens and closes.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;It listens for a change event and sets the Popup.IsOpen accordingly.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;DIV style="BORDER-BOTTOM: #4f6228 1pt dashed; BORDER-LEFT: #4f6228 1pt dashed; PADDING-BOTTOM: 5pt; PADDING-LEFT: 5pt; PADDING-RIGHT: 5pt; BACKGROUND: #f6f5f0; MARGIN-LEFT: 0.1in; BORDER-TOP: #4f6228 1pt dashed; MARGIN-RIGHT: 0in; BORDER-RIGHT: #4f6228 1pt dashed; PADDING-TOP: 5pt; mso-border-alt: dash-small-gap #4F6228 .5pt; mso-border-themecolor: accent3; mso-border-themeshade: 128; mso-element: para-border-div"&gt;
&lt;P style="MARGIN: 12pt 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpFirst&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;private&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: blue"&gt;static&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; OnIsDropDownOpenChanged(&lt;SPAN style="COLOR: #2b91af"&gt;DependencyObject&lt;/SPAN&gt; d, &lt;SPAN style="COLOR: #2b91af"&gt;DependencyPropertyChangedEventArgs&lt;/SPAN&gt; e)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;{&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: #2b91af; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;DatePicker&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; dp = d &lt;SPAN style="COLOR: blue"&gt;as&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;DatePicker&lt;/SPAN&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: #2b91af; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;Debug&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;.Assert(dp != &lt;SPAN style="COLOR: blue"&gt;null&lt;/SPAN&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;bool&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; newValue = (&lt;SPAN style="COLOR: blue"&gt;bool&lt;/SPAN&gt;)e.NewValue;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; (dp._popUp != &lt;SPAN style="COLOR: blue"&gt;null&lt;/SPAN&gt; &amp;amp;&amp;amp; dp._popUp.IsOpen != newValue)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;dp._popUp.IsOpen = newValue;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 12pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpLast&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;}&lt;/SPAN&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;/FONT&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;The Popup also listens for when it opens and closes and makes sure IsDropDownOpen is toggled to the correct state.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;DIV style="BORDER-BOTTOM: #4f6228 1pt dashed; BORDER-LEFT: #4f6228 1pt dashed; PADDING-BOTTOM: 5pt; PADDING-LEFT: 5pt; PADDING-RIGHT: 5pt; BACKGROUND: #f6f5f0; MARGIN-LEFT: 0.1in; BORDER-TOP: #4f6228 1pt dashed; MARGIN-RIGHT: 0in; BORDER-RIGHT: #4f6228 1pt dashed; PADDING-TOP: 5pt; mso-border-alt: dash-small-gap #4F6228 .5pt; mso-border-themecolor: accent3; mso-border-themeshade: 128; mso-element: para-border-div"&gt;
&lt;P style="MARGIN: 12pt 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpFirst&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;private&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; PopUp_Opened(&lt;SPAN style="COLOR: blue"&gt;object&lt;/SPAN&gt; sender, &lt;SPAN style="COLOR: #2b91af"&gt;EventArgs&lt;/SPAN&gt; e)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; (!&lt;SPAN style="COLOR: blue"&gt;this&lt;/SPAN&gt;.IsDropDownOpen)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;this&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;.IsDropDownOpen = &lt;SPAN style="COLOR: blue"&gt;true&lt;/SPAN&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;…&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 12pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpLast&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;Notice the bug?&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;The bug lies in PopUp_Opened when setting IsDropDownOpen to a local value.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;This really appears harmless and you probably won’t actually see the bug in action until you hand it over to the app developer who will actually set different value providers on your control DPs.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;The problem is that setting a DP locally as an internal operation in your control will trump any and all value providers set on that DP (as local is the highest precedence).&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;That means that the app developer who uses your control and decides to put some fancy styles, binding, triggers, and all that goodness will find that it will stop working for some reason and not immediately know what caused it. &lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;To further describe how this can occur, here is an example using that same DatePicker (note that this has already been fixed in later version of the toolkit).&lt;/FONT&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;DIV style="BORDER-BOTTOM: #4f6228 1pt dashed; BORDER-LEFT: #4f6228 1pt dashed; PADDING-BOTTOM: 5pt; PADDING-LEFT: 5pt; PADDING-RIGHT: 5pt; BACKGROUND: #f6f5f0; MARGIN-LEFT: 0.1in; BORDER-TOP: #4f6228 1pt dashed; MARGIN-RIGHT: 0in; BORDER-RIGHT: #4f6228 1pt dashed; PADDING-TOP: 5pt; mso-border-alt: dash-small-gap #4F6228 .5pt; mso-border-themecolor: accent3; mso-border-themeshade: 128; mso-element: para-border-div"&gt;
&lt;P style="MARGIN: 12pt 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpFirst&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;Window.Resources&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;Style&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; x&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;Key&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;="DatePickerStyle"&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; TargetType&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;="{&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;x&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;Type&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; toolkit&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;DatePicker&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;}"&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;Setter&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; Property&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;="IsDropDownOpen"&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; Value&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;="{&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;Binding&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; ElementName&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;=cb_IsDropDownOpen,&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; Path&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;=IsChecked}" /&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;Style&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;Window.Resources&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;Grid&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;Grid.RowDefinitions&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;RowDefinition&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; Height&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;="Auto"/&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;RowDefinition&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; Height&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;="*"/&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;Grid.RowDefinitions&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;CheckBox&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; Content&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;="IsDropDownOpen"&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; Name&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;="cb_IsDropDownOpen" /&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;toolkit&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;DatePicker&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; Grid.Row&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;="1"&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 9"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Name&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;="datePicker"&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 9"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Style&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;="{&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;StaticResource&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; DatePickerStyle&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;}" /&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 12pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpLast&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;Grid&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;/FONT&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;I’ve setup a style on the DatePicker where I’ve bound a CheckBox.IsChecked DP to the DatePicker.IsDropDownOpen DP.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;If you click on the CheckBox, the popup opens as expected.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;If you take a look at the BaseValueSource on IsDropDownOpen it will read Style.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;However, as soon as you close the popup, the binding does not work anymore which is expected since a local value is set on IsDropDownOpen.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Summary&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;To make it really short and sweet, setting dependency properties to local values in internal operations of a control can lead to the dreaded control local values bug.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;I’m sure you’re next question is, how can this be prevented?&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Well, I will be doing a follow-up post on what has been added in dev10 to easily prevent this bug so stay tuned!&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;&lt;STRONG&gt;UPDATE&lt;/STRONG&gt;: Check out the follow up post &lt;A href="http://blogs.msdn.com/vinsibal/archive/2009/05/21/the-control-local-values-bug-solution-and-new-wpf-4-0-related-apis.aspx" mce_href="http://blogs.msdn.com/vinsibal/archive/2009/05/21/the-control-local-values-bug-solution-and-new-wpf-4-0-related-apis.aspx"&gt;here&lt;/A&gt;.&lt;/FONT&gt;&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9505118" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/vinsibal/archive/tags/ControlLocalValues/">ControlLocalValues</category><category domain="http://blogs.msdn.com/b/vinsibal/archive/tags/wpf+4-0/">wpf 4.0</category></item><item><title>WPFToolkit March 2009 Release and new WPF Themes!</title><link>http://blogs.msdn.com/b/vinsibal/archive/2009/03/20/wpftoolkit-march-2009-release-and-new-wpf-themes.aspx</link><pubDate>Fri, 20 Mar 2009 15:36:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9492352</guid><dc:creator>Vincent Sibal - MSFT</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/vinsibal/rsscomments.aspx?WeblogPostID=9492352</wfw:commentRss><comments>http://blogs.msdn.com/b/vinsibal/archive/2009/03/20/wpftoolkit-march-2009-release-and-new-wpf-themes.aspx#comments</comments><description>&lt;P&gt;An updated version of the &lt;A href="http://www.codeplex.com/wpf" mce_href="http://www.codeplex.com/wpf"&gt;WPFToolkit&lt;/A&gt; has been released today.&amp;nbsp; This includes&amp;nbsp;some high pri&amp;nbsp;bug fixes which are briefly described in the &lt;A href="http://wpf.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=24969" mce_href="http://wpf.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=24969"&gt;downloads&lt;/A&gt; tab.&amp;nbsp; As a reminder, if you have any questions or find any issues please use the &lt;A href="http://wpf.codeplex.com/Thread/List.aspx" mce_href="http://wpf.codeplex.com/Thread/List.aspx"&gt;Discussion list&lt;/A&gt; and the &lt;A href="http://wpf.codeplex.com/WorkItem/List.aspx" mce_href="http://wpf.codeplex.com/WorkItem/List.aspx"&gt;Issue Tracker&lt;/A&gt;.&amp;nbsp; Enjoy!&lt;/P&gt;
&lt;P&gt;Also,&amp;nbsp;a new set of WPF Themes has also been released in the &lt;A href="http://wpf.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=14962" mce_href="http://wpf.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=14962"&gt;WPF Futures&lt;/A&gt; section.&amp;nbsp; This is a collection of 9 themes that are also found in the &lt;A href="http://silverlight.codeplex.com/Wiki/View.aspx?title=Silverlight%20Toolkit%20Overview%20Part%203" mce_href="http://silverlight.codeplex.com/Wiki/View.aspx?title=Silverlight%20Toolkit%20Overview%20Part%203"&gt;Silverlight Toolkit&lt;/A&gt;.&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9492352" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/vinsibal/archive/tags/DataGrid/">DataGrid</category></item><item><title>Exploring MVVM: Grouping with the DataGrid</title><link>http://blogs.msdn.com/b/vinsibal/archive/2009/01/21/exploring-mvvm-grouping-with-the-datagrid.aspx</link><pubDate>Wed, 21 Jan 2009 16:46:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9356470</guid><dc:creator>Vincent Sibal - MSFT</dc:creator><slash:comments>9</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/vinsibal/rsscomments.aspx?WeblogPostID=9356470</wfw:commentRss><comments>http://blogs.msdn.com/b/vinsibal/archive/2009/01/21/exploring-mvvm-grouping-with-the-datagrid.aspx#comments</comments><description>&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;Model-View-ViewModel (MVVM) is one of those really interesting design patterns that are used in WPF.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;It provides a separation between the UI and business logic and uses data binding techniques to connect them together.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Karl Shifflett has some great material on MVVM that you can read about &lt;/FONT&gt;&lt;A href="http://karlshifflett.wordpress.com/mvvm/" mce_href="http://karlshifflett.wordpress.com/mvvm/"&gt;&lt;FONT face=Calibri size=3&gt;here&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Calibri size=3&gt;.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Anyway, I thought I’d dig into some of the details starting with grouping items in a DataGrid.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;I was originally building a test app for modeling animations of DependencyProperties and ended up using a DataGrid to show the DPs, their current values, and animation properties.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;I found that I really needed all the sorting, grouping, and filtering capabilities to analyze test values so I wanted to update the DataGrid and use the MVVM pattern (as much as possible).&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Grouping by column&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;To group by column I decided to use a context menu on the column header.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;In the context menu, the MenuItems are hooked up to commands on my ViewModel like so:&lt;/FONT&gt;&lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: #4f6228 1pt dashed; PADDING-RIGHT: 5pt; BORDER-TOP: #4f6228 1pt dashed; PADDING-LEFT: 5pt; BACKGROUND: #f6f5f0; PADDING-BOTTOM: 5pt; MARGIN-LEFT: 0.1in; BORDER-LEFT: #4f6228 1pt dashed; MARGIN-RIGHT: 0in; PADDING-TOP: 5pt; BORDER-BOTTOM: #4f6228 1pt dashed; mso-border-alt: dash-small-gap #4F6228 .5pt; mso-element: para-border-div; mso-border-themecolor: accent3; mso-border-themeshade: 128"&gt;
&lt;P class=codesampleCxSpFirst style="BACKGROUND: #f6f5f0; MARGIN: 12pt 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;ContextMenu&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; x&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Key&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="cm_columnHeaderMenu"&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;MenuItem&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Name&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="mi_group"&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 5"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Header&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="Group by this column"&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 5"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="BACKGROUND: yellow; mso-highlight: yellow"&gt;Command&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;="{&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;Binding&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt; RelativeSource&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;={&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;RelativeSource&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt; FindAncestor&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;,&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;&lt;SPAN style="mso-tab-count: 11"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;AncestorType&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;={&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;x&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;Type&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt; local&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;Window1&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;}},&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;&lt;SPAN style="mso-tab-count: 11"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Path&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;=DataContext.GroupColumn}"&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 7"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;CommandParameter&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="{&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Binding&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; RelativeSource&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;={&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;RelativeSource&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Self&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;},&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 11"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Path&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;=DataContext}"/&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;MenuItem&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Name&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="mi_clearGroups"&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Header&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="Clear grouping"&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 7"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="BACKGROUND: yellow; mso-highlight: yellow"&gt;Command&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;="{&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;Binding&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt; RelativeSource&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;={&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;RelativeSource&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt; FindAncestor&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;,&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;&lt;SPAN style="mso-tab-count: 11"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;AncestorType&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;={&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;x&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;Type&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt; local&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;Window1&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;}},&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;&lt;SPAN style="mso-tab-count: 11"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Path&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;=DataContext.UngroupColumns}"&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; /&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpLast style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 12pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;ContextMenu&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;My ViewModel is the DataContext for the main window and implements these commands with a MVVM commanding style introduced by &lt;/FONT&gt;&lt;A href="http://joshsmithonwpf.wordpress.com/" mce_href="http://joshsmithonwpf.wordpress.com/"&gt;&lt;FONT face=Calibri size=3&gt;Josh Smith&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Calibri size=3&gt; called RelayCommand.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;You can find it in his &lt;/FONT&gt;&lt;A href="http://joshsmithonwpf.wordpress.com/cracknet/" mce_href="http://joshsmithonwpf.wordpress.com/cracknet/"&gt;&lt;FONT face=Calibri size=3&gt;Crack.NET&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Calibri size=3&gt; solution as well as other MVVM samples &lt;/FONT&gt;&lt;A href="http://www.codeproject.com/KB/WPF/ExploringWPFMVVM.aspx" mce_href="http://www.codeproject.com/KB/WPF/ExploringWPFMVVM.aspx"&gt;&lt;FONT face=Calibri size=3&gt;here&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Calibri size=3&gt; and &lt;/FONT&gt;&lt;A href="http://www.codeproject.com/KB/WPF/InternationalizedWizard.aspx" mce_href="http://www.codeproject.com/KB/WPF/InternationalizedWizard.aspx"&gt;&lt;FONT face=Calibri size=3&gt;here&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Calibri size=3&gt;.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Here is the code for grouping:&lt;/FONT&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: #4f6228 1pt dashed; PADDING-RIGHT: 5pt; BORDER-TOP: #4f6228 1pt dashed; PADDING-LEFT: 5pt; BACKGROUND: #f6f5f0; PADDING-BOTTOM: 5pt; MARGIN-LEFT: 0.1in; BORDER-LEFT: #4f6228 1pt dashed; MARGIN-RIGHT: 0in; PADDING-TOP: 5pt; BORDER-BOTTOM: #4f6228 1pt dashed; mso-border-alt: dash-small-gap #4F6228 .5pt; mso-element: para-border-div; mso-border-themecolor: accent3; mso-border-themeshade: 128"&gt;
&lt;P class=codesampleCxSpFirst style="BACKGROUND: #f6f5f0; MARGIN: 12pt 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;public&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: #2b91af"&gt;ICommand&lt;/SPAN&gt; GroupColumn&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;{&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;get&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; (_groupColumn == &lt;SPAN style="COLOR: blue"&gt;null&lt;/SPAN&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 6"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;_groupColumn = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;RelayCommand&lt;/SPAN&gt;&amp;lt;&lt;SPAN style="COLOR: blue"&gt;object&lt;/SPAN&gt;&amp;gt;(&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 7"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;(param) =&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 7"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 8"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt; header = param &lt;SPAN style="COLOR: blue"&gt;as&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 8"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;DPCollection.GroupDescriptions.Add(&lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;PropertyGroupDescription&lt;/SPAN&gt;(&lt;SPAN style="COLOR: #a31515"&gt;"TargetProperty."&lt;/SPAN&gt; + header));&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 8"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;DPCollection.SortDescriptions.Add(&lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;SortDescription&lt;/SPAN&gt;(&lt;SPAN style="COLOR: #a31515"&gt;"TargetProperty.Name"&lt;/SPAN&gt;, &lt;SPAN style="COLOR: #2b91af"&gt;ListSortDirection&lt;/SPAN&gt;.Ascending));&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 7"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;});&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;return&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; _groupColumn;&lt;SPAN style="COLOR: blue"&gt;&lt;BR&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="mso-tab-count: 1"&gt; &lt;/SPAN&gt;}&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpLast style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 12pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;}&lt;/SPAN&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;/FONT&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;DPCollection is the CollectionView that I set on the DataGrid.ItemsSource.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;So triggering this command will set a group on a particular property and sort by its name.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;The important part is really how the command is being implemented in the ViewModel and through a delegate style of commanding such as RelayCommand.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Expanding and Collapsing Groups&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;I really wanted to follow a pattern similar to &lt;/FONT&gt;&lt;A href="http://www.codeproject.com/KB/WPF/TreeViewWithViewModel.aspx" mce_href="http://www.codeproject.com/KB/WPF/TreeViewWithViewModel.aspx"&gt;&lt;FONT face=Calibri size=3&gt;Josh’s&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Calibri size=3&gt; and &lt;/FONT&gt;&lt;A href="http://www.beacosta.com/blog/?p=55" mce_href="http://www.beacosta.com/blog/?p=55"&gt;&lt;FONT face=Calibri size=3&gt;Bea’s&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Calibri size=3&gt; TreeView examples but unfortunately the grouping implementation is not so extensible.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;When you setup GroupDescriptions, the ItemContainerGenerator of the ItemsControl will create these GroupItem visuals and will set the DataContext of each GroupItem to a CollectionViewGroupInternal object.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;This CollectionViewGroupInternal object holds information about the items in the group, its name, count, etc.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;The xaml for my GroupStyle without custom expanding or collapsing looks like this:&lt;/FONT&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: #4f6228 1pt dashed; PADDING-RIGHT: 5pt; BORDER-TOP: #4f6228 1pt dashed; PADDING-LEFT: 5pt; BACKGROUND: #f6f5f0; PADDING-BOTTOM: 5pt; MARGIN-LEFT: 0.1in; BORDER-LEFT: #4f6228 1pt dashed; MARGIN-RIGHT: 0in; PADDING-TOP: 5pt; BORDER-BOTTOM: #4f6228 1pt dashed; mso-border-alt: dash-small-gap #4F6228 .5pt; mso-element: para-border-div; mso-border-themecolor: accent3; mso-border-themeshade: 128"&gt;
&lt;P class=codesampleCxSpFirst style="BACKGROUND: #f6f5f0; MARGIN: 12pt 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;GroupStyle&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; x&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Key&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="gs_Default"&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;GroupStyle.HeaderTemplate&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;DataTemplate&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;StackPanel&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 5"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;TextBlock&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Text&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="{&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Binding&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Path&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;=Name}"&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;/&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;StackPanel&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;DataTemplate&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;GroupStyle.HeaderTemplate&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;GroupStyle.ContainerStyle&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Style&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; TargetType&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="{&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;x&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Type&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; GroupItem&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;}"&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Setter&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Property&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="Template"&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 5"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Setter.Value&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 6"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;ControlTemplate&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; TargetType&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="{&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;x&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Type&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; GroupItem&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;}"&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 7"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="BACKGROUND: yellow; mso-highlight: yellow"&gt;&amp;lt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;Expander&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt; IsExpanded&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;="{&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;Binding&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt; Path&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;=??}"&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 7"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Expander.Header&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 8"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;DockPanel&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; TextBlock.FontWeight&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="Bold"&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 8"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;TextBlock&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Text&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="{&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Binding&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Path&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;=Name}"&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;/&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 8"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;TextBlock&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Text&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="{&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Binding&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Path&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;=ItemCount}"/&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 8"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;DockPanel&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 7"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Expander.Header&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 7"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;ItemsPresenter&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; /&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 6"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Expander&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 6"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;ControlTemplate&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Setter.Value&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Setter&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Style&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;GroupStyle.ContainerStyle&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpLast style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 12pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;GroupStyle&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;Notice the properties “Name” and “ItemCount” which are properties on the CollectionViewGroup which is a base class of CollectionViewGroupInternal.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Also notice the Expander.IsExpanded property.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;I needed some way to bind some kind of ViewModel property to Expander.IsExpanded.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;The problem is that CollectionViewGroupInternal is Internal as you might have suspected and I was unsuccessful in applying a class adaptor to the base class object without affecting the grouping functionality. &lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;So I decided to put an IsExpanded property directly on each of the items instead.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;While this is more of a hack as IsExpanded means nothing to the item by itself, it is relatively cheaper and really may be a more realistic solution than re-implementing grouping on a custom CollectionView.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;Here is the updated xaml:&lt;/FONT&gt;&lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: #4f6228 1pt dashed; PADDING-RIGHT: 5pt; BORDER-TOP: #4f6228 1pt dashed; PADDING-LEFT: 5pt; BACKGROUND: #f6f5f0; PADDING-BOTTOM: 5pt; MARGIN-LEFT: 0.1in; BORDER-LEFT: #4f6228 1pt dashed; MARGIN-RIGHT: 0in; PADDING-TOP: 5pt; BORDER-BOTTOM: #4f6228 1pt dashed; mso-border-alt: dash-small-gap #4F6228 .5pt; mso-element: para-border-div; mso-border-themecolor: accent3; mso-border-themeshade: 128"&gt;
&lt;P class=codesampleCxSpFirst style="BACKGROUND: #f6f5f0; MARGIN: 12pt 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;GroupStyle&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; x&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Key&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="gs_Default"&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;GroupStyle.HeaderTemplate&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;DataTemplate&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;StackPanel&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 5"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;TextBlock&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Text&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="{&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Binding&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Path&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;=Name}"&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;/&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;StackPanel&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;DataTemplate&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;GroupStyle.HeaderTemplate&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;GroupStyle.ContainerStyle&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Style&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; TargetType&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="{&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;x&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Type&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; GroupItem&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;}"&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Setter&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Property&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="Template"&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 5"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Setter.Value&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 6"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;ControlTemplate&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; TargetType&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="{&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;x&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Type&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; GroupItem&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;}"&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 7"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="BACKGROUND: yellow; mso-highlight: yellow"&gt;&amp;lt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;Expander&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt; IsExpanded&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;="{&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;Binding&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt; Path&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;=Items[&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;0&lt;SPAN style="COLOR: blue"&gt;].IsExpanded}"&amp;gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 7"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Expander.Header&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 8"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;DockPanel&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; TextBlock.FontWeight&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="Bold"&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 8"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;TextBlock&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Text&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="{&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Binding&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Path&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;=Name}"&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;/&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 8"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;TextBlock&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Text&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="{&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Binding&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Path&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;=ItemCount}"/&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 8"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;DockPanel&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 7"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Expander.Header&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 7"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;ItemsPresenter&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; /&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 6"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Expander&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 6"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;ControlTemplate&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Setter.Value&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Setter&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Style&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;GroupStyle.ContainerStyle&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpLast style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 12pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;GroupStyle&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;I have made the assumption that it will check the first item in the group but that is ok as I only care able expanding or collapsing all groups.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;When I clear grouping or group a different column, all IsExpanded properties are reset so there are no side effects on the next group.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;Finally, the command for expanding looks like this:&lt;/FONT&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: #4f6228 1pt dashed; PADDING-RIGHT: 5pt; BORDER-TOP: #4f6228 1pt dashed; PADDING-LEFT: 5pt; BACKGROUND: #f6f5f0; PADDING-BOTTOM: 5pt; MARGIN-LEFT: 0.1in; BORDER-LEFT: #4f6228 1pt dashed; MARGIN-RIGHT: 0in; PADDING-TOP: 5pt; BORDER-BOTTOM: #4f6228 1pt dashed; mso-border-alt: dash-small-gap #4F6228 .5pt; mso-element: para-border-div; mso-border-themecolor: accent3; mso-border-themeshade: 128"&gt;
&lt;P class=codesampleCxSpFirst style="BACKGROUND: #f6f5f0; MARGIN: 12pt 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;public&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: #2b91af"&gt;ICommand&lt;/SPAN&gt; ExpandAllGroups&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;get&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; (_expandAllGroups == &lt;SPAN style="COLOR: blue"&gt;null&lt;/SPAN&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;_expandAllGroups = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;RelayCommand&lt;/SPAN&gt;(&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 5"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;() =&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 5"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 6"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; (DPCollection.Groups != &lt;SPAN style="COLOR: blue"&gt;null&lt;/SPAN&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 6"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 7"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;foreach&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; (&lt;SPAN style="COLOR: blue"&gt;object&lt;/SPAN&gt; groupItem &lt;SPAN style="COLOR: blue"&gt;in&lt;/SPAN&gt; DPCollection.Groups)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 7"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 8"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; group = groupItem &lt;SPAN style="COLOR: blue"&gt;as&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;CollectionViewGroup&lt;/SPAN&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 8"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;group.Items[0] &lt;SPAN style="COLOR: blue"&gt;as&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;ElementViewModel&lt;/SPAN&gt;).IsExpanded = &lt;SPAN style="COLOR: blue"&gt;true&lt;/SPAN&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 7"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;SPAN style="COLOR: blue"&gt;&lt;BR&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="mso-tab-count: 5"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 5"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;});&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;return&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; _expandAllGroups;&lt;SPAN style="COLOR: blue"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;}&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpLast style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 12pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;}&lt;/SPAN&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;I have attached a full sample &lt;A class="" href="http://blogs.msdn.com/vinsibal/attachment/9356470.ashx" mce_href="http://blogs.msdn.com/vinsibal/attachment/9356470.ashx"&gt;here&lt;/A&gt;, which is a stripped down version of the test app I was building.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9356470" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-components-postattachments/00-09-35-64-70/DataGrid_5F00_V1_5F00_GroupingSample.zip" length="29451" type="application/x-zip-compressed" /><category domain="http://blogs.msdn.com/b/vinsibal/archive/tags/DataGrid/">DataGrid</category><category domain="http://blogs.msdn.com/b/vinsibal/archive/tags/DataGrid+Samples/">DataGrid Samples</category><category domain="http://blogs.msdn.com/b/vinsibal/archive/tags/MVVM/">MVVM</category></item><item><title>WPF DataGrid Sample: Locking input to the row being edited</title><link>http://blogs.msdn.com/b/vinsibal/archive/2008/12/18/wpf-datagrid-sample-locking-input-to-the-row-being-edited.aspx</link><pubDate>Thu, 18 Dec 2008 19:45:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9236501</guid><dc:creator>Vincent Sibal - MSFT</dc:creator><slash:comments>5</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/vinsibal/rsscomments.aspx?WeblogPostID=9236501</wfw:commentRss><comments>http://blogs.msdn.com/b/vinsibal/archive/2008/12/18/wpf-datagrid-sample-locking-input-to-the-row-being-edited.aspx#comments</comments><description>&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Scenario &lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;By default the WPF DataGrid will commit a row when focus is lost on the row, the ‘Enter’ key is pressed, tabbing to the next row, or programmatically calling commit on the row.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Let’s say I want to control how the user commits a row edit by locking input to just that row being edited and having a filtered set of input or a single input of my choosing that will commit that row.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Implementation&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;There are no configuration APIs on the DataGrid that allow you to tell it what input will commit a row, but there are events that allow you to cancel editing operations as you so choose.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;So we can work around that.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Another thing we will have to do is keep track of the editing state of the DataGrid.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;With this extra flag, we can also use it to disable other rows while the current row is being edited.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;You can subclass DataGrid and add functionality that may be more generalized but for this sample I’m just going to use a UserControl.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Here is the flag that I will use which is a DP so it can be used in the DataGridRow style.&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: #4f6228 1pt dashed; PADDING-RIGHT: 5pt; BORDER-TOP: #4f6228 1pt dashed; PADDING-LEFT: 5pt; BACKGROUND: #f6f5f0; PADDING-BOTTOM: 5pt; MARGIN-LEFT: 0.1in; BORDER-LEFT: #4f6228 1pt dashed; MARGIN-RIGHT: 0in; PADDING-TOP: 5pt; BORDER-BOTTOM: #4f6228 1pt dashed; mso-border-alt: dash-small-gap #4f6228 .5pt; mso-element: para-border-div; mso-border-themecolor: accent3; mso-border-themeshade: 128"&gt;
&lt;P class=codesampleCxSpFirst style="BACKGROUND: #f6f5f0; MARGIN: 12pt 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;public&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: blue"&gt;partial&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;class&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;CustomDataGrid&lt;/SPAN&gt; : &lt;SPAN style="COLOR: #2b91af"&gt;UserControl&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;{&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;public&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: blue"&gt;bool&lt;/SPAN&gt; IsEditingRow&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;{&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;get&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; { &lt;SPAN style="COLOR: blue"&gt;return&lt;/SPAN&gt; (&lt;SPAN style="COLOR: blue"&gt;bool&lt;/SPAN&gt;)GetValue(EditingRowProperty); }&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;set&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; { SetValue(EditingRowProperty, &lt;SPAN style="COLOR: blue"&gt;value&lt;/SPAN&gt;); }&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;public&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: blue"&gt;static&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;readonly&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;DependencyProperty&lt;/SPAN&gt; EditingRowProperty =&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;DependencyProperty&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;.Register(&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 5"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;"IsEditingRow"&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;,&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 5"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;typeof&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;(&lt;SPAN style="COLOR: blue"&gt;bool&lt;/SPAN&gt;),&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 5"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;typeof&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;(&lt;SPAN style="COLOR: #2b91af"&gt;CustomDataGrid&lt;/SPAN&gt;),&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;FrameworkPropertyMetadata&lt;/SPAN&gt;(&lt;SPAN style="COLOR: blue"&gt;false&lt;/SPAN&gt;, &lt;SPAN style="COLOR: blue"&gt;null&lt;/SPAN&gt;, &lt;SPAN style="COLOR: blue"&gt;null&lt;/SPAN&gt;));&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpLast style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 12pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;}&lt;/SPAN&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;This flag is going to be used such that anytime a row is being edited, other rows will be disabled and you can only commit through an input that I choose.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;To disable the rows we can add something like this in the row’s style:&lt;/FONT&gt;&lt;/FONT&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: #4f6228 1pt dashed; PADDING-RIGHT: 5pt; BORDER-TOP: #4f6228 1pt dashed; PADDING-LEFT: 5pt; BACKGROUND: #f6f5f0; PADDING-BOTTOM: 5pt; MARGIN-LEFT: 0.1in; BORDER-LEFT: #4f6228 1pt dashed; MARGIN-RIGHT: 0in; PADDING-TOP: 5pt; BORDER-BOTTOM: #4f6228 1pt dashed; mso-border-alt: dash-small-gap #4f6228 .5pt; mso-element: para-border-div; mso-border-themecolor: accent3; mso-border-themeshade: 128"&gt;
&lt;P class=codesampleCxSpFirst style="BACKGROUND: #f6f5f0; MARGIN: 12pt 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Style&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; TargetType&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="{&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;x&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Type&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; dg&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;DataGridRow&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;}"&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Style.Triggers&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;MultiDataTrigger&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;MultiDataTrigger.Conditions&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 5"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Condition&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Binding&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="{&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Binding&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; RelativeSource&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;={&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;RelativeSource&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; FindAncestor&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;,&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; AncestorType&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;={&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;x&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Type&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; local&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;CustomDataGrid&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;}},&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Path&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;=IsEditingRow}"&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Value&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="True" /&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 5"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Condition&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Binding&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="{&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Binding&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; RelativeSource&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;={&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;RelativeSource&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Self&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;},&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Path&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;=IsEditing}"&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Value&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="False" /&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;MultiDataTrigger.Conditions&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Setter&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Property&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="IsEnabled"&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Value&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="False"/&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Setter&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Property&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="Foreground"&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Value&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="LightGray"/&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;MultiDataTrigger&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Style.Triggers&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpLast style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 12pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Style&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;For naming purposes I probably should have called it IsInEditMode to differentiate but please indulge me for now.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;So anyway, if the DataGrid is editing a row and the particular row is not in edit mode it will be disabled.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;Now, for the logic, two important events for this scenario are:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpFirst style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="FONT-FAMILY: symbol; mso-bidi-font-family: symbol; mso-fareast-font-family: symbol"&gt;&lt;SPAN style="mso-list: ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;DataGrid.BeginningEdit&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpLast style="MARGIN: 0in 0in 10pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="FONT-FAMILY: symbol; mso-bidi-font-family: symbol; mso-fareast-font-family: symbol"&gt;&lt;SPAN style="mso-list: ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;DataGrid.RowEditEnding&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;BeginninigEdit will be used to set the IsEditingRow flag as well as cancel a BeginEdit operation when trying to open a different row for edit while still editing the current row.&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: #4f6228 1pt dashed; PADDING-RIGHT: 5pt; BORDER-TOP: #4f6228 1pt dashed; PADDING-LEFT: 5pt; BACKGROUND: #f6f5f0; PADDING-BOTTOM: 5pt; MARGIN-LEFT: 0.1in; BORDER-LEFT: #4f6228 1pt dashed; MARGIN-RIGHT: 0in; PADDING-TOP: 5pt; BORDER-BOTTOM: #4f6228 1pt dashed; mso-border-alt: dash-small-gap #4f6228 .5pt; mso-element: para-border-div; mso-border-themecolor: accent3; mso-border-themeshade: 128"&gt;
&lt;P class=codesampleCxSpFirst style="BACKGROUND: #f6f5f0; MARGIN: 12pt 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;private&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; DataGrid_Standard_BeginningEdit(&lt;SPAN style="COLOR: blue"&gt;object&lt;/SPAN&gt; sender, &lt;SPAN style="COLOR: #2b91af"&gt;DataGridBeginningEditEventArgs&lt;/SPAN&gt; e)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;{&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; (!IsEditingRow)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;{&lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: green; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;// set edit mode state&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;IsEditingRow = &lt;SPAN style="COLOR: blue"&gt;true&lt;/SPAN&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;_currentEditingRow = e.Row;&lt;SPAN style="COLOR: blue"&gt;&lt;BR&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="mso-tab-count: 1"&gt; &lt;/SPAN&gt;}&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;else&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: blue"&gt;if&lt;/SPAN&gt; (e.Row != _currentEditingRow)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: green; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;// cancel all new edits for different rows&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;e.Cancel = &lt;SPAN style="COLOR: blue"&gt;true&lt;/SPAN&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpLast style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 12pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;}&lt;/SPAN&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;RowEditEnding will be used to cancel a commit if IsEditingRow is true.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;It also resets when the row edit is cancelled.&lt;/FONT&gt;&lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: #4f6228 1pt dashed; PADDING-RIGHT: 5pt; BORDER-TOP: #4f6228 1pt dashed; PADDING-LEFT: 5pt; BACKGROUND: #f6f5f0; PADDING-BOTTOM: 5pt; MARGIN-LEFT: 0.1in; BORDER-LEFT: #4f6228 1pt dashed; MARGIN-RIGHT: 0in; PADDING-TOP: 5pt; BORDER-BOTTOM: #4f6228 1pt dashed; mso-border-alt: dash-small-gap #4f6228 .5pt; mso-element: para-border-div; mso-border-themecolor: accent3; mso-border-themeshade: 128"&gt;
&lt;P class=codesampleCxSpFirst style="BACKGROUND: #f6f5f0; MARGIN: 12pt 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;private&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; DataGrid_Standard_RowEditEnding(&lt;SPAN style="COLOR: blue"&gt;object&lt;/SPAN&gt; sender, &lt;SPAN style="COLOR: #2b91af"&gt;DataGridRowEditEndingEventArgs&lt;/SPAN&gt; e)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;{&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; (e.EditAction == &lt;SPAN style="COLOR: #2b91af"&gt;DataGridEditAction&lt;/SPAN&gt;.Cancel)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: green; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;// cancelling the entire row will reset the state&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;IsEditingRow = &lt;SPAN style="COLOR: blue"&gt;false&lt;/SPAN&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;else&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: blue"&gt;if&lt;/SPAN&gt; (e.EditAction == &lt;SPAN style="COLOR: #2b91af"&gt;DataGridEditAction&lt;/SPAN&gt;.Commit)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;e.Cancel = IsEditingRow;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpLast style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 12pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;}&lt;/SPAN&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;So for this workaround, it is really based on how you want to manipulate IsEditingRow.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;For this sample, I want to commit a row only when the ‘Enter’ key is pressed.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;I can do that by listening to the PreviewKeyDown event and setting IsEditingRow to false for the ‘Enter’ key.&lt;/FONT&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: #4f6228 1pt dashed; PADDING-RIGHT: 5pt; BORDER-TOP: #4f6228 1pt dashed; PADDING-LEFT: 5pt; BACKGROUND: #f6f5f0; PADDING-BOTTOM: 5pt; MARGIN-LEFT: 0.1in; BORDER-LEFT: #4f6228 1pt dashed; MARGIN-RIGHT: 0in; PADDING-TOP: 5pt; BORDER-BOTTOM: #4f6228 1pt dashed; mso-border-alt: dash-small-gap #4f6228 .5pt; mso-element: para-border-div; mso-border-themecolor: accent3; mso-border-themeshade: 128"&gt;
&lt;P class=codesampleCxSpFirst style="BACKGROUND: #f6f5f0; MARGIN: 12pt 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;private&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; DataGrid_Standard_PreviewKeyDown(&lt;SPAN style="COLOR: blue"&gt;object&lt;/SPAN&gt; sender, &lt;SPAN style="COLOR: #2b91af"&gt;KeyEventArgs&lt;/SPAN&gt; e)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;{&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;DataGridRow&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; row = GetRow(DataGrid_Standard, DataGrid_Standard.Items.IndexOf(DataGrid_Standard.CurrentItem));&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; (row.IsEditing &amp;amp;&amp;amp; e.Key == &lt;SPAN style="COLOR: #2b91af"&gt;Key&lt;/SPAN&gt;.Enter)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: green; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;// only 'Enter' key on an editing row will allow a commit to occur&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;IsEditingRow = &lt;SPAN style="COLOR: blue"&gt;false&lt;/SPAN&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpLast style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 12pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;}&lt;/SPAN&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;That’s basically it.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;If you try out the sample you will see that when you open a row for edit, the rest of the rows will be disabled and the only way to commit is through the ‘Enter’ key.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;&lt;A href="http://blogs.msdn.com/blogfiles/vinsibal/WindowsLiveWriter/WPFDataGridSampleLockinginputtotherowbei_7CB7/LockingEditMode_2.jpg" mce_href="http://blogs.msdn.com/blogfiles/vinsibal/WindowsLiveWriter/WPFDataGridSampleLockinginputtotherowbei_7CB7/LockingEditMode_2.jpg"&gt;&lt;IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=453 alt=LockingEditMode src="http://blogs.msdn.com/blogfiles/vinsibal/WindowsLiveWriter/WPFDataGridSampleLockinginputtotherowbei_7CB7/LockingEditMode_thumb.jpg" width=712 border=0 mce_src="http://blogs.msdn.com/blogfiles/vinsibal/WindowsLiveWriter/WPFDataGridSampleLockinginputtotherowbei_7CB7/LockingEditMode_thumb.jpg"&gt;&lt;/A&gt; &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Let’s say ‘Enter’ to commit is not the functionality you want.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Instead you want to commit using a specific button.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;In that case you can listen to the click event or setup a command and set IsEditingRow accordingly based on your specific conditions.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;You can download the full sample &lt;A class="" href="http://blogs.msdn.com/vinsibal/attachment/9236501.ashx" mce_href="http://blogs.msdn.com/vinsibal/attachment/9236501.ashx"&gt;here&lt;/A&gt;.&lt;/FONT&gt;&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9236501" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-components-postattachments/00-09-23-65-01/DataGridSample_5F00_LockingRowInEditMode.zip" length="27907" type="application/x-zip-compressed" /><category domain="http://blogs.msdn.com/b/vinsibal/archive/tags/DataGrid/">DataGrid</category><category domain="http://blogs.msdn.com/b/vinsibal/archive/tags/DataGrid+Samples/">DataGrid Samples</category></item><item><title>WPF DataGrid – Dynamically updating DataGridComboBoxColumn</title><link>http://blogs.msdn.com/b/vinsibal/archive/2008/12/17/wpf-datagrid-dynamically-updating-datagridcomboboxcolumn.aspx</link><pubDate>Wed, 17 Dec 2008 19:07:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9231085</guid><dc:creator>Vincent Sibal - MSFT</dc:creator><slash:comments>11</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/vinsibal/rsscomments.aspx?WeblogPostID=9231085</wfw:commentRss><comments>http://blogs.msdn.com/b/vinsibal/archive/2008/12/17/wpf-datagrid-dynamically-updating-datagridcomboboxcolumn.aspx#comments</comments><description>&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;The Scenario&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;I want to do a master detail like scenario where the selection in one ComboBox cell will update the list of items in the next ComboBox cell and so on.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/B&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Setting up the DataSource and ViewModel&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;I will use the Northwind database for this example and will use the first column to select a Category within the Categories table.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;A href="http://blogs.msdn.com/blogfiles/vinsibal/WindowsLiveWriter/WPFDataGridDynamicallyupdatingDataGridCo_74F9/ComboBoxSample1_2.jpg" mce_href="http://blogs.msdn.com/blogfiles/vinsibal/WindowsLiveWriter/WPFDataGridDynamicallyupdatingDataGridCo_74F9/ComboBoxSample1_2.jpg"&gt;&lt;IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=227 alt=ComboBoxSample1 src="http://blogs.msdn.com/blogfiles/vinsibal/WindowsLiveWriter/WPFDataGridDynamicallyupdatingDataGridCo_74F9/ComboBoxSample1_thumb.jpg" width=326 border=0 mce_src="http://blogs.msdn.com/blogfiles/vinsibal/WindowsLiveWriter/WPFDataGridDynamicallyupdatingDataGridCo_74F9/ComboBoxSample1_thumb.jpg"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;The second column will have a ComboBox to select all the Products within the selected Category.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;A href="http://blogs.msdn.com/blogfiles/vinsibal/WindowsLiveWriter/WPFDataGridDynamicallyupdatingDataGridCo_74F9/ComboBoxSample2_2.jpg" mce_href="http://blogs.msdn.com/blogfiles/vinsibal/WindowsLiveWriter/WPFDataGridDynamicallyupdatingDataGridCo_74F9/ComboBoxSample2_2.jpg"&gt;&lt;IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=258 alt=ComboBoxSample2 src="http://blogs.msdn.com/blogfiles/vinsibal/WindowsLiveWriter/WPFDataGridDynamicallyupdatingDataGridCo_74F9/ComboBoxSample2_thumb.jpg" width=322 border=0 mce_src="http://blogs.msdn.com/blogfiles/vinsibal/WindowsLiveWriter/WPFDataGridDynamicallyupdatingDataGridCo_74F9/ComboBoxSample2_thumb.jpg"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;And the third column will have a ComboBox to select all the orders that were placed on the selected Product.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;&lt;A href="http://blogs.msdn.com/blogfiles/vinsibal/WindowsLiveWriter/WPFDataGridDynamicallyupdatingDataGridCo_74F9/ComboBoxSample3_2.jpg" mce_href="http://blogs.msdn.com/blogfiles/vinsibal/WindowsLiveWriter/WPFDataGridDynamicallyupdatingDataGridCo_74F9/ComboBoxSample3_2.jpg"&gt;&lt;IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=264 alt=ComboBoxSample3 src="http://blogs.msdn.com/blogfiles/vinsibal/WindowsLiveWriter/WPFDataGridDynamicallyupdatingDataGridCo_74F9/ComboBoxSample3_thumb.jpg" width=396 border=0 mce_src="http://blogs.msdn.com/blogfiles/vinsibal/WindowsLiveWriter/WPFDataGridDynamicallyupdatingDataGridCo_74F9/ComboBoxSample3_thumb.jpg"&gt;&lt;/A&gt; &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;The ViewModel that I will use on each DataGrid item will have the properties: &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpFirst style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="FONT-FAMILY: symbol; mso-bidi-font-family: symbol; mso-fareast-font-family: symbol"&gt;&lt;SPAN style="mso-list: ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;CurrentCategory&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="FONT-FAMILY: symbol; mso-bidi-font-family: symbol; mso-fareast-font-family: symbol"&gt;&lt;SPAN style="mso-list: ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;CurrentProduct&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="FONT-FAMILY: symbol; mso-bidi-font-family: symbol; mso-fareast-font-family: symbol"&gt;&lt;SPAN style="mso-list: ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;CurrentOrder &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="FONT-FAMILY: symbol; mso-bidi-font-family: symbol; mso-fareast-font-family: symbol"&gt;&lt;SPAN style="mso-list: ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;ProductsInCategory&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpLast style="MARGIN: 0in 0in 10pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="FONT-FAMILY: symbol; mso-bidi-font-family: symbol; mso-fareast-font-family: symbol"&gt;&lt;SPAN style="mso-list: ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;OrdersFromProduct &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Each time CurrentCategory is updated, ProductsInCategory will be updated as well to create the new list of products.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;When CurrentProduct is updated, OrdersFromProduct will be updated in a similar fashion.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;So for example, CurrentCategory will look like this:&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: #4f6228 1pt dashed; PADDING-RIGHT: 5pt; BORDER-TOP: #4f6228 1pt dashed; PADDING-LEFT: 5pt; BACKGROUND: #f6f5f0; PADDING-BOTTOM: 5pt; MARGIN-LEFT: 0.1in; BORDER-LEFT: #4f6228 1pt dashed; MARGIN-RIGHT: 0in; PADDING-TOP: 5pt; BORDER-BOTTOM: #4f6228 1pt dashed; mso-border-alt: dash-small-gap #4f6228 .5pt; mso-element: para-border-div; mso-border-themecolor: accent3; mso-border-themeshade: 128"&gt;
&lt;P class=codesampleCxSpFirst style="BACKGROUND: #f6f5f0; MARGIN: 12pt 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;public&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: blue"&gt;int&lt;/SPAN&gt; CurrentCategory&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;{&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;get&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; { &lt;SPAN style="COLOR: blue"&gt;return&lt;/SPAN&gt; _currentCategory; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;set&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;_currentCategory = &lt;SPAN style="COLOR: blue"&gt;value&lt;/SPAN&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;ProductsInCategory = &lt;SPAN style="COLOR: #2b91af"&gt;DBAccess&lt;/SPAN&gt;.GetProductsInCategory(_currentCategory).Tables[&lt;SPAN style="COLOR: #a31515"&gt;"Products"&lt;/SPAN&gt;].DefaultView;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;OnPropertyChanged(&lt;SPAN style="COLOR: #a31515"&gt;"CurrentCategory"&lt;/SPAN&gt;);&lt;SPAN style="COLOR: blue"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;}&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpLast style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 12pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;}&lt;/SPAN&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;GetProductsInCategory() does a query on the database passing in the category id.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;I will not go over the database querying implementation here.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/B&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Hooking up to the UI&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;For the first DataGridComboBoxColumn, the ComboBox.ItemsSource will bind to the Categories DataTable through a StaticResource.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;The binding on the column will be set to the CurrentCategory.&lt;/FONT&gt;&lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: #4f6228 1pt dashed; PADDING-RIGHT: 5pt; BORDER-TOP: #4f6228 1pt dashed; PADDING-LEFT: 5pt; BACKGROUND: #f6f5f0; PADDING-BOTTOM: 5pt; MARGIN-LEFT: 0.1in; BORDER-LEFT: #4f6228 1pt dashed; MARGIN-RIGHT: 0in; PADDING-TOP: 5pt; BORDER-BOTTOM: #4f6228 1pt dashed; mso-border-alt: dash-small-gap #4f6228 .5pt; mso-element: para-border-div; mso-border-themecolor: accent3; mso-border-themeshade: 128"&gt;
&lt;P class=codesampleCxSpFirst style="BACKGROUND: #f6f5f0; MARGIN: 12pt 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;dg&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;DataGridComboBoxColumn&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Header&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="Current Category"&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;SelectedValueBinding&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="{&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Binding&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Path&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;=CurrentCategory}"&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;SelectedValuePath&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="CategoryID"&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;DisplayMemberPath&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="CategoryName"&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;ItemsSource&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="{&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Binding&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Source&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;={&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;StaticResource&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; categoriesDataProvider&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;}}"&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpLast style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 12pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;dg&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;DataGridComboBoxColumn&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;The other DataGridComboBoxColumns will have to take a slightly different approach.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Let’s say we do something like this:&lt;/FONT&gt;&lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: #4f6228 1pt dashed; PADDING-RIGHT: 5pt; BORDER-TOP: #4f6228 1pt dashed; PADDING-LEFT: 5pt; BACKGROUND: #f6f5f0; PADDING-BOTTOM: 5pt; MARGIN-LEFT: 0.1in; BORDER-LEFT: #4f6228 1pt dashed; MARGIN-RIGHT: 0in; PADDING-TOP: 5pt; BORDER-BOTTOM: #4f6228 1pt dashed; mso-border-alt: dash-small-gap #4f6228 .5pt; mso-element: para-border-div; mso-border-themecolor: accent3; mso-border-themeshade: 128"&gt;
&lt;P class=codesampleCxSpFirst style="BACKGROUND: #f6f5f0; MARGIN: 12pt 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: green; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;&amp;lt;!--NOT CORRECT--&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;dg&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;DataGridComboBoxColumn&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Header&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="Current Product"&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;SelectedValueBinding&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="{&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Binding&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Path&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;=CurrentProduct}"&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;SelectedValuePath&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="ProductID"&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;DisplayMemberPath&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="ProductName"&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="BACKGROUND: yellow; mso-highlight: yellow"&gt;ItemsSource&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;="{&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;Binding&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt; Path&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;=ProductsInCategory}"&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpLast style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 12pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;dg&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;DataGridComboBoxColumn&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;/FONT&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;It does seem more intuitive to take this approach however DataGridColumns are not actually part of the visual tree and only the Binding DPs will actually be set on generated cell elements to inherit DataGrid’s DataContext.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;That means that the binding for ItemsSource will fail as it won’t be able to find path, ProductsInCategory, that it is current set.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;Aside: &lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;Jaime wrote this nice &lt;/FONT&gt;&lt;A href="http://blogs.msdn.com/jaimer/archive/2008/11/22/forwarding-the-datagrid-s-datacontext-to-its-columns.aspx" mce_href="http://blogs.msdn.com/jaimer/archive/2008/11/22/forwarding-the-datagrid-s-datacontext-to-its-columns.aspx"&gt;&lt;FONT face=Calibri size=3&gt;post&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Calibri size=3&gt; on how to set the DataContext for the columns to DataGrid’s DataContext, but I’m going to show an implementation here with just the default implementation.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;So what we want is for the ItemsSource to bind to the DataContext of the row on the DataGrid.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;We can do that by setting the binding on the actual generated element of the column through ElementStyle and EditingElementStyle.&lt;/FONT&gt;&lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: #4f6228 1pt dashed; PADDING-RIGHT: 5pt; BORDER-TOP: #4f6228 1pt dashed; PADDING-LEFT: 5pt; BACKGROUND: #f6f5f0; PADDING-BOTTOM: 5pt; MARGIN-LEFT: 0.1in; BORDER-LEFT: #4f6228 1pt dashed; MARGIN-RIGHT: 0in; PADDING-TOP: 5pt; BORDER-BOTTOM: #4f6228 1pt dashed; mso-border-alt: dash-small-gap #4f6228 .5pt; mso-element: para-border-div; mso-border-themecolor: accent3; mso-border-themeshade: 128"&gt;
&lt;P class=codesampleCxSpFirst style="BACKGROUND: #f6f5f0; MARGIN: 12pt 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: green; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;&amp;lt;!—now itemssource will find the correct DataContext--&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;dg&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;DataGridComboBoxColumn&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Header&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="Current Product"&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;SelectedValueBinding&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="{&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Binding&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Path&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;=CurrentProduct}"&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;SelectedValuePath&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="ProductID"&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;DisplayMemberPath&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="ProductName"&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="BACKGROUND: yellow; mso-highlight: yellow"&gt;&amp;lt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;dg&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;DataGridComboBoxColumn.ElementStyle&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;Style&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt; TargetType&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;="ComboBox"&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;Setter&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt; Property&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;="ItemsSource"&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt; Value&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;="{&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;Binding&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt; Path&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;=ProductsInCategory}" /&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;Style&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;dg&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;DataGridComboBoxColumn.ElementStyle&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;dg&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;DataGridComboBoxColumn.EditingElementStyle&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;Style&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt; TargetType&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;="ComboBox"&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;Setter&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt; Property&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;="ItemsSource"&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt; Value&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;="{&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;Binding&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt; Path&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;=ProductsInCategory}" /&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;Style&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;dg&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;DataGridComboBoxColumn.EditingElementStyle&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpLast style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 12pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;dg&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;DataGridComboBoxColumn&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;/FONT&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;This works because internally when the cell is being generated, the Content of the cell will have its layout updated which will make it part of the visual tree and it will have access to the correct DataContext.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Now the ItemsSource for the ComboBox will dynamically update each time CurrentCategory is changed.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;The DataGridComboBoxColumn for the CurrentOrder is similar to CurrentProduct so I will not show that here.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;You can download the sample &lt;A class="" href="http://blogs.msdn.com/vinsibal/attachment/9231085.ashx" mce_href="http://blogs.msdn.com/vinsibal/attachment/9231085.ashx"&gt;here&lt;/A&gt;.&lt;/FONT&gt;&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9231085" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-components-postattachments/00-09-23-10-85/DataGrid_5F00_ComboBoxColumnSamples_5F00_Dynamic.zip" length="438877" type="application/x-zip-compressed" /><category domain="http://blogs.msdn.com/b/vinsibal/archive/tags/DataGrid/">DataGrid</category><category domain="http://blogs.msdn.com/b/vinsibal/archive/tags/DataGrid+Samples/">DataGrid Samples</category></item><item><title>WPF TestApi and DataGrid Sample</title><link>http://blogs.msdn.com/b/vinsibal/archive/2008/12/10/wpf-testapi-and-datagrid-sample.aspx</link><pubDate>Wed, 10 Dec 2008 19:33:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9191609</guid><dc:creator>Vincent Sibal - MSFT</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/vinsibal/rsscomments.aspx?WeblogPostID=9191609</wfw:commentRss><comments>http://blogs.msdn.com/b/vinsibal/archive/2008/12/10/wpf-testapi-and-datagrid-sample.aspx#comments</comments><description>&lt;P&gt;&lt;SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin"&gt;Our WPF Test team has just released a library of tools that can be leveraged to test WPF applications.&amp;nbsp; What's really cool is that these are utilities that we use internally and now we can push them out to external customers for feedback and usage.&amp;nbsp; The library currently lives here on codeplex,&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"&gt; &lt;A href="http://www.codeplex.com/TestApi" mce_href="http://www.codeplex.com/TestApi"&gt;http://www.codeplex.com/TestApi&lt;/A&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin"&gt;.&amp;nbsp; There are a couple more blog posts where you can get more information about it.&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;A href="http://blogs.msdn.com/llobo/archive/2008/12/08/wpf-test-helper-library.aspx" mce_href="http://blogs.msdn.com/llobo/archive/2008/12/08/wpf-test-helper-library.aspx"&gt;http://blogs.msdn.com/llobo/archive/2008/12/08/wpf-test-helper-library.aspx&lt;/A&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: purple; FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;A href="http://blogs.msdn.com/wpfsdk/archive/2008/12/09/testapi-released.aspx" mce_href="http://blogs.msdn.com/wpfsdk/archive/2008/12/09/testapi-released.aspx"&gt;http://blogs.msdn.com/wpfsdk/archive/2008/12/09/testapi-released.aspx&lt;/A&gt;&lt;/SPAN&gt;&lt;/U&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin"&gt;The &lt;A href="http://www.codeplex.com/TestApi/Release/ProjectReleases.aspx?ReleaseId=20207" mce_href="http://www.codeplex.com/TestApi/Release/ProjectReleases.aspx?ReleaseId=20207"&gt;download&lt;/A&gt; contains some samples but I thought I would show a sample with one of the DataGrid applications instead.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;I made some small modifications to the SampleTestApp to get it working with one of my DataGrid samples.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;In this sample, I am doing a visual verification test to check that the rows and cells update to the correct visual state when in edit mode.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;I am using the in-proc, out of thread strategy which is similar to the strategy used in the visual verification in the SampleTestApp.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;To get the tests to work with the DataGridSample application, I needed to add automation id’s to some of the elements.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;In particular, the Window and the DataGrid:&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: #4f6228 1pt dashed; PADDING-RIGHT: 5pt; BORDER-TOP: #4f6228 1pt dashed; PADDING-LEFT: 5pt; BACKGROUND: #f6f5f0; PADDING-BOTTOM: 5pt; MARGIN-LEFT: 0.1in; BORDER-LEFT: #4f6228 1pt dashed; MARGIN-RIGHT: 0in; PADDING-TOP: 5pt; BORDER-BOTTOM: #4f6228 1pt dashed; mso-border-alt: dash-small-gap #4F6228 .5pt; mso-element: para-border-div; mso-border-themecolor: accent3; mso-border-themeshade: 128"&gt;
&lt;P class=codesampleCxSpFirst style="BACKGROUND: #f6f5f0; MARGIN: 12pt 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Window&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; x&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Class&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="DataGridSample.DataGridBasicSample"&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="BACKGROUND: yellow; mso-highlight: yellow"&gt;AutomationProperties.AutomationId&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="BACKGROUND: yellow; COLOR: blue; mso-highlight: yellow"&gt;="DataGridBasicSample"&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;…&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;dg&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;DataGrid&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; x&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Name&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="DataGrid_Standard"&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="BACKGROUND: yellow; COLOR: red; mso-highlight: yellow"&gt;AutomationProperties.AutomationId&lt;/SPAN&gt;&lt;SPAN style="BACKGROUND: yellow; COLOR: blue; mso-highlight: yellow"&gt;="DataGrid_Standard"&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;dg&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;DataGrid&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;…&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpLast style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 12pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Window&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;These IDs will be queried by my test in order to find the correct AutomationElements. &lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;And here is what the test will basically look like (left out logging and some error checking to make it more concise):&lt;/FONT&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: #4f6228 1pt dashed; PADDING-RIGHT: 5pt; BORDER-TOP: #4f6228 1pt dashed; PADDING-LEFT: 5pt; BACKGROUND: #f6f5f0; PADDING-BOTTOM: 5pt; MARGIN-LEFT: 0.1in; BORDER-LEFT: #4f6228 1pt dashed; MARGIN-RIGHT: 0in; PADDING-TOP: 5pt; BORDER-BOTTOM: #4f6228 1pt dashed; mso-border-alt: dash-small-gap #4F6228 .5pt; mso-element: para-border-div; mso-border-themecolor: accent3; mso-border-themeshade: 128"&gt;
&lt;P class=codesampleCxSpFirst style="BACKGROUND: #f6f5f0; MARGIN: 12pt 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: green; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;// retrieve the necessary AutomationElements&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;AutomationElement&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; window = &lt;SPAN style="COLOR: #2b91af"&gt;AutomationUtilities&lt;/SPAN&gt;.FindElementsById(&lt;SPAN style="COLOR: #2b91af"&gt;AutomationElement&lt;/SPAN&gt;.RootElement, &lt;SPAN style="COLOR: #a31515"&gt;"DataGridBasicSample"&lt;/SPAN&gt;)[0];&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;AutomationElement&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; dataGrid = &lt;SPAN style="COLOR: #2b91af"&gt;AutomationUtilities&lt;/SPAN&gt;.FindElementsById(window, &lt;SPAN style="COLOR: #a31515"&gt;"DataGrid_Standard"&lt;/SPAN&gt;)[0];&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;GridPattern&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; grid = dataGrid.GetCurrentPattern(&lt;SPAN style="COLOR: #2b91af"&gt;GridPattern&lt;/SPAN&gt;.Pattern) &lt;SPAN style="COLOR: blue"&gt;as&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;GridPattern&lt;/SPAN&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;AutomationElement&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; cell = grid.GetItem(0, 0);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: green; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;// do action for making cell editable&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;AutomationHelpers&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;.MoveToAndDoubleClick(cell);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: green; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;// Capture the actual pixels from the bounds of the screen rectangle&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Snapshot&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; actual = &lt;SPAN style="COLOR: #2b91af"&gt;Snapshot&lt;/SPAN&gt;.FromRectangle(&lt;SPAN style="COLOR: #2b91af"&gt;AutomationHelpers&lt;/SPAN&gt;.GetElementSize(dataGrid));&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: green; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;// Load the reference/master data from a previously saved file&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Snapshot&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; master = &lt;SPAN style="COLOR: #2b91af"&gt;Snapshot&lt;/SPAN&gt;.FromFile(&lt;SPAN style="COLOR: #2b91af"&gt;Path&lt;/SPAN&gt;.Combine(TestContext.TestDeploymentDir, &lt;SPAN style="COLOR: #a31515"&gt;"Master_EditTest1.png"&lt;/SPAN&gt;));&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;if&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; (CompareImages(actual, master) == &lt;SPAN style="COLOR: #2b91af"&gt;VerificationResult&lt;/SPAN&gt;.Fail)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;Assert&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;.Fail(&lt;SPAN style="COLOR: #a31515"&gt;"Initial State test failed. Actual should look like Master image. Refer to logged images under:"&lt;/SPAN&gt; + TestContext.TestLogsDir);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpLast style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 12pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;}&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;Download the full sample &lt;A class="" href="http://blogs.msdn.com/vinsibal/attachment/9191609.ashx" mce_href="http://blogs.msdn.com/vinsibal/attachment/9191609.ashx"&gt;here&lt;/A&gt;.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;We would love to hear your feedback.&lt;/FONT&gt;&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9191609" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-components-postattachments/00-09-19-16-09/DataGrid_5F00_V1_5F00_Sample_5F00_With_5F00_UnitTesting.zip" length="817695" type="application/x-zip-compressed" /><category domain="http://blogs.msdn.com/b/vinsibal/archive/tags/DataGrid/">DataGrid</category><category domain="http://blogs.msdn.com/b/vinsibal/archive/tags/DataGrid+Samples/">DataGrid Samples</category><category domain="http://blogs.msdn.com/b/vinsibal/archive/tags/TestApi/">TestApi</category></item><item><title>WPF DataGrid Design-time Walkthrough</title><link>http://blogs.msdn.com/b/vinsibal/archive/2008/11/07/wpf-datagrid-design-time-walkthrough.aspx</link><pubDate>Fri, 07 Nov 2008 18:29:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9052380</guid><dc:creator>Vincent Sibal - MSFT</dc:creator><slash:comments>16</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/vinsibal/rsscomments.aspx?WeblogPostID=9052380</wfw:commentRss><comments>http://blogs.msdn.com/b/vinsibal/archive/2008/11/07/wpf-datagrid-design-time-walkthrough.aspx#comments</comments><description>&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;The DataGrid &lt;/FONT&gt;&lt;A href="http://windowsclient.net/wpf/wpf35/wpf-35sp1-toolkit-datagrid-feature-walkthrough.aspx#designtime" mce_href="http://windowsclient.net/wpf/wpf35/wpf-35sp1-toolkit-datagrid-feature-walkthrough.aspx#designtime"&gt;&lt;FONT face=Calibri color=#0000ff size=3&gt;walkthrough&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Calibri size=3&gt; on windowsclient.net/wpf and the &lt;/FONT&gt;&lt;A href="http://www.codeplex.com/wpf/Wiki/View.aspx?title=Design%20Time&amp;amp;referringTitle=Tips%20%26%20Tricks" mce_href="http://www.codeplex.com/wpf/Wiki/View.aspx?title=Design%20Time&amp;amp;referringTitle=Tips%20%26%20Tricks"&gt;&lt;FONT face=Calibri size=3&gt;Tips &amp;amp; Tricks section&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt; on codeplex talk briefly about the Design-time support for DataGrid.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;I thought I’d expand on that just a little more so you get a good idea of what you have available.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Installation&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;So to get it to work you need to install the toolkit using the WPFToolkit.msi (download from&amp;nbsp;&lt;A class="" href="http://www.codeplex.com/wpf/Release/ProjectReleases.aspx?ReleaseId=15598" mce_href="http://www.codeplex.com/wpf/Release/ProjectReleases.aspx?ReleaseId=15598"&gt;here&lt;/A&gt;).&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;This will put the dlls under your “C:\Program Files\WPF Toolkit\&amp;lt;version number&amp;gt;\” directory as well as set a reg key in Visual Studio to recognize the controls in the toolbox.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;In your application, you will need to reference the wpftoolkit.dll from this install directory location to get the design-time support to work.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Walkthrough&lt;/FONT&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;Ok, I’ll start from the very beginning.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpFirst style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="mso-bidi-font-family: calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;SPAN style="mso-list: ignore"&gt;&lt;FONT face=Calibri size=3&gt;0.&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;Install and set a reference to wpftoolkit.dll&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpFirst style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;FONT face=Calibri size=3&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpFirst style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;FONT face=Calibri size=3&gt;&lt;A href="http://blogs.msdn.com/blogfiles/vinsibal/WindowsLiveWriter/WPFDataGridDesigntimeWalkthrough_6BB9/designtime_step1_2.jpg" mce_href="http://blogs.msdn.com/blogfiles/vinsibal/WindowsLiveWriter/WPFDataGridDesigntimeWalkthrough_6BB9/designtime_step1_2.jpg"&gt;&lt;IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=514 alt=designtime_step1 src="http://blogs.msdn.com/blogfiles/vinsibal/WindowsLiveWriter/WPFDataGridDesigntimeWalkthrough_6BB9/designtime_step1_thumb.jpg" width=633 border=0 mce_src="http://blogs.msdn.com/blogfiles/vinsibal/WindowsLiveWriter/WPFDataGridDesigntimeWalkthrough_6BB9/designtime_step1_thumb.jpg"&gt;&lt;/A&gt; &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpFirst style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;FONT face=Calibri size=3&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpFirst style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;FONT face=Calibri size=3&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="mso-bidi-font-family: calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;SPAN style="mso-list: ignore"&gt;&lt;FONT face=Calibri size=3&gt;1.&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Open the Toolbox.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;You should see a group with DataGrid, DatePicker, and Calendar.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 1in; TEXT-INDENT: -0.25in; mso-list: l0 level2 lfo1; mso-add-space: auto"&gt;&lt;SPAN style="mso-bidi-font-family: calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;SPAN style="mso-list: ignore"&gt;&lt;FONT face=Calibri size=3&gt;a.&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;If you don’t, you can add them by right-clicking in the Toolbox, selecting “Choose Toolbox Items”, tab to the WPF Components tab, then selecting DataGrid, DatePicker, and Calendar.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 1in; TEXT-INDENT: -0.25in; mso-list: l0 level2 lfo1; mso-add-space: auto"&gt;&lt;FONT face=Calibri size=3&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="mso-bidi-font-family: calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;SPAN style="mso-list: ignore"&gt;&lt;FONT face=Calibri size=3&gt;2.&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;Drag &amp;amp; drop support:&lt;/B&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Drag the DataGrid item from the Toolbox to the window on the design surface.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;FONT face=Calibri size=3&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 1in; TEXT-INDENT: -0.25in; mso-list: l0 level2 lfo1; mso-add-space: auto"&gt;&lt;SPAN style="mso-bidi-font-family: calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;SPAN style="mso-list: ignore"&gt;&lt;FONT face=Calibri size=3&gt;a.&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;Note: You may need to resize the window as well as work with the layout so the DataGrid fits as you would like.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 1in; TEXT-INDENT: -0.25in; mso-list: l0 level2 lfo1; mso-add-space: auto"&gt;&lt;FONT face=Calibri size=3&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 1in; TEXT-INDENT: -0.25in; mso-list: l0 level2 lfo1; mso-add-space: auto"&gt;&lt;A href="http://blogs.msdn.com/blogfiles/vinsibal/WindowsLiveWriter/WPFDataGridDesigntimeWalkthrough_6BB9/designtime_part2_2.jpg" mce_href="http://blogs.msdn.com/blogfiles/vinsibal/WindowsLiveWriter/WPFDataGridDesigntimeWalkthrough_6BB9/designtime_part2_2.jpg"&gt;&lt;IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=267 alt=designtime_part2 src="http://blogs.msdn.com/blogfiles/vinsibal/WindowsLiveWriter/WPFDataGridDesigntimeWalkthrough_6BB9/designtime_part2_thumb.jpg" width=621 border=0 mce_src="http://blogs.msdn.com/blogfiles/vinsibal/WindowsLiveWriter/WPFDataGridDesigntimeWalkthrough_6BB9/designtime_part2_thumb.jpg"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 1in; TEXT-INDENT: -0.25in; mso-list: l0 level2 lfo1; mso-add-space: auto"&gt;&lt;FONT face=Calibri size=3&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 1in; TEXT-INDENT: -0.25in; mso-list: l0 level2 lfo1; mso-add-space: auto"&gt;&lt;FONT face=Calibri size=3&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="mso-bidi-font-family: calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;SPAN style="mso-list: ignore"&gt;&lt;FONT face=Calibri size=3&gt;3.&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;Setup the ItemsSource for the DataGrid&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;FONT face=Calibri size=3&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpLast style="MARGIN: 0in 0in 0pt 1in; TEXT-INDENT: -0.25in; LINE-HEIGHT: normal; mso-list: l0 level2 lfo1; mso-add-space: auto; mso-layout-grid-align: none"&gt;&lt;SPAN style="mso-bidi-font-family: calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;SPAN style="mso-list: ignore"&gt;&lt;FONT face=Calibri size=3&gt;a.&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;In my example I’m going to use a DataTable that retrieves the Customers Table from the Northwind database.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;The code for that is in the sample on this &lt;/FONT&gt;&lt;A href="http://blogs.msdn.com/vinsibal/archive/2008/10/22/wpf-datagrid-and-the-wpftoolkit-have-released.aspx" mce_href="http://blogs.msdn.com/vinsibal/archive/2008/10/22/wpf-datagrid-and-the-wpftoolkit-have-released.aspx"&gt;&lt;FONT face=Calibri size=3&gt;post&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Calibri size=3&gt;.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.75in; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: #4f6228 1pt dashed; PADDING-RIGHT: 5pt; BORDER-TOP: #4f6228 1pt dashed; PADDING-LEFT: 5pt; BACKGROUND: #f6f5f0; PADDING-BOTTOM: 5pt; MARGIN-LEFT: 0.1in; BORDER-LEFT: #4f6228 1pt dashed; MARGIN-RIGHT: 0in; PADDING-TOP: 5pt; BORDER-BOTTOM: #4f6228 1pt dashed; mso-border-alt: dash-small-gap #4f6228 .5pt; mso-element: para-border-div; mso-border-themecolor: accent3; mso-border-themeshade: 128"&gt;
&lt;P class=codesampleCxSpFirst style="BACKGROUND: #f6f5f0; MARGIN: 12pt 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Window.Resources&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="BACKGROUND: yellow; mso-highlight: yellow"&gt;&amp;lt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;ObjectDataProvider&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt; x&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;Key&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;="CustomerDataProvider"&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;&lt;SPAN style="mso-tab-count: 8"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;ObjectType&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;="{&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;x&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;Type&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt; local&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;Customers&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;}"&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;&lt;SPAN style="mso-tab-count: 8"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;MethodName&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;="GetCustomers" /&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Window.Resources&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Grid&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;my&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;DataGrid&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Name&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="dataGrid1"&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 6"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="BACKGROUND: yellow; mso-highlight: yellow"&gt;ItemsSource&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;="{&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;Binding&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt; Source&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;={&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;StaticResource&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt; CustomerDataProvider&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;}}"&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; /&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpLast style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 12pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Grid&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.75in; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpFirst style="MARGIN: 0in 0in 0pt 1in; TEXT-INDENT: -0.25in; LINE-HEIGHT: normal; mso-list: l0 level2 lfo1; mso-add-space: auto; mso-layout-grid-align: none"&gt;&lt;SPAN style="mso-bidi-font-family: calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;SPAN style="mso-list: ignore"&gt;&lt;FONT face=Calibri size=3&gt;b.&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;As soon as the ItemsSource is set, the design surface should update to show you the data on the DataGrid.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;This is because DataGrid.AutoGenerateColumns is set to true by default.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpFirst style="MARGIN: 0in 0in 0pt 1in; TEXT-INDENT: -0.25in; LINE-HEIGHT: normal; mso-list: l0 level2 lfo1; mso-add-space: auto; mso-layout-grid-align: none"&gt;&lt;FONT face=Calibri size=3&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpFirst style="MARGIN: 0in 0in 0pt 1in; TEXT-INDENT: -0.25in; LINE-HEIGHT: normal; mso-list: l0 level2 lfo1; mso-add-space: auto; mso-layout-grid-align: none"&gt;&lt;A href="http://blogs.msdn.com/blogfiles/vinsibal/WindowsLiveWriter/WPFDataGridDesigntimeWalkthrough_6BB9/designtime_part3_2.jpg" mce_href="http://blogs.msdn.com/blogfiles/vinsibal/WindowsLiveWriter/WPFDataGridDesigntimeWalkthrough_6BB9/designtime_part3_2.jpg"&gt;&lt;IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=440 alt=designtime_part3 src="http://blogs.msdn.com/blogfiles/vinsibal/WindowsLiveWriter/WPFDataGridDesigntimeWalkthrough_6BB9/designtime_part3_thumb.jpg" width=566 border=0 mce_src="http://blogs.msdn.com/blogfiles/vinsibal/WindowsLiveWriter/WPFDataGridDesigntimeWalkthrough_6BB9/designtime_part3_thumb.jpg"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 1in; mso-add-space: auto"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="mso-bidi-font-family: calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;SPAN style="mso-list: ignore"&gt;&lt;FONT face=Calibri size=3&gt;4.&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;Properties View grouping support:&lt;/B&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Now, click on the DataGrid in the design window and open the Properties View.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Set the grouping to “Categorized”.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;You will find some groups that are specific to DataGrid such as the Columns group, GridLines group, Headers group, and Rows group.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;A href="http://blogs.msdn.com/blogfiles/vinsibal/WindowsLiveWriter/WPFDataGridDesigntimeWalkthrough_6BB9/designtime_part4_2.jpg" mce_href="http://blogs.msdn.com/blogfiles/vinsibal/WindowsLiveWriter/WPFDataGridDesigntimeWalkthrough_6BB9/designtime_part4_2.jpg"&gt;&lt;IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=453 alt=designtime_part4 src="http://blogs.msdn.com/blogfiles/vinsibal/WindowsLiveWriter/WPFDataGridDesigntimeWalkthrough_6BB9/designtime_part4_thumb.jpg" width=192 border=0 mce_src="http://blogs.msdn.com/blogfiles/vinsibal/WindowsLiveWriter/WPFDataGridDesigntimeWalkthrough_6BB9/designtime_part4_thumb.jpg"&gt;&lt;/A&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 1in; TEXT-INDENT: -0.25in; mso-list: l0 level2 lfo1; mso-add-space: auto"&gt;&lt;SPAN style="mso-bidi-font-family: calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;SPAN style="mso-list: ignore"&gt;&lt;FONT face=Calibri size=3&gt;a.&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;In my example, from the Properties View I set EnableColumnVirtualization to true and AlternationRowBackground to LightGray&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 1in; TEXT-INDENT: -0.25in; mso-list: l0 level2 lfo1; mso-add-space: auto"&gt;&lt;FONT face=Calibri size=3&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="mso-bidi-font-family: calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;SPAN style="mso-list: ignore"&gt;&lt;FONT face=Calibri size=3&gt;5.&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;Now, right-click on the DataGrid in design view.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;You should see a DataGrid menu item with additional sub-items.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;The sub-items will be a little different depending if you have an ItemsSource set or not.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Here is what it looks like with an ItemsSource set but no columns explicitly added:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;FONT face=Calibri size=3&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;A href="http://blogs.msdn.com/blogfiles/vinsibal/WindowsLiveWriter/WPFDataGridDesigntimeWalkthrough_6BB9/designtime_part5_1_2.jpg" mce_href="http://blogs.msdn.com/blogfiles/vinsibal/WindowsLiveWriter/WPFDataGridDesigntimeWalkthrough_6BB9/designtime_part5_1_2.jpg"&gt;&lt;IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=313 alt=designtime_part5_1 src="http://blogs.msdn.com/blogfiles/vinsibal/WindowsLiveWriter/WPFDataGridDesigntimeWalkthrough_6BB9/designtime_part5_1_thumb.jpg" width=420 border=0 mce_src="http://blogs.msdn.com/blogfiles/vinsibal/WindowsLiveWriter/WPFDataGridDesigntimeWalkthrough_6BB9/designtime_part5_1_thumb.jpg"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;FONT face=Calibri size=3&gt;When no ItemsSource is set, some sub-items will not appear.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;When explicit columns are set on the DataGrid, additional sub-items will be added.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Now, let’s try out each of the options.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;FONT face=Calibri size=3&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="mso-bidi-font-family: calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;SPAN style="mso-list: ignore"&gt;&lt;FONT face=Calibri size=3&gt;6.&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;Generating columns all at once:&lt;/B&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Right-click on the DataGrid in design view.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Select the DataGrid menu item, then select the “Generate Columns” sub-menu item.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;What just happened?&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;FONT face=Calibri size=3&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpLast style="MARGIN: 0in 0in 0pt 1in; TEXT-INDENT: -0.25in; LINE-HEIGHT: normal; mso-list: l0 level2 lfo1; mso-add-space: auto; mso-layout-grid-align: none"&gt;&lt;SPAN style="mso-bidi-font-family: calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;SPAN style="mso-list: ignore"&gt;&lt;FONT face=Calibri size=3&gt;a.&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;That may be a little confusing at first since the design view didn’t change.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;The design-time sets DataGrid.AutoGenerateColumns to false, then generates a list of columns with a one-to-one mapping of the data source’s properties and adds them to the columns collection in the xaml.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Here is what my DataGrid looks like now in the xaml:&amp;nbsp;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpLast style="MARGIN: 0in 0in 0pt 1in; TEXT-INDENT: -0.25in; LINE-HEIGHT: normal; mso-list: l0 level2 lfo1; mso-add-space: auto; mso-layout-grid-align: none"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: #4f6228 1pt dashed; PADDING-RIGHT: 5pt; BORDER-TOP: #4f6228 1pt dashed; PADDING-LEFT: 5pt; BACKGROUND: #f6f5f0; PADDING-BOTTOM: 5pt; MARGIN-LEFT: 0.1in; BORDER-LEFT: #4f6228 1pt dashed; MARGIN-RIGHT: 0in; PADDING-TOP: 5pt; BORDER-BOTTOM: #4f6228 1pt dashed; mso-border-alt: dash-small-gap #4f6228 .5pt; mso-element: para-border-div; mso-border-themecolor: accent3; mso-border-themeshade: 128"&gt;
&lt;P class=codesampleCxSpFirst style="BACKGROUND: #f6f5f0; MARGIN: 12pt 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;my&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;DataGrid&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Name&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="dataGrid1"&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; ItemsSource&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="{&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Binding&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Source&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;={&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;StaticResource&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; CustomerDataProvider&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;}}"&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; EnableColumnVirtualization&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="True"&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; AlternatingRowBackground&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="LightGray"&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; AutoGenerateColumns&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="False"&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;my&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;DataGrid.Columns&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;my&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;DataGridTextColumn&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Binding&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="{&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Binding&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Path&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;=CustomerID}"&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Header&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="CustomerID" /&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;my&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;DataGridTextColumn&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Binding&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="{&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Binding&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Path&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;=CompanyName}"&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Header&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="CompanyName" /&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;my&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;DataGridTextColumn&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Binding&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="{&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Binding&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Path&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;=ContactName}"&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Header&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="ContactName" /&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;my&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;DataGridTextColumn&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Binding&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="{&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Binding&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Path&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;=ContactTitle}"&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Header&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="ContactTitle" /&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;my&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;DataGridTextColumn&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Binding&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="{&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Binding&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Path&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;=Address}"&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Header&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="Address" /&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;my&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;DataGridTextColumn&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Binding&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="{&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Binding&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Path&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;=City}"&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Header&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="City" /&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;my&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;DataGridTextColumn&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Binding&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="{&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Binding&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Path&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;=Region}"&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Header&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="Region" /&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;my&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;DataGridTextColumn&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Binding&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="{&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Binding&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Path&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;=PostalCode}"&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Header&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="PostalCode" /&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;my&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;DataGridTextColumn&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Binding&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="{&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Binding&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Path&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;=Country}"&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Header&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="Country" /&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;my&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;DataGridTextColumn&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Binding&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="{&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Binding&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Path&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;=Phone}"&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Header&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="Phone" /&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;my&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;DataGridTextColumn&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Binding&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="{&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Binding&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Path&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;=Fax}"&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Header&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="Fax" /&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;my&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;DataGrid.Columns&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpLast style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 12pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;my&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;DataGrid&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;
&lt;P class=MsoListParagraphCxSpFirst style="MARGIN: 0in 0in 0pt 1in; mso-add-space: auto"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="mso-bidi-font-family: calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;SPAN style="mso-list: ignore"&gt;&lt;FONT face=Calibri size=3&gt;7.&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;STRONG&gt;Removing all columns:&lt;/STRONG&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Now that I have explicit columns set, if I wanted to clear them I can right-click on the DataGrid in design view, select DataGrid -&amp;gt; Remove Columns.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;This will remove all the columns from xaml but it will not change the AutoGenerateColumns property back to true.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;/SPAN&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/B&gt;&lt;/FONT&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="mso-bidi-font-family: calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;SPAN style="mso-list: ignore"&gt;&lt;FONT face=Calibri size=3&gt;8.&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;Creating a column with the Add/Edit Columns editor:&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/B&gt;With all columns removed now, select DataGrid -&amp;gt; Add/Edit Columns…&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;You should be presented with a column editor where the data sources properties are mapped on the left panel.&lt;B style="mso-bidi-font-weight: normal"&gt; &lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/B&gt;The middle area is where you can choose the type of DataGridColumn to create and the right panel shows the columns that will be created.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;FONT face=Calibri size=3&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;FONT face=Calibri size=3&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;FONT face=Calibri size=3&gt;&lt;A href="http://blogs.msdn.com/blogfiles/vinsibal/WindowsLiveWriter/WPFDataGridDesigntimeWalkthrough_6BB9/designtime_part7_2.jpg" mce_href="http://blogs.msdn.com/blogfiles/vinsibal/WindowsLiveWriter/WPFDataGridDesigntimeWalkthrough_6BB9/designtime_part7_2.jpg"&gt;&lt;IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=400 alt=designtime_part7 src="http://blogs.msdn.com/blogfiles/vinsibal/WindowsLiveWriter/WPFDataGridDesigntimeWalkthrough_6BB9/designtime_part7_thumb.jpg" width=603 border=0 mce_src="http://blogs.msdn.com/blogfiles/vinsibal/WindowsLiveWriter/WPFDataGridDesigntimeWalkthrough_6BB9/designtime_part7_thumb.jpg"&gt;&lt;/A&gt; &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;FONT face=Calibri size=3&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;FONT face=Calibri size=3&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 1in; TEXT-INDENT: -0.25in; mso-list: l0 level2 lfo1; mso-add-space: auto"&gt;&lt;SPAN style="mso-bidi-font-family: calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;SPAN style="mso-list: ignore"&gt;&lt;FONT face=Calibri size=3&gt;a.&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;Leave Type as Default and press the Add All button.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;You should see all the properties on the left panel moved to the right panel and mapped to columns.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;The default column is DataGridTextColumn.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 1in; TEXT-INDENT: -0.25in; mso-list: l0 level2 lfo1; mso-add-space: auto"&gt;&lt;FONT face=Calibri size=3&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 1in; TEXT-INDENT: -0.25in; mso-list: l0 level2 lfo1; mso-add-space: auto"&gt;&lt;SPAN style="mso-bidi-font-family: calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;SPAN style="mso-list: ignore"&gt;&lt;FONT face=Calibri size=3&gt;b.&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;Now, press the “Edit…” button on the first column in the right panel.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;An “Edit Column” editor should pop up with a list of common properties to set on the column.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 1in; TEXT-INDENT: -0.25in; mso-list: l0 level2 lfo1; mso-add-space: auto" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 1in; TEXT-INDENT: -0.25in; mso-list: l0 level2 lfo1; mso-add-space: auto"&gt;&lt;FONT face=Calibri size=3&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 1in; TEXT-INDENT: -0.25in; mso-list: l0 level2 lfo1; mso-add-space: auto"&gt;&lt;FONT face=Calibri size=3&gt;&lt;A href="http://blogs.msdn.com/blogfiles/vinsibal/WindowsLiveWriter/WPFDataGridDesigntimeWalkthrough_6BB9/designtime_part8_b_2.jpg" mce_href="http://blogs.msdn.com/blogfiles/vinsibal/WindowsLiveWriter/WPFDataGridDesigntimeWalkthrough_6BB9/designtime_part8_b_2.jpg"&gt;&lt;IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=444 alt=designtime_part8_b src="http://blogs.msdn.com/blogfiles/vinsibal/WindowsLiveWriter/WPFDataGridDesigntimeWalkthrough_6BB9/designtime_part8_b_thumb.jpg" width=540 border=0 mce_src="http://blogs.msdn.com/blogfiles/vinsibal/WindowsLiveWriter/WPFDataGridDesigntimeWalkthrough_6BB9/designtime_part8_b_thumb.jpg"&gt;&lt;/A&gt; &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 1in; TEXT-INDENT: -0.25in; mso-list: l0 level2 lfo1; mso-add-space: auto"&gt;&lt;FONT face=Calibri size=3&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpLast style="MARGIN: 0in 0in 10pt 1in; TEXT-INDENT: -0.25in; mso-list: l0 level2 lfo1; mso-add-space: auto"&gt;&lt;SPAN style="mso-bidi-font-family: calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;SPAN style="mso-list: ignore"&gt;&lt;FONT face=Calibri size=3&gt;c.&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Edit any of the fields of the columns you created and press ok on the “Add/Edit Columns” editor.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;The xaml should be updated with the set of columns you’ve created.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Summary&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;To recap, the cider design-time supports toolbox drag and drop, generating all columns, generating specific columns, editing columns, and removing columns.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Remember that you have to set the ItemsSource on the DataGrid declaratively in order to get that functionality.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;The Properties View has also been updated for the DataGrid to support grouping of specific properties on the DataGrid.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Please try it out and any feedback would be greatly appreciated.&amp;nbsp; &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;&lt;STRONG&gt;Other Design-time&amp;nbsp;Resources&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;&lt;A class="" href="http://karlshifflett.wordpress.com/" mce_href="http://karlshifflett.wordpress.com/"&gt;Karl Shifflett&lt;/A&gt; has created this awesome tool called &lt;A class="" href="http://karlshifflett.wordpress.com/xaml-power-toys/" mce_href="http://karlshifflett.wordpress.com/xaml-power-toys/"&gt;XAML Power Toys&lt;/A&gt;.&amp;nbsp; Included in the tool is a utility for creating and customizing a WPF DataGrid.&amp;nbsp; Check out the video walkthrough of it &lt;A class="" href="http://silverlight.services.live.com/invoke/48184/XAMLPowerToysv3-4WPFDataGrid/iframe.html" mce_href="http://silverlight.services.live.com/invoke/48184/XAMLPowerToysv3-4WPFDataGrid/iframe.html"&gt;here&lt;/A&gt;.&lt;/FONT&gt;&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9052380" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/vinsibal/archive/tags/DataGrid/">DataGrid</category><category domain="http://blogs.msdn.com/b/vinsibal/archive/tags/DataGrid+Concepts/">DataGrid Concepts</category></item><item><title>WPF DataGrid – New Item Template Sample</title><link>http://blogs.msdn.com/b/vinsibal/archive/2008/11/05/wpf-datagrid-new-item-template-sample.aspx</link><pubDate>Wed, 05 Nov 2008 18:33:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9044516</guid><dc:creator>Vincent Sibal - MSFT</dc:creator><slash:comments>26</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/vinsibal/rsscomments.aspx?WeblogPostID=9044516</wfw:commentRss><comments>http://blogs.msdn.com/b/vinsibal/archive/2008/11/05/wpf-datagrid-new-item-template-sample.aspx#comments</comments><description>&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;This sample shows how to create a template for the NewItemPlaceholder to indicate that you can add a new item.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;This is what it will look like:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;&lt;A href="http://blogs.msdn.com/blogfiles/vinsibal/WindowsLiveWriter/WPFDataGridNewItemTemplateSample_6B5C/newitemtemplate_2.jpg"&gt;&lt;IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=430 alt=newitemtemplate src="http://blogs.msdn.com/blogfiles/vinsibal/WindowsLiveWriter/WPFDataGridNewItemTemplateSample_6B5C/newitemtemplate_thumb.jpg" width=647 border=0&gt;&lt;/A&gt; &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;First I will need to create a new template specifically for the NewItemPlaceholder row.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;I’ve followed the general outline of the original DataGridRow control template but I’ve only included the pieces I needed and I’ve also added an element for the “Click here to add new item.” text.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;My template looks something like this:&lt;/FONT&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: #4f6228 1pt dashed; PADDING-RIGHT: 5pt; BORDER-TOP: #4f6228 1pt dashed; PADDING-LEFT: 5pt; BACKGROUND: #f6f5f0; PADDING-BOTTOM: 5pt; MARGIN-LEFT: 0.1in; BORDER-LEFT: #4f6228 1pt dashed; MARGIN-RIGHT: 0in; PADDING-TOP: 5pt; BORDER-BOTTOM: #4f6228 1pt dashed; mso-border-alt: dash-small-gap #4f6228 .5pt; mso-element: para-border-div; mso-border-themecolor: accent3; mso-border-themeshade: 128"&gt;
&lt;P class=codesampleCxSpFirst style="BACKGROUND: #f6f5f0; MARGIN: 12pt 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;ControlTemplate&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; x&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Key&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="NewRow_ControlTemplate"&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; TargetType&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="{&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;x&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Type&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; dg&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;DataGridRow&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;}"&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Border&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; x&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Name&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="DGR_Border"&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Background&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="{&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;TemplateBinding&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Background&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;}"&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; BorderBrush&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="{&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;TemplateBinding&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; BorderBrush&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;}"&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; BorderThickness&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="{&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;TemplateBinding&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; BorderThickness&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;}"&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; SnapsToDevicePixels&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="True"&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;dg&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;SelectiveScrollingGrid&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 5"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;…&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 5"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;TextBlock&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Text&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="Click here to add a new item."&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Grid.Column&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="1"/&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 5"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;…&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;dg&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;SelectiveScrollingGrid&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpLast style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 12pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;ControlTemplate&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;/FONT&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Then I’m going to need to attach to several events.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;In particular, I need to hook up to the DataGrid.LoadingRow, DataGrid.UnloadingRow, DataGrid.RowEditEnding, and DataGridRow.MouseLeftButtonDown events.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;I attach to the LoadingRow and UnloadingRow events so I can set either the default or new item control template when the row is created.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;These event handlers will look like this:&lt;/FONT&gt;&lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: #4f6228 1pt dashed; PADDING-RIGHT: 5pt; BORDER-TOP: #4f6228 1pt dashed; PADDING-LEFT: 5pt; BACKGROUND: #f6f5f0; PADDING-BOTTOM: 5pt; MARGIN-LEFT: 0.1in; BORDER-LEFT: #4f6228 1pt dashed; MARGIN-RIGHT: 0in; PADDING-TOP: 5pt; BORDER-BOTTOM: #4f6228 1pt dashed; mso-border-alt: dash-small-gap #4f6228 .5pt; mso-element: para-border-div; mso-border-themecolor: accent3; mso-border-themeshade: 128"&gt;
&lt;P class=codesampleCxSpFirst style="BACKGROUND: #f6f5f0; MARGIN: 12pt 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;private&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; DataGrid_Standard_LoadingRow(&lt;SPAN style="COLOR: blue"&gt;object&lt;/SPAN&gt; sender, &lt;SPAN style="COLOR: #2b91af"&gt;DataGridRowEventArgs&lt;/SPAN&gt; e)&lt;SPAN style="COLOR: blue"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; (_defaultRowControlTemplate == &lt;SPAN style="COLOR: blue"&gt;null&lt;/SPAN&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp; &lt;/SPAN&gt;_defaultRowControlTemplate = e.Row.Template;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; (e.Row.Item == &lt;SPAN style="COLOR: #2b91af"&gt;CollectionView&lt;/SPAN&gt;.NewItemPlaceholder)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;e.Row.Template = _newRowControlTemplate;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;e.Row.UpdateLayout();&lt;SPAN style="COLOR: blue"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;private&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; DataGrid_Standard_UnloadingRow(&lt;SPAN style="COLOR: blue"&gt;object&lt;/SPAN&gt; sender, &lt;SPAN style="COLOR: #2b91af"&gt;DataGridRowEventArgs&lt;/SPAN&gt; e)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; (e.Row.Item == &lt;SPAN style="COLOR: #2b91af"&gt;CollectionView&lt;/SPAN&gt;.NewItemPlaceholder &amp;amp;&amp;amp; e.Row.Template != _defaultRowControlTemplate)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;e.Row.Template = _defaultRowControlTemplate;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;e.Row.UpdateLayout();&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpLast style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 12pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;}&lt;/SPAN&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;I attach to the DataGridRow.MouseLeftButtonDown event so that I can change the template of the NewItemPlaceholder on the first click.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;For this sample, when first clicking the row of the NewItemPlaceholder it immediate enters edit mode.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Here is the handler:&lt;/FONT&gt;&lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: #4f6228 1pt dashed; PADDING-RIGHT: 5pt; BORDER-TOP: #4f6228 1pt dashed; PADDING-LEFT: 5pt; BACKGROUND: #f6f5f0; PADDING-BOTTOM: 5pt; MARGIN-LEFT: 0.1in; BORDER-LEFT: #4f6228 1pt dashed; MARGIN-RIGHT: 0in; PADDING-TOP: 5pt; BORDER-BOTTOM: #4f6228 1pt dashed; mso-border-alt: dash-small-gap #4f6228 .5pt; mso-element: para-border-div; mso-border-themecolor: accent3; mso-border-themeshade: 128"&gt;
&lt;P class=codesampleCxSpFirst style="BACKGROUND: #f6f5f0; MARGIN: 12pt 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;private&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; Row_MouseLeftButtonDown(&lt;SPAN style="COLOR: blue"&gt;object&lt;/SPAN&gt; sender, &lt;SPAN style="COLOR: #2b91af"&gt;MouseButtonEventArgs&lt;/SPAN&gt; e)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;DataGridRow&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; row = sender &lt;SPAN style="COLOR: blue"&gt;as&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;DataGridRow&lt;/SPAN&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; (row.Item == &lt;SPAN style="COLOR: #2b91af"&gt;CollectionView&lt;/SPAN&gt;.NewItemPlaceholder &amp;amp;&amp;amp; row.Template == _newRowControlTemplate)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: green; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;// for a new row update the template and open for edit&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;row.Template = _defaultRowControlTemplate;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;row.UpdateLayout();&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;DataGrid_Standard.CurrentItem = row.Item;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;DataGridCell&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; cell = &lt;SPAN style="COLOR: #2b91af"&gt;Helper&lt;/SPAN&gt;.GetCell(DataGrid_Standard, DataGrid_Standard.Items.IndexOf(row.Item), 0);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&lt;/SPAN&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;cell.Focus();&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;DataGrid_Standard.BeginEdit();&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpLast style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 12pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;}&lt;/SPAN&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;The last event is necessary so that the template is updated back to the new item template after a row is either committed or cancelled.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;It is a little tricky because what I really want is to perform my operation when the row is already committed or cancelled but the only event available, RowEditEnding, fires while the row is committing or being cancelled.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;What I can do is use the Dispatcher to make my operation take place after the RowEditEnding event.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;My handler looks like this:&lt;/FONT&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: #4f6228 1pt dashed; PADDING-RIGHT: 5pt; BORDER-TOP: #4f6228 1pt dashed; PADDING-LEFT: 5pt; BACKGROUND: #f6f5f0; PADDING-BOTTOM: 5pt; MARGIN-LEFT: 0.1in; BORDER-LEFT: #4f6228 1pt dashed; MARGIN-RIGHT: 0in; PADDING-TOP: 5pt; BORDER-BOTTOM: #4f6228 1pt dashed; mso-border-alt: dash-small-gap #4f6228 .5pt; mso-element: para-border-div; mso-border-themecolor: accent3; mso-border-themeshade: 128"&gt;
&lt;P class=codesampleCxSpFirst style="BACKGROUND: #f6f5f0; MARGIN: 12pt 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;private&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; DataGrid_Standard_RowEditEnding(&lt;SPAN style="COLOR: blue"&gt;object&lt;/SPAN&gt; sender, &lt;SPAN style="COLOR: #2b91af"&gt;DataGridRowEditEndingEventArgs&lt;/SPAN&gt; e)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;IEditableCollectionView&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; iecv = &lt;SPAN style="COLOR: #2b91af"&gt;CollectionViewSource&lt;/SPAN&gt;.GetDefaultView((sender &lt;SPAN style="COLOR: blue"&gt;as&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;DataGrid&lt;/SPAN&gt;).ItemsSource) &lt;SPAN style="COLOR: blue"&gt;as&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;IEditableCollectionView&lt;/SPAN&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; (iecv.IsAddingNew)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: green; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;// need to wait till after the operation as the NewItemPlaceHolder is added after&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Dispatcher.Invoke(&lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;DispatcherOperationCallback&lt;/SPAN&gt;(ResetNewItemTemplate), &lt;SPAN style="COLOR: #2b91af"&gt;DispatcherPriority&lt;/SPAN&gt;.ApplicationIdle, DataGrid_Standard);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;private&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: blue"&gt;object&lt;/SPAN&gt; ResetNewItemTemplate(&lt;SPAN style="COLOR: blue"&gt;object&lt;/SPAN&gt; arg)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;DataGridRow&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; row = &lt;SPAN style="COLOR: #2b91af"&gt;Helper&lt;/SPAN&gt;.GetRow(DataGrid_Standard, DataGrid_Standard.Items.Count - 1);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; (row.Template != _newRowControlTemplate)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;row.Template = _newRowControlTemplate;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;row.UpdateLayout();&lt;/SPAN&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;FONT face="Lucida Console"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;return&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: blue"&gt;null&lt;/SPAN&gt;;&lt;/SPAN&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpLast style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 12pt; mso-add-space: auto"&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;FONT face="Lucida Console"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;/SPAN&gt;So when I cancel or commit the edit on the new item, the new item template will be added back to the last row.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;You can download the full sample &lt;A class="" href="http://blogs.msdn.com/vinsibal/attachment/9044516.ashx" mce_href="http://blogs.msdn.com/vinsibal/attachment/9044516.ashx"&gt;here&lt;/A&gt;.&lt;/FONT&gt;&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9044516" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-components-postattachments/00-09-04-45-16/DataGrid_5F00_V1_5F00_NewItemTemplate_5F00_Sample.zip" length="569700" type="application/x-zip-compressed" /><category domain="http://blogs.msdn.com/b/vinsibal/archive/tags/DataGrid/">DataGrid</category><category domain="http://blogs.msdn.com/b/vinsibal/archive/tags/DataGrid+Samples/">DataGrid Samples</category></item><item><title>WPF VSM and DataGrid Sample</title><link>http://blogs.msdn.com/b/vinsibal/archive/2008/11/04/wpf-vsm-and-datagrid-sample.aspx</link><pubDate>Wed, 05 Nov 2008 03:34:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9042335</guid><dc:creator>Vincent Sibal - MSFT</dc:creator><slash:comments>12</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/vinsibal/rsscomments.aspx?WeblogPostID=9042335</wfw:commentRss><comments>http://blogs.msdn.com/b/vinsibal/archive/2008/11/04/wpf-vsm-and-datagrid-sample.aspx#comments</comments><description>&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;Now that the Visual State Manager (VSM) is part of the WPFToolKit, I thought I’d show a basic example of how to utilize VSM with the DataGrid.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Some prereq’s and resources:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpFirst style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="FONT-FAMILY: symbol; mso-fareast-font-family: symbol; mso-bidi-font-family: symbol"&gt;&lt;SPAN style="mso-list: ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;You can download the toolkit &lt;/FONT&gt;&lt;A href="http://www.codeplex.com/wpf/Release/ProjectReleases.aspx?ReleaseId=15598" mce_href="http://www.codeplex.com/wpf/Release/ProjectReleases.aspx?ReleaseId=15598"&gt;&lt;FONT face=Calibri size=3&gt;here&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="FONT-FAMILY: symbol; mso-fareast-font-family: symbol; mso-bidi-font-family: symbol"&gt;&lt;SPAN style="mso-list: ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;A href="http://blogs.msdn.com/expression/archive/2008/10/30/blend-2-sp1-wpf-toolkit-visual-state-manager-for-wpf.aspx" mce_href="http://blogs.msdn.com/expression/archive/2008/10/30/blend-2-sp1-wpf-toolkit-visual-state-manager-for-wpf.aspx"&gt;&lt;FONT face=Calibri size=3&gt;Info on getting VSM for WPF to work in Blend&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpLast style="MARGIN: 0in 0in 10pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="FONT-FAMILY: symbol; mso-fareast-font-family: symbol; mso-bidi-font-family: symbol"&gt;&lt;SPAN style="mso-list: ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;A href="http://blogs.msdn.com/expression/archive/2008/07/11/more-articles-on-visual-state-manager.aspx" mce_href="http://blogs.msdn.com/expression/archive/2008/07/11/more-articles-on-visual-state-manager.aspx"&gt;&lt;FONT face=Calibri size=3&gt;General VSM resource links&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;So, what I thought I would show is how to get it working with DataGridRows.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;The toolkit currently uses this VisualStateBehavior pattern to hook up the VisualStateManager to the control.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;If you take a look in the toolkit, you’ll find behavior classes for Button, Control, ListBoxItem, TextBoxBase, etc.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;They basically attach listeners of particular DPs and call VisualStateManager.GoToState as necessary.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;The Functionality&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;In this sample I will create a DataGridRowBehavior class that will create visual states for:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpFirst style="MARGIN: 0in 0in 0pt 37.5pt; TEXT-INDENT: -0.25in; mso-add-space: auto; mso-list: l1 level1 lfo2"&gt;&lt;SPAN style="FONT-FAMILY: symbol; mso-fareast-font-family: symbol; mso-bidi-font-family: symbol"&gt;&lt;SPAN style="mso-list: ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;MouseOver&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 37.5pt; TEXT-INDENT: -0.25in; mso-add-space: auto; mso-list: l1 level1 lfo2"&gt;&lt;SPAN style="FONT-FAMILY: symbol; mso-fareast-font-family: symbol; mso-bidi-font-family: symbol"&gt;&lt;SPAN style="mso-list: ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;Selected&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpLast style="MARGIN: 0in 0in 10pt 37.5pt; TEXT-INDENT: -0.25in; mso-add-space: auto; mso-list: l1 level1 lfo2"&gt;&lt;SPAN style="FONT-FAMILY: symbol; mso-fareast-font-family: symbol; mso-bidi-font-family: symbol"&gt;&lt;SPAN style="mso-list: ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;Editing&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;In the MouseOver state I want to make a somewhat subtle change to the background and for the Selected state I want to use the same background color but make it more illuminated.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Here is what it will look like,&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;&lt;A href="http://blogs.msdn.com/blogfiles/vinsibal/WindowsLiveWriter/WPFVSMandDataGridSample_E9F0/vsmDataGrid_2.jpg" mce_href="http://blogs.msdn.com/blogfiles/vinsibal/WindowsLiveWriter/WPFVSMandDataGridSample_E9F0/vsmDataGrid_2.jpg"&gt;&lt;IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=332 alt=vsmDataGrid src="http://blogs.msdn.com/blogfiles/vinsibal/WindowsLiveWriter/WPFVSMandDataGridSample_E9F0/vsmDataGrid_thumb.jpg" width=733 border=0 mce_src="http://blogs.msdn.com/blogfiles/vinsibal/WindowsLiveWriter/WPFVSMandDataGridSample_E9F0/vsmDataGrid_thumb.jpg"&gt;&lt;/A&gt; &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;For the Editing state, I will use the same background color as the Selected state but I want it to pulse to signify this editable state.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Unfortunately a picture will not be able to describe this behavior so you’ll have to download the sample to see it.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Implementation Details&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;First I’ll start with the DataGridRowBehavior class.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;This class derives from ControlBehavior and basically attaches to DPs to be notified on value changed.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;When it is notified, it calls VisualStateManager.GoToState on the particular state that it should be in.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;This is very similar to the standard way of creating a control with VSM behavior except it is using the attached behavior pattern instead.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;More on attached behavior’s &lt;/FONT&gt;&lt;A href="http://blogs.msdn.com/johngossman/archive/2008/08/08/visualstatemanager-for-desktop-wpf.aspx" mce_href="http://blogs.msdn.com/johngossman/archive/2008/08/08/visualstatemanager-for-desktop-wpf.aspx"&gt;&lt;FONT face=Calibri size=3&gt;here&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Calibri size=3&gt; on John Gossman’s blog.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;So here is what my class will look like:&lt;/FONT&gt;&lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: #4f6228 1pt dashed; PADDING-RIGHT: 5pt; BORDER-TOP: #4f6228 1pt dashed; PADDING-LEFT: 5pt; BACKGROUND: #f6f5f0; PADDING-BOTTOM: 5pt; MARGIN-LEFT: 0.1in; BORDER-LEFT: #4f6228 1pt dashed; MARGIN-RIGHT: 0in; PADDING-TOP: 5pt; BORDER-BOTTOM: #4f6228 1pt dashed; mso-border-alt: dash-small-gap #4f6228 .5pt; mso-element: para-border-div; mso-border-themecolor: accent3; mso-border-themeshade: 128"&gt;
&lt;P class=codesampleCxSpFirst style="BACKGROUND: #f6f5f0; MARGIN: 12pt 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;public&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: blue"&gt;class&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;DataGridRowBehavior&lt;/SPAN&gt; : &lt;SPAN style="COLOR: #2b91af"&gt;ControlBehavior&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;{&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;protected&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: blue"&gt;override&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; OnAttach(&lt;SPAN style="COLOR: #2b91af"&gt;Control&lt;/SPAN&gt; control)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;base&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;.OnAttach(control);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;DataGridRow&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; dataGridRow = (&lt;SPAN style="COLOR: #2b91af"&gt;DataGridRow&lt;/SPAN&gt;)control;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Type&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; targetType = &lt;SPAN style="COLOR: blue"&gt;typeof&lt;/SPAN&gt;(&lt;SPAN style="COLOR: #2b91af"&gt;DataGridRow&lt;/SPAN&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;EventHandler&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; handler = &lt;SPAN style="COLOR: blue"&gt;delegate&lt;/SPAN&gt; { UpdateState(dataGridRow, &lt;SPAN style="COLOR: blue"&gt;true&lt;/SPAN&gt;); };&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;AddValueChanged(&lt;SPAN style="COLOR: #2b91af"&gt;DataGridRow&lt;/SPAN&gt;.IsMouseOverProperty, targetType, dataGridRow, handler);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;AddValueChanged(&lt;SPAN style="COLOR: #2b91af"&gt;DataGridRow&lt;/SPAN&gt;.IsSelectedProperty, targetType, dataGridRow, handler);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;AddValueChanged(&lt;SPAN style="COLOR: #2b91af"&gt;DataGridRow&lt;/SPAN&gt;.IsEditingProperty, targetType, dataGridRow, handler);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;} &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;protected&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: blue"&gt;override&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; UpdateState(&lt;SPAN style="COLOR: #2b91af"&gt;Control&lt;/SPAN&gt; control, &lt;SPAN style="COLOR: blue"&gt;bool&lt;/SPAN&gt; useTransitions)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;DataGridRow&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; dataGridRow = (&lt;SPAN style="COLOR: #2b91af"&gt;DataGridRow&lt;/SPAN&gt;)control;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; (dataGridRow.IsMouseOver)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 5"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;VisualStateManager&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;.GoToState(dataGridRow, &lt;SPAN style="COLOR: #a31515"&gt;"MouseOver"&lt;/SPAN&gt;, useTransitions);&lt;SPAN style="COLOR: blue"&gt;&lt;BR&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;else&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 5"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;VisualStateManager&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;.GoToState(dataGridRow, &lt;SPAN style="COLOR: #a31515"&gt;"Normal"&lt;/SPAN&gt;, useTransitions);&lt;SPAN style="COLOR: blue"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; (dataGridRow.IsEditing)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 5"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;VisualStateManager&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;.GoToState(dataGridRow, &lt;SPAN style="COLOR: #a31515"&gt;"Editing"&lt;/SPAN&gt;, useTransitions);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;else&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 5"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;VisualStateManager&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;.GoToState(dataGridRow, &lt;SPAN style="COLOR: #a31515"&gt;"NotEditing"&lt;/SPAN&gt;, useTransitions);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; (dataGridRow.IsSelected)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 5"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;VisualStateManager&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;.GoToState(dataGridRow, &lt;SPAN style="COLOR: #a31515"&gt;"Selected"&lt;/SPAN&gt;, useTransitions);&lt;SPAN style="COLOR: blue"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;else&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 5"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;VisualStateManager&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;.GoToState(dataGridRow, &lt;SPAN style="COLOR: #a31515"&gt;"Unselected"&lt;/SPAN&gt;, useTransitions);&lt;SPAN style="COLOR: blue"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;base&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;.UpdateState(control, useTransitions);&lt;SPAN style="COLOR: blue"&gt;&lt;BR&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="mso-tab-count: 1"&gt; &lt;/SPAN&gt;}&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpLast style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 12pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;}&lt;/SPAN&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;/FONT&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;From there you need to update the DataGridRow ControlTemplate to include the VisualStateGroups.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;I’ve taken the existing DataGridRow ControlTemplate and added two rectangles that will both overlap the main Border, “DGR_Border”.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;These rectangles will initially have an Opacity of zero and when a particular VisualState is triggered, the Opacity will be updated so that the appearance of the row’s background changes.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;To see the xaml for the full ControlTemplate, you can download the sample below.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;For the VisualStateGroups, here are the groups I’ve set:&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: #4f6228 1pt dashed; PADDING-RIGHT: 5pt; BORDER-TOP: #4f6228 1pt dashed; PADDING-LEFT: 5pt; BACKGROUND: #f6f5f0; PADDING-BOTTOM: 5pt; MARGIN-LEFT: 0.1in; BORDER-LEFT: #4f6228 1pt dashed; MARGIN-RIGHT: 0in; PADDING-TOP: 5pt; BORDER-BOTTOM: #4f6228 1pt dashed; mso-border-alt: dash-small-gap #4f6228 .5pt; mso-element: para-border-div; mso-border-themecolor: accent3; mso-border-themeshade: 128"&gt;
&lt;P class=codesampleCxSpFirst style="BACKGROUND: #f6f5f0; MARGIN: 12pt 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;VisualStateManager.VisualStateGroups&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;VisualStateGroup&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; x&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Name&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="CommonStates"&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;VisualState&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; x&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Name&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="Normal" /&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;VisualState&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; x&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Name&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="MouseOver" /&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;VisualStateGroup&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;VisualStateGroup&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; x&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Name&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="SelectionStates"&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;VisualState&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; x&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Name&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="Selected" /&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;VisualState&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; x&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Name&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="Unselected" /&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;VisualStateGroup&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;VisualStateGroup&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; x&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Name&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="EditingStates"&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;VisualState&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; x&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Name&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="Editing" /&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;VisualState&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; x&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Name&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="NotEditing" /&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;VisualStateGroup&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpLast style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 12pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;VisualStateManager.VisualStateGroups&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;Then for each state I setup a Storyboard to create the behavior for that state.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Here is an example of MouseOver:&lt;/FONT&gt;&lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: #4f6228 1pt dashed; PADDING-RIGHT: 5pt; BORDER-TOP: #4f6228 1pt dashed; PADDING-LEFT: 5pt; BACKGROUND: #f6f5f0; PADDING-BOTTOM: 5pt; MARGIN-LEFT: 0.1in; BORDER-LEFT: #4f6228 1pt dashed; MARGIN-RIGHT: 0in; PADDING-TOP: 5pt; BORDER-BOTTOM: #4f6228 1pt dashed; mso-border-alt: dash-small-gap #4f6228 .5pt; mso-element: para-border-div; mso-border-themecolor: accent3; mso-border-themeshade: 128"&gt;
&lt;P class=codesampleCxSpFirst style="BACKGROUND: #f6f5f0; MARGIN: 12pt 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;VisualState&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; x&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Name&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="MouseOver"&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Storyboard&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;DoubleAnimation&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Storyboard.TargetName&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="fillColor"&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Storyboard.TargetProperty&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="Opacity"&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Duration&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="0"&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; To&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;=".35"/&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Storyboard&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpLast style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 12pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;VisualState&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;/FONT&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;fillColor represents one of the rectangles that I’ve added to the ControlTemplate.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;I do something similar with the Selected state and for the Editing state I create a pulsing effect by animating the rectangle’s Fill property with a different gradient brush that repeats forever.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;With the VisualStateGroups setup, the last thing I have to do is register DataGridRowBehavior with the VisualStateBehavior property.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;This is how the VisualStateManager will recognize that my ControlTemplate makes use of VisualStateManager.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;I set that up in my DataGridRow style like so:&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: #4f6228 1pt dashed; PADDING-RIGHT: 5pt; BORDER-TOP: #4f6228 1pt dashed; PADDING-LEFT: 5pt; BACKGROUND: #f6f5f0; PADDING-BOTTOM: 5pt; MARGIN-LEFT: 0.1in; BORDER-LEFT: #4f6228 1pt dashed; MARGIN-RIGHT: 0in; PADDING-TOP: 5pt; BORDER-BOTTOM: #4f6228 1pt dashed; mso-border-alt: dash-small-gap #4f6228 .5pt; mso-element: para-border-div; mso-border-themecolor: accent3; mso-border-themeshade: 128"&gt;
&lt;P class=codesampleCxSpFirst style="BACKGROUND: #f6f5f0; MARGIN: 12pt 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Style&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; x&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Key&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="defaultRowStyle"&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; TargetType&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="{&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;x&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Type&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; dg&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;DataGridRow&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;}"&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Setter&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Property&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="dg:VisualStateBehavior.VisualStateBehavior"&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Value&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="{&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;StaticResource&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; DataGridRowBehavior&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;}" /&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpLast style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 12pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Style&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;/FONT&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;So with that, &lt;A class="" href="http://blogs.msdn.com/vinsibal/attachment/9042335.ashx" mce_href="http://blogs.msdn.com/vinsibal/attachment/9042335.ashx"&gt;here&lt;/A&gt; is the full sample.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;I did go over the implementation details pretty quickly so please take a look at the sample to see the full code and markup details.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Stay tuned for more!&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9042335" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-components-postattachments/00-09-04-23-35/VSM_5F00_and_5F00_DataGrid_5F00_Sample.zip" length="500307" type="application/x-zip-compressed" /><category domain="http://blogs.msdn.com/b/vinsibal/archive/tags/DataGrid/">DataGrid</category><category domain="http://blogs.msdn.com/b/vinsibal/archive/tags/DataGrid+Samples/">DataGrid Samples</category><category domain="http://blogs.msdn.com/b/vinsibal/archive/tags/Visual+State+Manager/">Visual State Manager</category></item><item><title>WPF DataGrid: Frozen Row Sample</title><link>http://blogs.msdn.com/b/vinsibal/archive/2008/10/31/wpf-datagrid-frozen-row-sample.aspx</link><pubDate>Fri, 31 Oct 2008 23:27:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9027284</guid><dc:creator>Vincent Sibal - MSFT</dc:creator><slash:comments>5</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/vinsibal/rsscomments.aspx?WeblogPostID=9027284</wfw:commentRss><comments>http://blogs.msdn.com/b/vinsibal/archive/2008/10/31/wpf-datagrid-frozen-row-sample.aspx#comments</comments><description>&lt;P&gt;It looks that this is a frequently requested feature and unfortunately didn't make the v1.&amp;nbsp; It is still possible to extend the DataGrid to do so.&amp;nbsp; A community developer has already posted a sample on creating a footer row for the DataGrid here, &lt;A href="http://thibaud60.blogspot.com/2008/10/wpftoolkit-datagrid-with-footer-and.html" mce_href="http://thibaud60.blogspot.com/2008/10/wpftoolkit-datagrid-with-footer-and.html"&gt;http://thibaud60.blogspot.com/2008/10/wpftoolkit-datagrid-with-footer-and.html&lt;/A&gt;.&amp;nbsp; I thought I would post a sample for creating pinned rows starting from the top.&amp;nbsp; This is similar to the excel pinning functionality.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;I won't really go into too much implementation detail but I basically follow a similar pattern to the way frozen columns are implemented.&amp;nbsp; The core of the code is in a CustomDataGridRowsPresenter.ArrangeOverride method.&amp;nbsp; I tried to make it as simple as possible so it could be easily understood and as a result of that&amp;nbsp;I didn't implement virtualization.&amp;nbsp;&amp;nbsp;Well, that's&amp;nbsp;part of the reason I didn't implement virtualization.&amp;nbsp; VirtualizingStackPanel isn't very extendable&amp;nbsp;when it comes to it's virtualization and recycling functionality.&amp;nbsp; I would have to do a good bit of my own implementation for it and&amp;nbsp;it would take a good bit of time.&amp;nbsp; So, the sample only works when row and column virtualization is turned off.&amp;nbsp; If anyone feels up to making it work with virtualization, please be my guest. = )&amp;nbsp; &lt;/P&gt;
&lt;P&gt;Anyway, you can download the sample &lt;A class="" href="http://blogs.msdn.com/vinsibal/attachment/9027284.ashx" mce_href="http://blogs.msdn.com/vinsibal/attachment/9027284.ashx"&gt;here&lt;/A&gt;.&amp;nbsp; On the left pane I added buttons to increase/decrease the frozen row and column counts.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;Note: The purpose of the&amp;nbsp;sample is for learning purposes only.&amp;nbsp; Please do not use this in production code as it is not fully tested.&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9027284" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-components-postattachments/00-09-02-72-84/DataGrid_5F00_V1_5F00_FrozenRowSample.zip" length="436768" type="application/x-zip-compressed" /><category domain="http://blogs.msdn.com/b/vinsibal/archive/tags/DataGrid/">DataGrid</category><category domain="http://blogs.msdn.com/b/vinsibal/archive/tags/DataGrid+Samples/">DataGrid Samples</category></item><item><title>WPF DataGrid - DataGridComboBoxColumn v1 Intro</title><link>http://blogs.msdn.com/b/vinsibal/archive/2008/10/31/wpf-datagrid-datagridcomboboxcolumn-v1-intro.aspx</link><pubDate>Fri, 31 Oct 2008 17:49:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9026733</guid><dc:creator>Vincent Sibal - MSFT</dc:creator><slash:comments>34</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/vinsibal/rsscomments.aspx?WeblogPostID=9026733</wfw:commentRss><comments>http://blogs.msdn.com/b/vinsibal/archive/2008/10/31/wpf-datagrid-datagridcomboboxcolumn-v1-intro.aspx#comments</comments><description>&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Intro&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;If you haven't already, you can download the DataGrid v1 bits and source &lt;A class="" href="http://www.codeplex.com/wpf/Release/ProjectReleases.aspx?ReleaseId=15598" mce_href="http://www.codeplex.com/wpf/Release/ProjectReleases.aspx?ReleaseId=15598"&gt;here&lt;/A&gt;.&amp;nbsp; DataGridComboBoxColumn has had a make-over since the CTP release.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;In particular, the whole data binding story has been updated so that you can accomplish basic ComboBox tasks that before required some tedious workarounds.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;While other stock columns such as DataGridTextColumn and DataGridCheckBoxColumn use Binding for the visual to data hook up, DataGridComboBoxColumn uses a different route with three possible ways to hook up a binding.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Here are the APIs that are specific to the DataGridComboBoxColumn:&lt;/FONT&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: #4f6228 1pt dashed; PADDING-RIGHT: 5pt; BORDER-TOP: #4f6228 1pt dashed; PADDING-LEFT: 5pt; BACKGROUND: #f6f5f0; PADDING-BOTTOM: 5pt; MARGIN-LEFT: 0.1in; BORDER-LEFT: #4f6228 1pt dashed; MARGIN-RIGHT: 0in; PADDING-TOP: 5pt; BORDER-BOTTOM: #4f6228 1pt dashed; mso-border-alt: dash-small-gap #4F6228 .5pt; mso-element: para-border-div; mso-border-themecolor: accent3; mso-border-themeshade: 128"&gt;
&lt;P class=codesampleCxSpFirst style="BACKGROUND: #f6f5f0; MARGIN: 12pt 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;public&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: blue"&gt;class&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;DataGridComboBoxColumn&lt;/SPAN&gt; : &lt;SPAN style="COLOR: #2b91af"&gt;DataGridColumn&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;public&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt; DisplayMemberPath { &lt;SPAN style="COLOR: blue"&gt;get&lt;/SPAN&gt;; &lt;SPAN style="COLOR: blue"&gt;set&lt;/SPAN&gt;; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;public&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: #2b91af"&gt;IEnumerable&lt;/SPAN&gt; ItemsSource { &lt;SPAN style="COLOR: blue"&gt;get&lt;/SPAN&gt;; &lt;SPAN style="COLOR: blue"&gt;set&lt;/SPAN&gt;; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;public&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: blue"&gt;virtual&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;BindingBase&lt;/SPAN&gt; SelectedItemBinding { &lt;SPAN style="COLOR: blue"&gt;get&lt;/SPAN&gt;; &lt;SPAN style="COLOR: blue"&gt;set&lt;/SPAN&gt;; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;public&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: blue"&gt;virtual&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;BindingBase&lt;/SPAN&gt; SelectedValueBinding { &lt;SPAN style="COLOR: blue"&gt;get&lt;/SPAN&gt;; &lt;SPAN style="COLOR: blue"&gt;set&lt;/SPAN&gt;; } &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;public&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt; SelectedValuePath { &lt;SPAN style="COLOR: blue"&gt;get&lt;/SPAN&gt;; &lt;SPAN style="COLOR: blue"&gt;set&lt;/SPAN&gt;; }&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;public&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: blue"&gt;virtual&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;BindingBase&lt;/SPAN&gt; TextBinding { &lt;SPAN style="COLOR: blue"&gt;get&lt;/SPAN&gt;; &lt;SPAN style="COLOR: blue"&gt;set&lt;/SPAN&gt;; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpLast style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 12pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;}&lt;/SPAN&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;The three mechanisms to hook up the binding are:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpFirst style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;SelectedItemBinding&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;SelectedValueBinding&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpLast style="MARGIN: 0in 0in 10pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;TextBinding&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;These three bindings basically map to the cell’s content being bound to ComboBox.SelectedItem, ComboBox.SelectedValue, or ComboBox.Text respectively.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;SelectedValuePath and DisplayMemberPath are convenience methods on a ComboBox control and apply to ComboBox.SelectedValuePath and ComboBox.DisplayMemberBinding respectively.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Overall, you can think of these APIs as convenience methods that apply to the ComboBox element of the cell.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Let’s go through some use cases.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Some examples&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;When the column is bound to a primitive data type such as int, string, or bool, and you want the ComboBox to have a list of similar items to choose from, you can use SelectedItemBinding like so:&lt;/FONT&gt;&lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: #4f6228 1pt dashed; PADDING-RIGHT: 5pt; BORDER-TOP: #4f6228 1pt dashed; PADDING-LEFT: 5pt; BACKGROUND: #f6f5f0; PADDING-BOTTOM: 5pt; MARGIN-LEFT: 0.1in; BORDER-LEFT: #4f6228 1pt dashed; MARGIN-RIGHT: 0in; PADDING-TOP: 5pt; BORDER-BOTTOM: #4f6228 1pt dashed; mso-border-alt: dash-small-gap #4F6228 .5pt; mso-element: para-border-div; mso-border-themecolor: accent3; mso-border-themeshade: 128"&gt;
&lt;P class=codesampleCxSpFirst style="BACKGROUND: #f6f5f0; MARGIN: 12pt 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;dg&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;DataGridComboBoxColumn&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; SelectedItemBinding&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="{&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Binding&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; ShipCity&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;}"&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;dg&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;DataGridComboBoxColumn.ItemsSource&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;col&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;ArrayList&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;sys&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;String&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Redmond&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;sys&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;String&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;sys&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;String&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Bellevue&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;sys&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;String&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;sys&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;String&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Seattle&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;sys&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;String&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;sys&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;String&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Renton&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;sys&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;String&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;col&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;ArrayList&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;dg&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;DataGridComboBoxColumn.ItemsSource&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpLast style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 12pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;dg&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;DataGridComboBoxColumn&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;/FONT&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;ShipCity is a string type so the ComboBox.SelectedItem maps correctly to the item in the DataGrid’s column.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;Let’s say I have a foreign key relationship between an Orders table and a Customers table.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Orders contains a CustomerID foreign key and will be the ItemsSource for the DataGrid.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;I can setup a DataGridComboBoxColumn with Customers being its ItemsSource and hooking up the SelectedValueBinding like so:&lt;/FONT&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: #4f6228 1pt dashed; PADDING-RIGHT: 5pt; BORDER-TOP: #4f6228 1pt dashed; PADDING-LEFT: 5pt; BACKGROUND: #f6f5f0; PADDING-BOTTOM: 5pt; MARGIN-LEFT: 0.1in; BORDER-LEFT: #4f6228 1pt dashed; MARGIN-RIGHT: 0in; PADDING-TOP: 5pt; BORDER-BOTTOM: #4f6228 1pt dashed; mso-border-alt: dash-small-gap #4F6228 .5pt; mso-element: para-border-div; mso-border-themecolor: accent3; mso-border-themeshade: 128"&gt;
&lt;P class=codesampleCxSpFirst style="BACKGROUND: #f6f5f0; MARGIN: 12pt 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;dg&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;DataGridComboBoxColumn&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; SelectedValueBinding&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="{&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Binding&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; CustomerID&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;}"&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;SelectedValuePath&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="CustomerID"&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;DisplayMemberPath&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="ContactName"&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;Header&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="CustomerID (ContactName alias using SelectedValueBinding)"&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpLast style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 12pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;ItemsSource&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="{&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Binding&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Source&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;={&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;StaticResource&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; customerDataProvider&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;}}"&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;/FONT&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;SelectedValueBinding maps to Orders’ CustomerID, which also maps to Customers’ CustomerID through SelectedValuePath.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;I use DisplayMemberPath to alias the CustomerID with a more user friendly value to the end user.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;You can download the solution to these examples &lt;A class="" href="http://blogs.msdn.com/vinsibal/attachment/9026733.ashx" mce_href="http://blogs.msdn.com/vinsibal/attachment/9026733.ashx"&gt;here&lt;/A&gt;.&lt;/FONT&gt;&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9026733" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-components-postattachments/00-09-02-67-33/DataGrid_5F00_V1_5F00_ComboBoxColumnSamples.zip" length="433229" type="application/x-zip-compressed" /><category domain="http://blogs.msdn.com/b/vinsibal/archive/tags/DataGrid/">DataGrid</category><category domain="http://blogs.msdn.com/b/vinsibal/archive/tags/DataGrid+Samples/">DataGrid Samples</category></item><item><title>WPF DataGrid and the WPFToolKit have released!</title><link>http://blogs.msdn.com/b/vinsibal/archive/2008/10/22/wpf-datagrid-and-the-wpftoolkit-have-released.aspx</link><pubDate>Wed, 22 Oct 2008 17:10:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9011120</guid><dc:creator>Vincent Sibal - MSFT</dc:creator><slash:comments>29</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/vinsibal/rsscomments.aspx?WeblogPostID=9011120</wfw:commentRss><comments>http://blogs.msdn.com/b/vinsibal/archive/2008/10/22/wpf-datagrid-and-the-wpftoolkit-have-released.aspx#comments</comments><description>&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;Finally, the v1 WPF DataGrid is out!&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;This is an out-of-band release that will be hosted on the &lt;/FONT&gt;&lt;A href="http://www.codeplex.com/wpf" mce_href="http://www.codeplex.com/wpf"&gt;&lt;FONT face=Calibri size=3&gt;WPF CodePlex site&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Calibri size=3&gt; and integrated into the WPF Framework in vNext.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;You can download the bits as well as the source code &lt;A class="" href="http://www.codeplex.com/wpf/Release/ProjectReleases.aspx?ReleaseId=15598" mce_href="http://www.codeplex.com/wpf/Release/ProjectReleases.aspx?ReleaseId=15598"&gt;here&lt;/A&gt;.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;You also may be pleased to hear that included with the WPFToolKit are other controls and features such as DatePicker, Calendar, and VSM!&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;For any questions/feedback/issues you may have you can post them on the &lt;/FONT&gt;&lt;A href="http://www.codeplex.com/wpf/Thread/List.aspx" mce_href="http://www.codeplex.com/wpf/Thread/List.aspx"&gt;&lt;FONT face=Calibri size=3&gt;WPF CodePlex discussion list&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Calibri size=3&gt;.&amp;nbsp; Also, be sure to check our &lt;A class="" href="http://www.codeplex.com/wpf/Wiki/View.aspx?title=Tips%20%26%20Tricks" mce_href="http://www.codeplex.com/wpf/Wiki/View.aspx?title=Tips%20%26%20Tricks"&gt;Tips&amp;nbsp;&amp;amp; Tricks&lt;/A&gt; section on the CodePlex site for more resources and help.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;&lt;STRONG&gt;So what’s new in the v1 WPF DataGrid?&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Here are some of the features that were not in the CTP:&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpFirst style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="FONT-FAMILY: symbol; mso-fareast-font-family: symbol; mso-bidi-font-family: symbol"&gt;&lt;SPAN style="mso-list: ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;Row Validation&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="FONT-FAMILY: symbol; mso-fareast-font-family: symbol; mso-bidi-font-family: symbol"&gt;&lt;SPAN style="mso-list: ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;Row Details&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="FONT-FAMILY: symbol; mso-fareast-font-family: symbol; mso-bidi-font-family: symbol"&gt;&lt;SPAN style="mso-list: ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;Row Resizing&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="FONT-FAMILY: symbol; mso-fareast-font-family: symbol; mso-bidi-font-family: symbol"&gt;&lt;SPAN style="mso-list: ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;Hidden Columns&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="FONT-FAMILY: symbol; mso-fareast-font-family: symbol; mso-bidi-font-family: symbol"&gt;&lt;SPAN style="mso-list: ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;Column virtualization&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="FONT-FAMILY: symbol; mso-fareast-font-family: symbol; mso-bidi-font-family: symbol"&gt;&lt;SPAN style="mso-list: ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;Read-only columns and cells&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="FONT-FAMILY: symbol; mso-fareast-font-family: symbol; mso-bidi-font-family: symbol"&gt;&lt;SPAN style="mso-list: ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;Make-over of DataGridComboBoxColumn&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="FONT-FAMILY: symbol; mso-fareast-font-family: symbol; mso-bidi-font-family: symbol"&gt;&lt;SPAN style="mso-list: ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;Design experience for the DataGrid in Cider and Blend&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="FONT-FAMILY: symbol; mso-fareast-font-family: symbol; mso-bidi-font-family: symbol"&gt;&lt;SPAN style="mso-list: ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;UIAutomation support&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="FONT-FAMILY: symbol; mso-fareast-font-family: symbol; mso-bidi-font-family: symbol"&gt;&lt;SPAN style="mso-list: ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;Star column width redesign&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpLast style="MARGIN: 0in 0in 10pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="FONT-FAMILY: symbol; mso-fareast-font-family: symbol; mso-bidi-font-family: symbol"&gt;&lt;SPAN style="mso-list: ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;Lots of bug fixes&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;There is a walkthrough of the feature set on windowsclient.net &lt;A class="" href="http://windowsclient.net/wpf/wpf35/wpf-35sp1-toolkit-datagrid-feature-walkthrough.aspx" mce_href="http://windowsclient.net/wpf/wpf35/wpf-35sp1-toolkit-datagrid-feature-walkthrough.aspx"&gt;here&lt;/A&gt;&amp;nbsp;and a hands-on lab that you can do &lt;A class="" href="http://windowsclient.net/downloads/folders/hands-on-labs/entry76491.aspx" mce_href="http://windowsclient.net/downloads/folders/hands-on-labs/entry76491.aspx"&gt;here&lt;/A&gt;. I have updated the CTP Sample to include the new features.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;You can bind to all of the DataGrid and DataGridColumn properties in real-time and I also included samples for DataTable and Linq to SQL scenarios.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;You can download the sample &lt;A class="" href="http://blogs.msdn.com/vinsibal/attachment/9011120.ashx" mce_href="http://blogs.msdn.com/vinsibal/attachment/9011120.ashx"&gt;here&lt;/A&gt;.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;&lt;A href="http://blogs.msdn.com/blogfiles/vinsibal/WindowsLiveWriter/WPFDataGridandtheWPFToolKithavereleased_66D8/DataGrid_V1_Sample_2.jpg" mce_href="http://blogs.msdn.com/blogfiles/vinsibal/WindowsLiveWriter/WPFDataGridandtheWPFToolKithavereleased_66D8/DataGrid_V1_Sample_2.jpg"&gt;&lt;IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=516 alt=DataGrid_V1_Sample src="http://blogs.msdn.com/blogfiles/vinsibal/WindowsLiveWriter/WPFDataGridandtheWPFToolKithavereleased_66D8/DataGrid_V1_Sample_thumb.jpg" width=660 border=0 mce_src="http://blogs.msdn.com/blogfiles/vinsibal/WindowsLiveWriter/WPFDataGridandtheWPFToolKithavereleased_66D8/DataGrid_V1_Sample_thumb.jpg"&gt;&lt;/A&gt; &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;I also plan to update all my previous posts and samples with the updated bits.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;For better organization, I have made additional tags for DataGrid sample and DataGrid concepts.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;If you have any feedback or particular samples that you would like to see please let me know.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; Stay tuned for addtional material on the DataGrid, VSM, and more.&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;STRONG&gt;Breaking changes and how to update&amp;nbsp;CTP&amp;nbsp;code&amp;nbsp;to v1 &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun: yes"&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;1.&amp;nbsp; Update the xaml namespace from: &lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;xmlns&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;dg&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;="clr-namespace:Microsoft.Windows.Controls;assembly=WpfToolkit" &lt;/SPAN&gt;To: &lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;xmlns&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;dg&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;=&lt;/SPAN&gt;&lt;A href="http://schemas.microsoft.com/wpf/2008/toolkit"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;http://schemas.microsoft.com/wpf/2008/toolkit&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;2.&amp;nbsp; Update the 'DataFieldBinding' property to 'Binding'&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;3.&amp;nbsp; Update DataGridComboBoxColumn.DataFieldBinding to DataGridComboBoxColumn.SelectedItemBinding&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;4.&amp;nbsp; Include this namespace in code behind, using&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Microsoft.Windows.Controls.Primitives;&lt;/SPAN&gt;&lt;/P&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9011120" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-components-postattachments/00-09-01-11-20/DataGrid_5F00_V1_5F00_Sample.zip" length="570800" type="application/x-zip-compressed" /><category domain="http://blogs.msdn.com/b/vinsibal/archive/tags/DataGrid/">DataGrid</category><category domain="http://blogs.msdn.com/b/vinsibal/archive/tags/DataGrid+Samples/">DataGrid Samples</category></item><item><title>WPF 3.5 SP1 sources are now available!</title><link>http://blogs.msdn.com/b/vinsibal/archive/2008/10/22/wpf-3-5-sp1-sources-are-now-available.aspx</link><pubDate>Wed, 22 Oct 2008 16:00:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9011062</guid><dc:creator>Vincent Sibal - MSFT</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/vinsibal/rsscomments.aspx?WeblogPostID=9011062</wfw:commentRss><comments>http://blogs.msdn.com/b/vinsibal/archive/2008/10/22/wpf-3-5-sp1-sources-are-now-available.aspx#comments</comments><description>The Reference Source Code Center team has just announced that the WPF 3.5 SP1 sources are now publicly available.&amp;nbsp; You can read about it here, &lt;A href="http://blogs.msdn.com/rscc/archive/2008/10/22/wpf-sources-for-net-framework-3-5-sp1-are-available.aspx"&gt;http://blogs.msdn.com/rscc/archive/2008/10/22/wpf-sources-for-net-framework-3-5-sp1-are-available.aspx&lt;/A&gt;.&amp;nbsp; The post also has pointers on how to setup and where to post any issues or feedback.&amp;nbsp; Enjoy!&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9011062" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/vinsibal/archive/tags/WPF+3-5+SP1/">WPF 3.5 SP1</category></item><item><title>Overview of the editing features in the WPF DataGrid</title><link>http://blogs.msdn.com/b/vinsibal/archive/2008/10/01/overview-of-the-editing-features-in-the-wpf-datagrid.aspx</link><pubDate>Wed, 01 Oct 2008 17:50:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8971714</guid><dc:creator>Vincent Sibal - MSFT</dc:creator><slash:comments>35</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/vinsibal/rsscomments.aspx?WeblogPostID=8971714</wfw:commentRss><comments>http://blogs.msdn.com/b/vinsibal/archive/2008/10/01/overview-of-the-editing-features-in-the-wpf-datagrid.aspx#comments</comments><description>&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Introduction&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;I’m going to talk a little on the editing features of the DataGrid.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;I will dive deep into a couple things but overall I just want to give you a good idea of the APIs you can work with and how to tweak a couple things.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;So basically I will be introducing a bit of the internal implementation that may be beneficial for you to understand, the editing commands and how to customize, and the editing events that are available.&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Background on the data source and DataGrid working together&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;Some major updates were done in 3.5 SP1 to enable this editing scenario for the &lt;I style="mso-bidi-font-style: normal"&gt;DataGrid&lt;/I&gt;.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;In particular, the &lt;I style="mso-bidi-font-style: normal"&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/system.componentmodel.ieditablecollectionview.aspx" mce_href="http://msdn.microsoft.com/en-us/library/system.componentmodel.ieditablecollectionview.aspx"&gt;IEditableCollectionView&lt;/A&gt;&lt;/I&gt; interface was added and &lt;I style="mso-bidi-font-style: normal"&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/system.windows.data.listcollectionview.aspx" mce_href="http://msdn.microsoft.com/en-us/library/system.windows.data.listcollectionview.aspx"&gt;ListCollectionView&lt;/A&gt;&lt;/I&gt; and &lt;I style="mso-bidi-font-style: normal"&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/system.windows.data.bindinglistcollectionview.aspx" mce_href="http://msdn.microsoft.com/en-us/library/system.windows.data.bindinglistcollectionview.aspx"&gt;BindingListCollectionView&lt;/A&gt;&lt;/I&gt; were updated to support this interface.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Read more on &lt;I style="mso-bidi-font-style: normal"&gt;IEditableCollectionView&lt;/I&gt; &lt;/FONT&gt;&lt;A href="http://blogs.msdn.com/vinsibal/archive/2008/05/20/wpf-3-5-sp1-feature-ieditablecollectionview.aspx" mce_href="http://blogs.msdn.com/vinsibal/archive/2008/05/20/wpf-3-5-sp1-feature-ieditablecollectionview.aspx"&gt;&lt;FONT size=3 face=Calibri&gt;here&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;As a refresher, &lt;I style="mso-bidi-font-style: normal"&gt;ListCollectionView&lt;/I&gt; is the view created for an &lt;I style="mso-bidi-font-style: normal"&gt;ItemsControl&lt;/I&gt; when your data source implements &lt;I style="mso-bidi-font-style: normal"&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/system.collections.ilist.aspx" mce_href="http://msdn.microsoft.com/en-us/library/system.collections.ilist.aspx"&gt;IList&lt;/A&gt;&lt;/I&gt; such as &lt;I style="mso-bidi-font-style: normal"&gt;ObservableCollection&amp;lt;T&amp;gt;&lt;/I&gt;. &lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;I style="mso-bidi-font-style: normal"&gt;BindingListCollectionView&lt;/I&gt; is the view created for an &lt;I style="mso-bidi-font-style: normal"&gt;ItemsControl&lt;/I&gt; when your data source implements &lt;I style="mso-bidi-font-style: normal"&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/system.componentmodel.ibindinglist.aspx" mce_href="http://msdn.microsoft.com/en-us/library/system.componentmodel.ibindinglist.aspx"&gt;IBindingList&lt;/A&gt; &lt;/I&gt;such as an ADO.net DataView.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;The DataGrid uses &lt;I style="mso-bidi-font-style: normal"&gt;IEditableCollectionView&lt;/I&gt; underneath the covers to support transactional editing as well as adding and removing data items.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;In the implementations of &lt;I style="mso-bidi-font-style: normal"&gt;IEditableCollectionView&lt;/I&gt; in &lt;I style="mso-bidi-font-style: normal"&gt;ListCollectionView&lt;/I&gt; and &lt;I style="mso-bidi-font-style: normal"&gt;BindingListCollectionView&lt;/I&gt;, they both follow the &lt;I style="mso-bidi-font-style: normal"&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/system.componentmodel.ieditableobject.aspx" mce_href="http://msdn.microsoft.com/en-us/library/system.componentmodel.ieditableobject.aspx"&gt;IEditableObject&lt;/A&gt;&lt;/I&gt; pattern where the calls to &lt;I style="mso-bidi-font-style: normal"&gt;IEditableCollectionView.EditItem&lt;/I&gt;, &lt;I style="mso-bidi-font-style: normal"&gt;IEditableCollectionView.CancelEdit&lt;/I&gt;, and &lt;I style="mso-bidi-font-style: normal"&gt;IEditableCollectionView.CommitEdit&lt;/I&gt; end up calling &lt;I style="mso-bidi-font-style: normal"&gt;IEditableObject.BeginEdit&lt;/I&gt;, &lt;I style="mso-bidi-font-style: normal"&gt;IEditableObject.CancelEdit&lt;/I&gt;, and &lt;I style="mso-bidi-font-style: normal"&gt;IEditableObject.CommitEdit&lt;/I&gt; respectively.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;It is in the implementation of &lt;I style="mso-bidi-font-style: normal"&gt;IEditableObject&lt;/I&gt; where you can provide the functionality to commit or rollback changes to the data source.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;For an ADO.net DataTable, you get this functionality for free as DataRowView already implements &lt;I style="mso-bidi-font-style: normal"&gt;IEditableObject&lt;/I&gt;.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;When using an &lt;I style="mso-bidi-font-style: normal"&gt;ObservableCollection&amp;lt;T&amp;gt;&lt;/I&gt; you will have to provide your own implementation for &lt;I style="mso-bidi-font-style: normal"&gt;IEditableObject&lt;/I&gt; for T.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;See the MSDN documentation of &lt;I style="mso-bidi-font-style: normal"&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/system.componentmodel.ieditableobject.aspx" mce_href="http://msdn.microsoft.com/en-us/library/system.componentmodel.ieditableobject.aspx"&gt;IEditableObject&lt;/A&gt;&lt;/I&gt; for an example of how to implement it for a data item.&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;Things to keep in mind:&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 10pt 0.5in; mso-list: l1 level1 lfo2" class=MsoListParagraph&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT size=3 face=Calibri&gt;DataGrid checks for &lt;I style="mso-bidi-font-style: normal"&gt;IEditableCollectionView’s&lt;/I&gt; &lt;I style="mso-bidi-font-style: normal"&gt;CanAddNew&lt;/I&gt;, &lt;I style="mso-bidi-font-style: normal"&gt;CanCancelEdit&lt;/I&gt;, and &lt;I style="mso-bidi-font-style: normal"&gt;CanRemove&lt;/I&gt; properties before executing the &lt;I style="mso-bidi-font-style: normal"&gt;EditItem&lt;/I&gt;, &lt;I style="mso-bidi-font-style: normal"&gt;CancelEdit&lt;/I&gt;, or &lt;I style="mso-bidi-font-style: normal"&gt;CommitEdit&lt;/I&gt; methods.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;So if editing appears to not work for some reason, be sure to check that it is able to edit.&lt;/FONT&gt;&lt;/P&gt;
&lt;TABLE style="BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; MARGIN: auto auto auto 0.25in; BORDER-COLLAPSE: collapse; BORDER-TOP: medium none; BORDER-RIGHT: medium none; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-padding-alt: 0in 5.4pt 0in 5.4pt; mso-yfti-tbllook: 1184" class=MsoTableGrid border=1 cellSpacing=0 cellPadding=0 class="MsoTableGrid"&gt;
&lt;TBODY&gt;
&lt;TR style="mso-yfti-irow: 0; mso-yfti-firstrow: yes"&gt;
&lt;TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black 1pt solid; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.4pt; WIDTH: 159.6pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: black 1pt solid; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid black .5pt; mso-border-themecolor: text1" vAlign=top width=213&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal&gt;&lt;o:p&gt;&lt;FONT size=3 face=Calibri&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;&lt;/TD&gt;
&lt;TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.4pt; WIDTH: 159.6pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: black 1pt solid; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-border-left-alt: solid black .5pt; mso-border-left-themecolor: text1" vAlign=top width=213&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;ListCollectionView&lt;/FONT&gt;&lt;/P&gt;&lt;/TD&gt;
&lt;TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.4pt; WIDTH: 159.6pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: black 1pt solid; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-border-left-alt: solid black .5pt; mso-border-left-themecolor: text1" vAlign=top width=213&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;BindingListCollectionView&lt;/FONT&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR style="mso-yfti-irow: 1"&gt;
&lt;TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black 1pt solid; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.4pt; WIDTH: 159.6pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-border-top-alt: solid black .5pt; mso-border-top-themecolor: text1" vAlign=top width=213&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;CanAddNew&lt;/FONT&gt;&lt;/P&gt;&lt;/TD&gt;
&lt;TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.4pt; WIDTH: 159.6pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-border-left-alt: solid black .5pt; mso-border-left-themecolor: text1; mso-border-top-alt: solid black .5pt; mso-border-top-themecolor: text1; mso-border-bottom-themecolor: text1; mso-border-right-themecolor: text1" vAlign=top width=213&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;True if there is not an edit transaction occurring, if the collection is not a fixed size, and if it can create an object of the correct type.&lt;/FONT&gt;&lt;/P&gt;&lt;/TD&gt;
&lt;TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.4pt; WIDTH: 159.6pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-border-left-alt: solid black .5pt; mso-border-left-themecolor: text1; mso-border-top-alt: solid black .5pt; mso-border-top-themecolor: text1; mso-border-bottom-themecolor: text1; mso-border-right-themecolor: text1" vAlign=top width=213&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;True if there is not an edit transaction occurring, if the collection is not a fixed size, and if the collection is not read-only.&lt;/FONT&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR style="mso-yfti-irow: 2"&gt;
&lt;TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black 1pt solid; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.4pt; WIDTH: 159.6pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-border-top-alt: solid black .5pt; mso-border-top-themecolor: text1" vAlign=top width=213&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;CanCancelEdit&lt;/FONT&gt;&lt;/P&gt;&lt;/TD&gt;
&lt;TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.4pt; WIDTH: 159.6pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-border-left-alt: solid black .5pt; mso-border-left-themecolor: text1; mso-border-top-alt: solid black .5pt; mso-border-top-themecolor: text1; mso-border-bottom-themecolor: text1; mso-border-right-themecolor: text1" vAlign=top width=213&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;True if the edited item implements the &lt;I style="mso-bidi-font-style: normal"&gt;IEditableObject&lt;/I&gt; interface.&lt;/FONT&gt;&lt;/P&gt;&lt;/TD&gt;
&lt;TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.4pt; WIDTH: 159.6pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-border-left-alt: solid black .5pt; mso-border-left-themecolor: text1; mso-border-top-alt: solid black .5pt; mso-border-top-themecolor: text1; mso-border-bottom-themecolor: text1; mso-border-right-themecolor: text1" vAlign=top width=213&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;True if the edited item implements the &lt;I style="mso-bidi-font-style: normal"&gt;IEditableObject&lt;/I&gt; interface.&lt;/FONT&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR style="mso-yfti-irow: 3; mso-yfti-lastrow: yes"&gt;
&lt;TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black 1pt solid; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.4pt; WIDTH: 159.6pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-border-top-alt: solid black .5pt; mso-border-top-themecolor: text1" vAlign=top width=213&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;CanRemove&lt;/FONT&gt;&lt;/P&gt;&lt;/TD&gt;
&lt;TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.4pt; WIDTH: 159.6pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-border-left-alt: solid black .5pt; mso-border-left-themecolor: text1; mso-border-top-alt: solid black .5pt; mso-border-top-themecolor: text1; mso-border-bottom-themecolor: text1; mso-border-right-themecolor: text1" vAlign=top width=213&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;True if the collection is not a fixed size and if an add or edit transaction is not occurring. &lt;/FONT&gt;&lt;/P&gt;&lt;/TD&gt;
&lt;TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.4pt; WIDTH: 159.6pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-border-left-alt: solid black .5pt; mso-border-left-themecolor: text1; mso-border-top-alt: solid black .5pt; mso-border-top-themecolor: text1; mso-border-bottom-themecolor: text1; mso-border-right-themecolor: text1" vAlign=top width=213&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;True if the collection is not a fixed size and if an add or edit transaction is not occurring and if the collection is not read-only.&lt;/FONT&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;
&lt;P style="MARGIN: 0in 0in 10pt 0.25in" class=MsoNormal&gt;&lt;o:p&gt;&lt;FONT size=3 face=Calibri&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;For information on how the data binding is hooked to the UI, see this post on &lt;/FONT&gt;&lt;A href="http://blogs.msdn.com/vinsibal/archive/2008/08/19/wpf-datagrid-stock-and-template-columns.aspx" mce_href="http://blogs.msdn.com/vinsibal/archive/2008/08/19/wpf-datagrid-stock-and-template-columns.aspx"&gt;&lt;FONT size=3 face=Calibri&gt;Stock and Template Columns&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3 face=Calibri&gt; and &lt;/FONT&gt;&lt;A href="http://blogs.msdn.com/vinsibal/archive/2008/08/14/wpf-datagrid-dissecting-the-visual-layout.aspx" mce_href="http://blogs.msdn.com/vinsibal/archive/2008/08/14/wpf-datagrid-dissecting-the-visual-layout.aspx"&gt;&lt;FONT size=3 face=Calibri&gt;Dissecting the Visual Layout&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Note about DataGrid properties related to editing&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;There are three properties on DataGrid to control editing/adding/deleting.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;These properties are:&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l1 level1 lfo2" class=MsoListParagraphCxSpFirst&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;CanUserAddRows&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l1 level1 lfo2" class=MsoListParagraphCxSpMiddle&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;CanUserDeleteRows&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 10pt 0.5in; mso-list: l1 level1 lfo2" class=MsoListParagraphCxSpLast&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;I style="mso-bidi-font-style: normal"&gt;IsReadOnly&lt;/I&gt; (not in CTP)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;They are basically self-documenting but beware of &lt;I style="mso-bidi-font-style: normal"&gt;CanUserAddRows&lt;/I&gt; and &lt;I style="mso-bidi-font-style: normal"&gt;CanUserDeleteRows&lt;/I&gt; as they can appear a little magical.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Their values are coerced based on other properties such as &lt;I style="mso-bidi-font-style: normal"&gt;DataGrid.IsReadOnly&lt;/I&gt;, &lt;I style="mso-bidi-font-style: normal"&gt;DataGrid.IsEnabled&lt;/I&gt;, &lt;I style="mso-bidi-font-style: normal"&gt;IEditableCollectionView.CanAddNew&lt;/I&gt;, and &lt;I style="mso-bidi-font-style: normal"&gt;IEditableCollectionView.CanRemove&lt;/I&gt;.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;So this is another thing to watch out for when editing.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;If you run into a situation where you set CanUserAddRows or CanUserDeleteRows to true but it is changed to false automatically, check that the conditions below are met.&lt;/FONT&gt;&lt;/P&gt;
&lt;TABLE style="BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; BORDER-COLLAPSE: collapse; BORDER-TOP: medium none; BORDER-RIGHT: medium none; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-padding-alt: 0in 5.4pt 0in 5.4pt; mso-yfti-tbllook: 1184" class=MsoTableGrid border=1 cellSpacing=0 cellPadding=0 class="MsoTableGrid"&gt;
&lt;TBODY&gt;
&lt;TR style="mso-yfti-irow: 0; mso-yfti-firstrow: yes"&gt;
&lt;TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black 1pt solid; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.4pt; WIDTH: 239.4pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: black 1pt solid; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid black .5pt; mso-border-themecolor: text1" vAlign=top width=319&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;CanUserAddRows&lt;/FONT&gt;&lt;/P&gt;&lt;/TD&gt;
&lt;TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.4pt; WIDTH: 239.4pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: black 1pt solid; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-border-left-alt: solid black .5pt; mso-border-left-themecolor: text1" vAlign=top width=319&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;True if the DataGrid is not ReadOnly and IsEnabled, CanUserAddRows is set to true and IEditableCollectionView.CanAddNew is true&lt;/FONT&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR style="mso-yfti-irow: 1; mso-yfti-lastrow: yes"&gt;
&lt;TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black 1pt solid; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.4pt; WIDTH: 239.4pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-border-top-alt: solid black .5pt; mso-border-top-themecolor: text1" vAlign=top width=319&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;CanUserDeleteRows&lt;/FONT&gt;&lt;/P&gt;&lt;/TD&gt;
&lt;TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.4pt; WIDTH: 239.4pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-border-left-alt: solid black .5pt; mso-border-left-themecolor: text1; mso-border-top-alt: solid black .5pt; mso-border-top-themecolor: text1; mso-border-bottom-themecolor: text1; mso-border-right-themecolor: text1" vAlign=top width=319&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;True if the DataGid is not ReadOnly and IsEnabled, CanUserDeleteRows is set to true and IEditableCollectionView.CanRemove is true&lt;/FONT&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;o:p&gt;&lt;FONT size=3 face=Calibri&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Working with editing commands&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;Default commands have been added to the &lt;I style="mso-bidi-font-style: normal"&gt;DataGrid&lt;/I&gt; to support editing.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;These commands and their default input bindings are:&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l2 level1 lfo3" class=MsoListParagraphCxSpFirst&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;I style="mso-bidi-font-style: normal"&gt;BeginEditCommand&lt;/I&gt; (F2)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l2 level1 lfo3" class=MsoListParagraphCxSpMiddle&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;I style="mso-bidi-font-style: normal"&gt;CancelEditCommand&lt;/I&gt; (Esc)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l2 level1 lfo3" class=MsoListParagraphCxSpMiddle&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;I style="mso-bidi-font-style: normal"&gt;CommitEditCommand&lt;/I&gt; (Enter)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 10pt 0.5in; mso-list: l2 level1 lfo3" class=MsoListParagraphCxSpLast&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;I style="mso-bidi-font-style: normal"&gt;DeleteCommand&lt;/I&gt; (Delete)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;When each command is executed it will do some internal housekeeping and at some point it will call into its &lt;I style="mso-bidi-font-style: normal"&gt;IEditableCollectionView&lt;/I&gt; counterpart.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;For example, &lt;I style="mso-bidi-font-style: normal"&gt;BeginEditCommand&lt;/I&gt; calls into &lt;I style="mso-bidi-font-style: normal"&gt;IEditableCollectionView.EditItem &lt;/I&gt;and &lt;I style="mso-bidi-font-style: normal"&gt;CancelEditCommand&lt;/I&gt; calls into &lt;I style="mso-bidi-font-style: normal"&gt;IEditableCollectionView.CancelItem&lt;/I&gt;.&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;DataGrid also has APIs where you can call editing commands programmatically.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Not surprisingly, the APIs are &lt;I style="mso-bidi-font-style: normal"&gt;BeginEdit&lt;/I&gt;, &lt;I style="mso-bidi-font-style: normal"&gt;CancelEdit&lt;/I&gt;, and &lt;I style="mso-bidi-font-style: normal"&gt;CommitEdit&lt;/I&gt;.&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Adding new input gestures&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;Adding new input gestures is similar to any other control in WPF.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;The DataGrid commands are added through the &lt;I style="mso-bidi-font-style: normal"&gt;CommandManager&lt;/I&gt; so one possible solution would be to register a new &lt;I style="mso-bidi-font-style: normal"&gt;InputBinding &lt;/I&gt;with the&lt;I style="mso-bidi-font-style: normal"&gt; CommandManager&lt;/I&gt;:&lt;/FONT&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;DIV style="BORDER-BOTTOM: #4f6228 1pt dashed; BORDER-LEFT: #4f6228 1pt dashed; PADDING-BOTTOM: 5pt; PADDING-LEFT: 5pt; PADDING-RIGHT: 5pt; BACKGROUND: #f6f5f0; MARGIN-LEFT: 0.1in; BORDER-TOP: #4f6228 1pt dashed; MARGIN-RIGHT: 0in; BORDER-RIGHT: #4f6228 1pt dashed; PADDING-TOP: 5pt; mso-border-alt: dash-small-gap #4F6228 .5pt; mso-element: para-border-div; mso-border-themecolor: accent3; mso-border-themeshade: 128"&gt;
&lt;P style="MARGIN: 12pt 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpFirst&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: #2b91af; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;CommandManager&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;.RegisterClassInputBinding(&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-tab-count: 5"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;typeof&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;(&lt;SPAN style="COLOR: #2b91af"&gt;DataGrid&lt;/SPAN&gt;),&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 12pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpLast&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;InputBinding&lt;/SPAN&gt;(&lt;SPAN style="COLOR: #2b91af"&gt;DataGrid&lt;/SPAN&gt;.BeginEditCommand, &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;KeyGesture&lt;/SPAN&gt;(&lt;SPAN style="COLOR: #2b91af"&gt;Key&lt;/SPAN&gt;.&amp;lt;new key&amp;gt;)));&lt;/SPAN&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;o:p&gt;&lt;FONT size=3 face=Calibri&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Disabling commands&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;You can disable any of the editing commands by attaching to the &lt;I style="mso-bidi-font-style: normal"&gt;CommandManager.CanExecuteEvent&lt;/I&gt;, looking for the command to disable, then setting e.CanExecute accordingly.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Here is an example:&lt;/FONT&gt;&lt;/P&gt;
&lt;DIV style="BORDER-BOTTOM: #4f6228 1pt dashed; BORDER-LEFT: #4f6228 1pt dashed; PADDING-BOTTOM: 5pt; PADDING-LEFT: 5pt; PADDING-RIGHT: 5pt; BACKGROUND: #f6f5f0; MARGIN-LEFT: 0.1in; BORDER-TOP: #4f6228 1pt dashed; MARGIN-RIGHT: 0in; BORDER-RIGHT: #4f6228 1pt dashed; PADDING-TOP: 5pt; mso-border-alt: dash-small-gap #4F6228 .5pt; mso-element: para-border-div; mso-border-themecolor: accent3; mso-border-themeshade: 128"&gt;
&lt;P style="MARGIN: 12pt 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpFirst&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;_handler = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;CanExecuteRoutedEventHandler&lt;/SPAN&gt;(OnCanExecuteRoutedEventHandler);&lt;SPAN style="COLOR: #2b91af"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: #2b91af; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;EventManager&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;.RegisterClassHandler(&lt;SPAN style="COLOR: blue"&gt;typeof&lt;/SPAN&gt;(&lt;SPAN style="COLOR: #2b91af"&gt;DataGrid&lt;/SPAN&gt;), &lt;SPAN style="COLOR: #2b91af"&gt;CommandManager&lt;/SPAN&gt;.CanExecuteEvent, _handler);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;void&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; OnCanExecuteRoutedEventHandler(&lt;SPAN style="COLOR: blue"&gt;object&lt;/SPAN&gt; sender, &lt;SPAN style="COLOR: #2b91af"&gt;CanExecuteRoutedEventArgs&lt;/SPAN&gt; e)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: #2b91af; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;RoutedCommand&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; routedCommand = (e.Command &lt;SPAN style="COLOR: blue"&gt;as&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;RoutedCommand&lt;/SPAN&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; (routedCommand != &lt;SPAN style="COLOR: blue"&gt;null&lt;/SPAN&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; (routedCommand.Name == &lt;SPAN style="COLOR: #a31515"&gt;"&amp;lt;command name&amp;gt;"&lt;/SPAN&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;e.CanExecute = &amp;lt;some condition&amp;gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;(!e.CanExecute)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpMiddle&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 5"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;e.Handled = &lt;SPAN style="COLOR: blue"&gt;true&lt;/SPAN&gt;;&lt;BR&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;SPAN style="COLOR: blue"&gt;&lt;BR&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="mso-tab-count: 1"&gt; &lt;/SPAN&gt;}&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 12pt; BACKGROUND: #f6f5f0; mso-add-space: auto" class=codesampleCxSpLast&gt;&lt;SPAN style="LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;}&lt;/SPAN&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;This is a relatively cumbersome way of disabling an editing command from being executed.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Fortunately events were added to the DataGrid so that they can be canceled in a more direct fashion (although no direct event exists for the &lt;I style="mso-bidi-font-style: normal"&gt;DeleteCommand&lt;/I&gt;).&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Editing events on the DataGrid&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;These are the editing events that you can listen to and cancel the operation or modify data:&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo1" class=MsoListParagraphCxSpFirst&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;RowEditEnding&lt;/FONT&gt;&lt;/FONT&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo1" class=MsoListParagraphCxSpMiddle&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;CellEditEnding&lt;/FONT&gt;&lt;/FONT&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo1" class=MsoListParagraphCxSpMiddle&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;BeginningEdit&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo1" class=MsoListParagraphCxSpMiddle&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;PreparingCellForEdit&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 10pt 0.5in; mso-list: l0 level1 lfo1" class=MsoListParagraphCxSpLast&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;InitializingNewItem&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;In the first three events; Row&lt;I style="mso-bidi-font-style: normal"&gt;EditEnding&lt;/I&gt;, &lt;I style="mso-bidi-font-style: normal"&gt;CellEditEnding&lt;/I&gt;, and &lt;I style="mso-bidi-font-style: normal"&gt;BeginningEdit&lt;/I&gt;, you have access to the &lt;I style="mso-bidi-font-style: normal"&gt;DataGridRow&lt;/I&gt; and &lt;I style="mso-bidi-font-style: normal"&gt;DataGridColumn&lt;/I&gt; that is being committed, cancelled, or edited.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;These events are called right before the actual operation will occur.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;You have the ability to cancel the operation completely by setting e.Cancel to true.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; RowEditEnding and CellEditEnding both have a parameter EditAction which lets you know if it is a commit or cancel action.&amp;nbsp; &lt;/SPAN&gt;From&amp;nbsp;&lt;I style="mso-bidi-font-style: normal"&gt;CellEditEnding&lt;/I&gt;, you also have access to the editing &lt;I style="mso-bidi-font-style: normal"&gt;FrameworkElement&lt;/I&gt;.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;This gives you the ability to set or get properties on the visual itself before a cell commit or cancel.&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;I style="mso-bidi-font-style: normal"&gt;PreparingCellForEdit&lt;/I&gt; is fired right after the cell has changed from a non-editing state to an editing state.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;In this event you have the ability to modify the contents of the cell.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;I style="mso-bidi-font-style: normal"&gt;InitializingNewItem&lt;/I&gt; is called when a new item is added and in this event you have the option to set any properties on the newly created item.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;This event is good when you want to set initial default values on a new item.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Summary&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;So hopefully this will give you an idea on what APIs you have available for editing scenarios as well as some gotchas on how particular editing features work.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;If there is other editing questions/topics that you would like to read about please let me know.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Another item that I plan to discuss in the future is how row validation will be tied into the DataGrid, so stay tuned!&lt;/FONT&gt;&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8971714" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/vinsibal/archive/tags/DataGrid/">DataGrid</category><category domain="http://blogs.msdn.com/b/vinsibal/archive/tags/DataGrid+Concepts/">DataGrid Concepts</category></item><item><title>Check out the WPF Application Quality Guide v0.3</title><link>http://blogs.msdn.com/b/vinsibal/archive/2008/09/28/check-out-the-wpf-application-quality-guide-v0-3.aspx</link><pubDate>Mon, 29 Sep 2008 07:46:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8968440</guid><dc:creator>Vincent Sibal - MSFT</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/vinsibal/rsscomments.aspx?WeblogPostID=8968440</wfw:commentRss><comments>http://blogs.msdn.com/b/vinsibal/archive/2008/09/28/check-out-the-wpf-application-quality-guide-v0-3.aspx#comments</comments><description>The &lt;A class="" href="http://windowsclient.net/wpf/white-papers/wpf-app-quality-guide.aspx" mce_href="http://windowsclient.net/wpf/white-papers/wpf-app-quality-guide.aspx"&gt;WPF Application Quality Guide v0.3&lt;/A&gt; has just released!&amp;nbsp; For more information on it, check out Ivo's blog post &lt;A class="" href="http://blogs.msdn.com/ivo_manolov/archive/2008/09/28/8968407.aspx" mce_href="http://blogs.msdn.com/ivo_manolov/archive/2008/09/28/8968407.aspx"&gt;here&lt;/A&gt;.&amp;nbsp; I especially like the new road map section on the different personas and suggested readings.&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8968440" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/vinsibal/archive/tags/WPF+Application+Quality+Guide/">WPF Application Quality Guide</category></item><item><title>Pasting content to new rows on the WPF DataGrid</title><link>http://blogs.msdn.com/b/vinsibal/archive/2008/09/25/pasting-content-to-new-rows-on-the-wpf-datagrid.aspx</link><pubDate>Thu, 25 Sep 2008 17:59:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8965111</guid><dc:creator>Vincent Sibal - MSFT</dc:creator><slash:comments>12</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/vinsibal/rsscomments.aspx?WeblogPostID=8965111</wfw:commentRss><comments>http://blogs.msdn.com/b/vinsibal/archive/2008/09/25/pasting-content-to-new-rows-on-the-wpf-datagrid.aspx#comments</comments><description>&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;On a previous &lt;/FONT&gt;&lt;A href="http://blogs.msdn.com/vinsibal/archive/2008/09/19/wpf-datagrid-clipboard-paste-sample.aspx" mce_href="http://blogs.msdn.com/vinsibal/archive/2008/09/19/wpf-datagrid-clipboard-paste-sample.aspx"&gt;&lt;FONT face=Calibri size=3&gt;post&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt; I talked about how to implement Clipboard.Paste for the DataGrid.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;The functionality was such that you could only paste to existing rows and cells.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;I got a customer request on how to paste to new rows so I thought I’d capture it here.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;If you want to be able to paste to new rows, you just need to call IEditableCollectionView.AddNew before pasting to that row and optionally update selection.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Here is the updated OnExecutePaste code to the previous sample,&lt;/FONT&gt;&lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: #4f6228 1pt dashed; PADDING-RIGHT: 5pt; BORDER-TOP: #4f6228 1pt dashed; PADDING-LEFT: 5pt; BACKGROUND: #f6f5f0; PADDING-BOTTOM: 5pt; MARGIN-LEFT: 0.1in; BORDER-LEFT: #4f6228 1pt dashed; MARGIN-RIGHT: 0in; PADDING-TOP: 5pt; BORDER-BOTTOM: #4f6228 1pt dashed; mso-border-alt: dash-small-gap #4F6228 .5pt; mso-border-themecolor: accent3; mso-border-themeshade: 128; mso-element: para-border-div"&gt;
&lt;P class=codesampleCxSpFirst style="BACKGROUND: #f6f5f0; MARGIN: 12pt 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;protected&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: blue"&gt;virtual&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; OnExecutedPaste(&lt;SPAN style="COLOR: #2b91af"&gt;ExecutedRoutedEventArgs&lt;/SPAN&gt; args)&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;{&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: green; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;// parse the clipboard data&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;List&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;&lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt;[]&amp;gt; rowData = &lt;SPAN style="COLOR: #2b91af"&gt;ClipboardHelper&lt;/SPAN&gt;.ParseClipboardData();&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;bool&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; hasAddedNewRow = &lt;SPAN style="COLOR: blue"&gt;false&lt;/SPAN&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: green; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;// call OnPastingCellClipboardContent for each cell&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;int&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; minRowIndex = Items.IndexOf(CurrentItem);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;int&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; maxRowIndex = Items.Count - 1;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;int&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; minColumnDisplayIndex = (SelectionUnit != &lt;SPAN style="COLOR: #2b91af"&gt;DataGridSelectionUnit&lt;/SPAN&gt;.FullRow) ? Columns.IndexOf(CurrentColumn) : 0;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;int&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; maxColumnDisplayIndex = Columns.Count - 1;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;int&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; rowDataIndex = 0;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;for&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; (&lt;SPAN style="COLOR: blue"&gt;int&lt;/SPAN&gt; i = minRowIndex; i &amp;lt;= maxRowIndex &amp;amp;&amp;amp; rowDataIndex &amp;lt; rowData.Count; i++, rowDataIndex++)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="BACKGROUND: yellow; mso-highlight: yellow"&gt;if&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt; (CanUserPasteToNewRows &amp;amp;&amp;amp; CanUserAddRows &amp;amp;&amp;amp; i == maxRowIndex)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: green; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;&lt;SPAN style="mso-tab-count: 5"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;// add a new row to be pasted to&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: #2b91af; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;&lt;SPAN style="mso-tab-count: 5"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;ICollectionView&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt; cv = &lt;SPAN style="COLOR: #2b91af"&gt;CollectionViewSource&lt;/SPAN&gt;.GetDefaultView(Items);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: #2b91af; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;&lt;SPAN style="mso-tab-count: 5"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;IEditableCollectionView&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt; iecv = cv &lt;SPAN style="COLOR: blue"&gt;as&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;IEditableCollectionView&lt;/SPAN&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;&lt;SPAN style="mso-tab-count: 5"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt; (iecv != &lt;SPAN style="COLOR: blue"&gt;null&lt;/SPAN&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;&lt;SPAN style="mso-tab-count: 5"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;&lt;SPAN style="mso-tab-count: 6"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;hasAddedNewRow = &lt;SPAN style="COLOR: blue"&gt;true&lt;/SPAN&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;&lt;SPAN style="mso-tab-count: 6"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;iecv.AddNew();&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;&lt;SPAN style="mso-tab-count: 6"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt; (rowDataIndex + 1 &amp;lt; rowData.Count)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;&lt;SPAN style="mso-tab-count: 6"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: green; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;&lt;SPAN style="mso-tab-count: 7"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;// still has more items to paste, update the maxRowIndex&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;&lt;SPAN style="mso-tab-count: 7"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;maxRowIndex = Items.Count - 1;&lt;SPAN style="COLOR: blue"&gt;&lt;BR&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="mso-tab-count: 5"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;BR&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;else&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt; &lt;SPAN style="COLOR: blue"&gt;if&lt;/SPAN&gt; (i == maxRowIndex)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;&lt;SPAN style="mso-tab-count: 6"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;continue&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;;&lt;BR&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;int&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; columnDataIndex = 0;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;for&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; (&lt;SPAN style="COLOR: blue"&gt;int&lt;/SPAN&gt; j = minColumnDisplayIndex; j &amp;lt; maxColumnDisplayIndex &amp;amp;&amp;amp; columnDataIndex &amp;lt; rowData[rowDataIndex].Length; j++, columnDataIndex++)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;DataGridColumn&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; column = ColumnFromDisplayIndex(j);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;column.OnPastingCellClipboardContent(Items[i], rowData[rowDataIndex][columnDataIndex]);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: green; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="BACKGROUND: yellow; mso-highlight: yellow"&gt;// update selection&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt; (hasAddedNewRow)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;{&lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;UnselectAll();&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;UnselectAllCells();&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;CurrentItem = Items[minRowIndex];&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt; (SelectionUnit == &lt;SPAN style="COLOR: #2b91af"&gt;DataGridSelectionUnit&lt;/SPAN&gt;.FullRow)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;SelectedItem = Items[minRowIndex];&lt;SPAN style="COLOR: blue"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;else&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt; &lt;SPAN style="COLOR: blue"&gt;if&lt;/SPAN&gt; (SelectionUnit == &lt;SPAN style="COLOR: #2b91af"&gt;DataGridSelectionUnit&lt;/SPAN&gt;.CellOrRowHeader || SelectionUnit == &lt;SPAN style="COLOR: #2b91af"&gt;DataGridSelectionUnit&lt;/SPAN&gt;.Cell)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; BACKGROUND: yellow; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-highlight: yellow"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;BR&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;SelectedCells.Add(&lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;DataGridCellInfo&lt;/SPAN&gt;(Items[minRowIndex], &lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;Columns[minColumnDisplayIndex]));&lt;BR&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;SPAN style="COLOR: blue"&gt;&lt;BR&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="mso-tab-count: 1"&gt; &lt;/SPAN&gt;}&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpLast style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 12pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;}&lt;/SPAN&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;/FONT&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;So with this new logic you can paste a set of rows starting at the NewItemPlaceholder and it will create a set of new rows where all the content will be pasted.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;For the selection logic, I just made it pretty basic and didn’t really enforce any specific requirements.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Other than that, I just added one DP, CanUserPasteToNewRows, just to turn it on and off for this example.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Here is the updated &lt;A class="" href="http://blogs.msdn.com/vinsibal/attachment/8965111.ashx" mce_href="http://blogs.msdn.com/vinsibal/attachment/8965111.ashx"&gt;solution&lt;/A&gt;.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8965111" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-components-postattachments/00-08-96-51-11/DataGrid_5F00_V1_5F00_ClipboardPaste_5F00_Sample2.zip" length="1197202" type="application/x-zip-compressed" /><category domain="http://blogs.msdn.com/b/vinsibal/archive/tags/DataGrid/">DataGrid</category><category domain="http://blogs.msdn.com/b/vinsibal/archive/tags/DataGrid+Samples/">DataGrid Samples</category></item><item><title>WPF DataGrid - Clipboard Paste Sample</title><link>http://blogs.msdn.com/b/vinsibal/archive/2008/09/19/wpf-datagrid-clipboard-paste-sample.aspx</link><pubDate>Fri, 19 Sep 2008 17:55:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8958860</guid><dc:creator>Vincent Sibal - MSFT</dc:creator><slash:comments>12</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/vinsibal/rsscomments.aspx?WeblogPostID=8958860</wfw:commentRss><comments>http://blogs.msdn.com/b/vinsibal/archive/2008/09/19/wpf-datagrid-clipboard-paste-sample.aspx#comments</comments><description>&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;In the v1 release (and CTP) of the WPF DataGrid there will be support for Clipboard.Copy but no support out of the box for Clipboard.Paste.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;However, there is extensibility support for Clipboard.Paste which I will show&amp;nbsp;how to implement in this post.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;In DataGridColumn.cs an additional API, &lt;I style="mso-bidi-font-style: normal"&gt;OnPastingCellClipboardContent&lt;/I&gt;, exists so you can add pasting functionality to each DataGridCell.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;A similar API, &lt;I style="mso-bidi-font-style: normal"&gt;OnCopyingCellClipboardContent&lt;/I&gt;, also exists and behaves the same way except it&amp;nbsp;is used from copying content.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;I style="mso-bidi-font-style: normal"&gt;OnPastingCellClipboardContent&lt;/I&gt; has two parameters; &lt;I style="mso-bidi-font-style: normal"&gt;item&lt;/I&gt;, which is the particular data item in the list of DataGrid.Items to update, and &lt;I style="mso-bidi-font-style: normal"&gt;cellContent&lt;/I&gt;, which is the actual content to add to the cell itself.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;So with that in mind, what I need to do is get the content currently on the clipboard, parse the data, and then call &lt;I style="mso-bidi-font-style: normal"&gt;OnPastingCellClipboardContent&lt;/I&gt; for each cell.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;I’m also going to setup a command that is similar to the Copy command and I’ve decided to subclass DataGrid.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Here is the code for creating the command:&lt;/FONT&gt;&lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: #4f6228 1pt dashed; PADDING-RIGHT: 5pt; BORDER-TOP: #4f6228 1pt dashed; PADDING-LEFT: 5pt; BACKGROUND: #f6f5f0; PADDING-BOTTOM: 5pt; MARGIN-LEFT: 0.1in; BORDER-LEFT: #4f6228 1pt dashed; MARGIN-RIGHT: 0in; PADDING-TOP: 5pt; BORDER-BOTTOM: #4f6228 1pt dashed; mso-border-alt: dash-small-gap #4F6228 .5pt; mso-border-themecolor: accent3; mso-border-themeshade: 128; mso-element: para-border-div"&gt;
&lt;P class=codesampleCxSpFirst style="BACKGROUND: #f6f5f0; MARGIN: 12pt 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;public&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: blue"&gt;class&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;CustomDataGrid&lt;/SPAN&gt; : &lt;SPAN style="COLOR: #2b91af"&gt;DataGrid&lt;/SPAN&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;static&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; CustomDataGrid()&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;CommandManager&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;.RegisterClassCommandBinding(&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 6"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;typeof&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;(&lt;SPAN style="COLOR: #2b91af"&gt;CustomDataGrid&lt;/SPAN&gt;),&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 6"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;new&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: #2b91af"&gt;CommandBinding&lt;/SPAN&gt;(&lt;SPAN style="COLOR: #2b91af"&gt;ApplicationCommands&lt;/SPAN&gt;.Paste,&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 7"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;new&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: #2b91af"&gt;ExecutedRoutedEventHandler&lt;/SPAN&gt;(OnExecutedPaste),&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 7"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;new&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: #2b91af"&gt;CanExecuteRoutedEventHandler&lt;/SPAN&gt;(OnCanExecutePaste)));&lt;SPAN style="COLOR: blue"&gt;&lt;BR&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="mso-tab-count: 1"&gt; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;…&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpLast style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 12pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;}&lt;/SPAN&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;In the copy scenario, the OnCanExecuteCopy only fires if you have selected cells.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;For the onCanExecutePaste scenario I want it to be such that you can paste content as long as any particular cell is selected.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;So in my OnCanExecutePaste method, I only need the CurrentCell to not be null.&lt;/FONT&gt;&lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: #4f6228 1pt dashed; PADDING-RIGHT: 5pt; BORDER-TOP: #4f6228 1pt dashed; PADDING-LEFT: 5pt; BACKGROUND: #f6f5f0; PADDING-BOTTOM: 5pt; MARGIN-LEFT: 0.1in; BORDER-LEFT: #4f6228 1pt dashed; MARGIN-RIGHT: 0in; PADDING-TOP: 5pt; BORDER-BOTTOM: #4f6228 1pt dashed; mso-border-alt: dash-small-gap #4F6228 .5pt; mso-border-themecolor: accent3; mso-border-themeshade: 128; mso-element: para-border-div"&gt;
&lt;P class=codesampleCxSpFirst style="BACKGROUND: #f6f5f0; MARGIN: 12pt 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;protected&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: blue"&gt;virtual&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; OnCanExecutePaste(&lt;SPAN style="COLOR: #2b91af"&gt;CanExecuteRoutedEventArgs&lt;/SPAN&gt; args)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;args.CanExecute = CurrentCell != &lt;SPAN style="COLOR: blue"&gt;null&lt;/SPAN&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;args.Handled = &lt;SPAN style="COLOR: blue"&gt;true&lt;/SPAN&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpLast style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 12pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;/FONT&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Before getting into OnExecutePaste, I want to talk just a little bit about the parsing stuff.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;I created a simple parser for CSV and Text format.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;The algorithms are pretty straightforward so I’m not going to show them here.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;The parser should work when copying data from the WPF DataGrid as well as copying Excel data to the WPF DataGrid.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;For Excel data I’m using the Text parser.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;What the parser returns is a list of a list which basically represent the rows and cells of a DataGrid.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;So in my OnExecutePaste method, I am going to iterate through the set of cells starting at the CurrentCell.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;It is possible that the set of content to be pasted is more than the set of cells to paste them in or visa-versa.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;So I need to keep track of the max rows and columns that can be pasted to as well as the max data that can be placed in the cells.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Here is the code snippet:&lt;/FONT&gt;&lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: #4f6228 1pt dashed; PADDING-RIGHT: 5pt; BORDER-TOP: #4f6228 1pt dashed; PADDING-LEFT: 5pt; BACKGROUND: #f6f5f0; PADDING-BOTTOM: 5pt; MARGIN-LEFT: 0.1in; BORDER-LEFT: #4f6228 1pt dashed; MARGIN-RIGHT: 0in; PADDING-TOP: 5pt; BORDER-BOTTOM: #4f6228 1pt dashed; mso-border-alt: dash-small-gap #4F6228 .5pt; mso-border-themecolor: accent3; mso-border-themeshade: 128; mso-element: para-border-div"&gt;
&lt;P class=codesampleCxSpFirst style="BACKGROUND: #f6f5f0; MARGIN: 12pt 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;protected&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: blue"&gt;virtual&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; OnExecutedPaste(&lt;SPAN style="COLOR: #2b91af"&gt;ExecutedRoutedEventArgs&lt;/SPAN&gt; args)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;{&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: green; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;// parse the clipboard data&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;List&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;&lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt;[]&amp;gt; rowData = &lt;SPAN style="COLOR: #2b91af"&gt;ClipboardHelper&lt;/SPAN&gt;.ParseClipboardData();&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: green; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;// call OnPastingCellClipboardContent for each cell&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;int&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; minRowIndex = Items.IndexOf(CurrentItem);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;int&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; maxRowIndex = Items.Count - 1;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;int&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; minColumnDisplayIndex = (SelectionUnit != &lt;SPAN style="COLOR: #2b91af"&gt;DataGridSelectionUnit&lt;/SPAN&gt;.FullRow) ? Columns.IndexOf(CurrentColumn) : 0;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;int&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; maxColumnDisplayIndex = Columns.Count - 1;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;int&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; rowDataIndex = 0;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;for&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; (&lt;SPAN style="COLOR: blue"&gt;int&lt;/SPAN&gt; i = minRowIndex; i &amp;lt; maxRowIndex &amp;amp;&amp;amp; rowDataIndex &amp;lt; rowData.Count; i++, rowDataIndex++)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;{&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;int&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; columnDataIndex = 0;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;for&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; (&lt;SPAN style="COLOR: blue"&gt;int&lt;/SPAN&gt; j = minColumnDisplayIndex; j &amp;lt; maxColumnDisplayIndex &amp;amp;&amp;amp; columnDataIndex &amp;lt; rowData[rowDataIndex].Length; j++, columnDataIndex++)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;DataGridColumn&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; column = ColumnFromDisplayIndex(j);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;column.OnPastingCellClipboardContent(Items[i], rowData[rowDataIndex][columnDataIndex]);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpMiddle style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 0pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=codesampleCxSpLast style="BACKGROUND: #f6f5f0; MARGIN: 0in 0in 12pt; mso-add-space: auto"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 125%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;}&lt;/SPAN&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;I did&amp;nbsp;make one condition when SelectionUnit is equal to FullRow.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;For that scenario when users copy a full row and paste to another full row the column index should not matter as their intention is to paste the entire row to the new row.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;So for that I set minColumnDisplayIndex to 0.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;You can check out the full sample &lt;A class="" href="http://blogs.msdn.com/vinsibal/attachment/8958860.ashx" mce_href="http://blogs.msdn.com/vinsibal/attachment/8958860.ashx"&gt;here&lt;/A&gt;.&amp;nbsp; For more information on clipboard paste see this &lt;A class="" href="http://blogs.msdn.com/vinsibal/archive/2008/09/25/pasting-content-to-new-rows-on-the-wpf-datagrid.aspx" mce_href="http://blogs.msdn.com/vinsibal/archive/2008/09/25/pasting-content-to-new-rows-on-the-wpf-datagrid.aspx"&gt;post&lt;/A&gt;&amp;nbsp;which is another sample.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Other DataGrid Samples:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;A class="" href="http://blogs.msdn.com/vinsibal/archive/2008/08/25/wpf-datagrid-sample-add-a-preview-tooltip-to-a-scrollviewer.aspx" mce_href="http://blogs.msdn.com/vinsibal/archive/2008/08/25/wpf-datagrid-sample-add-a-preview-tooltip-to-a-scrollviewer.aspx"&gt;&lt;FONT color=#006ff7&gt;ScrollViewer with ToolTip&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A class="" href="http://blogs.msdn.com/vinsibal/archive/2008/08/27/more-datagrid-samples-custom-sorting-drag-and-drop-of-rows-column-selection-and-single-click-editing.aspx" mce_href="http://blogs.msdn.com/vinsibal/archive/2008/08/27/more-datagrid-samples-custom-sorting-drag-and-drop-of-rows-column-selection-and-single-click-editing.aspx"&gt;&lt;FONT color=#006ff7&gt;Custom sorting, column selection, single-click editing&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A class="" href="http://blogs.msdn.com/vinsibal/archive/2008/08/29/wpf-datagrid-tri-state-sorting-sample.aspx" mce_href="http://blogs.msdn.com/vinsibal/archive/2008/08/29/wpf-datagrid-tri-state-sorting-sample.aspx"&gt;&lt;FONT color=#006ff7&gt;Tri-state sorting&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&lt;A class="" href="http://blogs.msdn.com/vinsibal/archive/2008/09/16/wpf-datagrid-styling-rows-and-columns-based-on-header-conditions-and-other-properties.aspx" mce_href="http://blogs.msdn.com/vinsibal/archive/2008/09/16/wpf-datagrid-styling-rows-and-columns-based-on-header-conditions-and-other-properties.aspx"&gt;&lt;FONT color=#006ff7&gt;Styling rows and columns based on header conditions&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8958860" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-components-postattachments/00-08-95-88-60/DataGrid_5F00_V1_5F00_ClipboardPaste_5F00_Sample.zip" length="1197129" type="application/x-zip-compressed" /><category domain="http://blogs.msdn.com/b/vinsibal/archive/tags/DataGrid/">DataGrid</category><category domain="http://blogs.msdn.com/b/vinsibal/archive/tags/DataGrid+Samples/">DataGrid Samples</category></item></channel></rss>
