<?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>WPF &amp; Silverlight Designer</title><link>http://blogs.msdn.com/b/wpfsldesigner/</link><description>The Visual Designer for creating WPF &amp;amp; Silverlight applications in Visual Studio</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>Debugging Data Bindings in a WPF or Silverlight Application</title><link>http://blogs.msdn.com/b/wpfsldesigner/archive/2010/06/30/debugging-data-bindings-in-a-wpf-or-silverlight-application.aspx</link><pubDate>Thu, 01 Jul 2010 03:41:21 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10033241</guid><dc:creator>karl140.6</dc:creator><slash:comments>4</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/wpfsldesigner/rsscomments.aspx?WeblogPostID=10033241</wfw:commentRss><comments>http://blogs.msdn.com/b/wpfsldesigner/archive/2010/06/30/debugging-data-bindings-in-a-wpf-or-silverlight-application.aspx#comments</comments><description>&lt;p&gt;The WPF and Silverlight platforms use late bound data binding resolution for bindings in XAML files. This feature allows a DataContext to be set at run-time and the objects within that DataContext to resolve their property bindings then. This late binding enables cool features like DataTemplates, composable applications and run-time loading of loose XAML. &lt;/p&gt;  &lt;p&gt;A side effect of late bound binding resolution that can cause developers some minor frustration is that their controls do not display the expected data at run-time. &lt;/p&gt;  &lt;p&gt;This article will explain troubleshooting techniques that can help you locate and correct the problem. &lt;/p&gt;  &lt;h1&gt;Data Binding Overview &lt;/h1&gt;  &lt;p&gt;Data binding is fundamental to WPF and Silverlight. You will struggle with your application designs, coding and troubleshooting until you understand data binding in these platforms. &lt;/p&gt;  &lt;p&gt;The best data binding resource available is the MSDN &lt;a href="http://msdn.microsoft.com/en-us/library/ms752347.aspx"&gt;Data Binding Overview&lt;/a&gt; topic. If you have not read or don't fully understand the material in this topic, please take the required amount of time to learn this material. &lt;/p&gt;  &lt;h1&gt;Ounce of Prevention is Worth a Pound of Cure &lt;/h1&gt;  &lt;p&gt;Visual Studio 2010 has great tooling to wire up data bindings and checked them at design-time. Please read this article: &lt;a href="http://blogs.msdn.com/b/wpfsldesigner/archive/2010/06/14/how-to-enable-using-the-binding-builder-in-wpf-and-silverlight-applications.aspx"&gt;How to Enable Using the Binding Builder in WPF and Silverlight Applications&lt;/a&gt;. &lt;/p&gt;  &lt;p&gt;Visual Studio 2010 has excellent design-time sample data support. If you use design-time sample data, you'll immediately see controls that don't have expected data values at design-time. &lt;/p&gt;  &lt;p&gt;For a detailed examination of sample data in the WPF and Silverlight Designer for Visual Studio 2010, please read this article: &lt;a href="http://blogs.msdn.com/b/wpfsldesigner/archive/2010/06/30/sample-data-in-the-wpf-and-silverlight-designer.aspx"&gt;Sample Data in the WPF and Silverlight Designer&lt;/a&gt;. &lt;/p&gt;  &lt;h1&gt;Troubleshooting List &lt;/h1&gt;  &lt;ul&gt;   &lt;li&gt;Verify that DataContext is set in either XAML or code &lt;/li&gt;    &lt;li&gt;     &lt;div&gt;Run the application and view the output in the Debug Output Window &lt;/div&gt;      &lt;ul&gt;       &lt;li&gt;For WPF applications you can increase or decrease the amount of information displayed in the Debug Output Window by changing the WPF Trace Settings, Data Binding value &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;Name the control that has DataContext assigned, set a break point in the code, and view the named control's DataContext property in the debugger &lt;/li&gt;    &lt;li&gt;If binding to a CLR object, put a breakpoint in the source property getter to see that its actually being queried &lt;/li&gt;    &lt;li&gt;Add a converter to a binding, then put a breakpoint in the converter &lt;/li&gt; &lt;/ul&gt;  &lt;br /&gt;  &lt;h1&gt;Verify that DataContext is set in either XAML or Code &lt;/h1&gt;  &lt;p&gt;This tip is along the lines of, &amp;quot;if the TV won't turn on, check that it's plugged in.&amp;quot; &lt;/p&gt;  &lt;p&gt;This is important for many reasons, but one is easily overlooked; &lt;span style="text-decoration: underline"&gt;if a DataContext is null, the Debug Output Window will not display any error messages in Silverlight or in WPF&lt;/span&gt;. &lt;/p&gt;  &lt;p&gt;In WPF you can use the below PresentationTraceSources on a binding and set the TraceLevel to High to view errors related to a null DataContext. &lt;/p&gt;  &lt;h1&gt;View the Debug Output Window &lt;/h1&gt;  &lt;p&gt;If you have the DataContext set, any data bindings within that DataContext that can't be resolved will be listed in the Debug Output Window at run-time. &lt;/p&gt;  &lt;h2&gt;Sample Debug Output Window Data Binding Error &lt;/h2&gt;  &lt;p&gt;&lt;strong&gt;Sample One &lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;System.Windows.Data Error: 40 : BindingExpression path error: &lt;strong&gt;'&lt;span style="color: red"&gt;FirstName&lt;/span&gt;'&lt;/strong&gt; property not found on 'object' ''&lt;span style="color: red"&gt;&lt;strong&gt;Object&lt;/strong&gt;&lt;/span&gt;' (HashCode=62178992)'. BindingExpression:Path=&lt;span style="color: red"&gt;&lt;strong&gt;FirstName&lt;/strong&gt;&lt;/span&gt;; DataItem='&lt;span style="color: red"&gt;&lt;strong&gt;Object&lt;/strong&gt;&lt;/span&gt;' (HashCode=62178992); target element is '&lt;span style="color: red"&gt;&lt;strong&gt;TextBox&lt;/strong&gt;&lt;/span&gt;' (Name=''); target property is '&lt;span style="color: red"&gt;&lt;strong&gt;Text&lt;/strong&gt;&lt;/span&gt;' (type 'String') &lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Sample Two &lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;System.Windows.Data Error: 40 : BindingExpression path error: '&lt;span style="color: red"&gt;&lt;strong&gt;FirstName&lt;/strong&gt;&lt;/span&gt;' property not found on 'object' ''&lt;span style="color: red"&gt;&lt;strong&gt;Customer&lt;/strong&gt;&lt;/span&gt;' (HashCode=13640894)'. BindingExpression:Path=&lt;span style="color: red"&gt;&lt;strong&gt;FirstName&lt;/strong&gt;&lt;/span&gt;; DataItem='&lt;span style="color: red"&gt;&lt;strong&gt;Customer&lt;/strong&gt;&lt;/span&gt;' (HashCode=13640894); target element is '&lt;span style="color: red"&gt;&lt;strong&gt;TextBox&lt;/strong&gt;&lt;/span&gt;' (Name=''); target property is '&lt;span style="color: red"&gt;&lt;strong&gt;Tag&lt;/strong&gt;&lt;/span&gt;' (type 'Object') &lt;/span&gt;&lt;/p&gt;  &lt;p&gt;While the above messages look verbose and complex, you can glean several interesting points of information that will help you correct this data binding: &lt;/p&gt;  &lt;ul style="margin-left: 38pt"&gt;   &lt;li&gt;The Binding Path is FirstName. Search your XAML file for FirstName and see if you expect the DataContext to expose a FirstName property whose scope will allow this binding to resolve this property. &lt;/li&gt;    &lt;li&gt;The Source object in Sample One is of Type Object. There is a good chance the Type Object does not have a FirstName property. &lt;/li&gt;    &lt;li&gt;The Source object in Sample Two is of Type Customer. Check your Customer Type; does it have a FirstName property? &lt;/li&gt;    &lt;li&gt;Notice in Sample Two, the target property is Tag. In all likelihood, the Text property was the desired target property and not Tag. Also the Type of Tag is Object; you would probably be expecting String when binding to the FirstName property. &lt;/li&gt; &lt;/ul&gt;  &lt;h3&gt;Review &lt;/h3&gt;  &lt;ul&gt;   &lt;li&gt;Verify the property name is spelled correctly &lt;/li&gt;    &lt;li&gt;Verify the property name has the correct character casing. FirstName is not the same as firstName. &lt;/li&gt;    &lt;li&gt;Verify the property is a member of the DataContext Type &lt;/li&gt;    &lt;li&gt;Verify the target element is the correct Type &lt;/li&gt;    &lt;li&gt;Verify the target property name and Type are correct &lt;/li&gt; &lt;/ul&gt;  &lt;br /&gt;  &lt;br /&gt;  &lt;div&gt;   &lt;table style="border-collapse: collapse" border="0" width="100%"&gt;&lt;colgroup&gt;&lt;col /&gt;&lt;/colgroup&gt;&lt;tbody valign="top"&gt;       &lt;tr style="background: #c0504d"&gt;         &lt;td style="border-bottom: #c0504d 1pt solid; border-left: #c0504d 1pt solid; padding-left: 7px; padding-right: 7px; border-top: #c0504d 1pt solid; border-right: #c0504d 1pt solid"&gt;           &lt;p&gt;&lt;span style="color: white"&gt;&lt;strong&gt;Important&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td style="border-bottom: #c0504d 1pt solid; border-left: #c0504d 1pt solid; padding-left: 7px; padding-right: 7px; border-top-style: none; border-right: #c0504d 1pt solid"&gt;           &lt;p&gt;Data binding property path names are &lt;strong&gt;Case Sensitive.&lt;/strong&gt;&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;     &lt;/tbody&gt;&lt;/table&gt; &lt;/div&gt;  &lt;br /&gt;  &lt;br /&gt;  &lt;h2&gt;WPF Trace Settings, Data Binding &lt;/h2&gt;  &lt;br /&gt;  &lt;div&gt;   &lt;table style="border-collapse: collapse" border="0" width="100%"&gt;&lt;colgroup&gt;&lt;col /&gt;&lt;/colgroup&gt;&lt;tbody valign="top"&gt;       &lt;tr style="background: #c0504d"&gt;         &lt;td style="border-bottom: #c0504d 1pt solid; border-left: #c0504d 1pt solid; padding-left: 7px; padding-right: 7px; border-top: #c0504d 1pt solid; border-right: #c0504d 1pt solid"&gt;           &lt;p&gt;&lt;span style="color: white"&gt;&lt;strong&gt;Important&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td style="border-bottom: #c0504d 1pt solid; border-left: #c0504d 1pt solid; padding-left: 7px; padding-right: 7px; border-top-style: none; border-right: #c0504d 1pt solid"&gt;           &lt;p&gt;The default value of the WPF Trace Settings, Data Binding is &amp;quot;Error.&amp;quot; It is recommended that you change this setting to &amp;quot;Warning.&amp;quot; Please read &lt;a href="http://karlshifflett.wordpress.com/2010/06/24/visual-studio-2010-wpf-trace-settings-default-is-incorrect/"&gt;this short blog post&lt;/a&gt; for more information. &lt;/p&gt;            &lt;p&gt;This is required if you use the attached property PresentationTraceSources.TraceLevel. If the value is set to &amp;quot;Error&amp;quot; you won't see any of the PresentationTraceSources.TraceLevel warning messages.&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;     &lt;/tbody&gt;&lt;/table&gt; &lt;/div&gt;  &lt;p&gt;To change the WPF Trace Settings, Data Binding value to &amp;quot;Warning,&amp;quot; navigate to Tools, Options, Debugging, Output Window, WPF Trace Settings, Data Binding and set the value to Warning as I've done in the below image. &lt;/p&gt;  &lt;p&gt;&lt;img alt="" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/3757.070110_5F00_0341_5F00_DebuggingDa1.png" /&gt; &lt;/p&gt;  &lt;div&gt;   &lt;table style="border-collapse: collapse" border="0" width="100%"&gt;&lt;colgroup&gt;&lt;col /&gt;&lt;/colgroup&gt;&lt;tbody valign="top"&gt;       &lt;tr style="background: #4f81bd"&gt;         &lt;td style="border-bottom: #4f81bd 1pt solid; border-left: #4f81bd 1pt solid; padding-left: 7px; padding-right: 7px; border-top: #4f81bd 1pt solid; border-right: #4f81bd 1pt solid"&gt;           &lt;p&gt;&lt;span style="color: white"&gt;&lt;strong&gt;Note&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td style="border-bottom: #4f81bd 1pt solid; border-left: #4f81bd 1pt solid; padding-left: 7px; padding-right: 7px; border-top-style: none; border-right: #4f81bd 1pt solid"&gt;           &lt;p&gt;This setting affects all bindings in WPF the application. For a more targeting approach, see the PresentationTraceSources.TraceLevel section below.&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;     &lt;/tbody&gt;&lt;/table&gt; &lt;/div&gt;  &lt;br /&gt;  &lt;br /&gt;  &lt;div&gt;   &lt;table style="border-collapse: collapse" border="0" width="100%"&gt;&lt;colgroup&gt;&lt;col /&gt;&lt;/colgroup&gt;&lt;tbody valign="top"&gt;       &lt;tr style="background: #c0504d"&gt;         &lt;td style="border-bottom: #c0504d 1pt solid; border-left: #c0504d 1pt solid; padding-left: 7px; padding-right: 7px; border-top: #c0504d 1pt solid; border-right: #c0504d 1pt solid"&gt;           &lt;p&gt;&lt;span style="color: white"&gt;&lt;strong&gt;Important&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td style="border-bottom: #c0504d 1pt solid; border-left: #c0504d 1pt solid; padding-left: 7px; padding-right: 7px; border-top-style: none; border-right: #c0504d 1pt solid"&gt;           &lt;p&gt;If this setting is set to, &amp;quot;Off&amp;quot; you will not see any WPF Data Binding Errors in the Debug Output Window.&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;     &lt;/tbody&gt;&lt;/table&gt; &lt;/div&gt;  &lt;br /&gt;  &lt;h2&gt;PresentationTraceSources.TraceLevel &lt;/h2&gt;  &lt;p&gt;Introduced to WPF in .NET 3.5 SP1, the &lt;a href="http://msdn.microsoft.com/en-us/library/system.diagnostics.presentationtracesources.tracelevel.aspx"&gt;PresentationTraceSources.TraceLevel&lt;/a&gt; attached property allows developers to dial up the amount of information outputted in the Debugger Output Window for a binding. &lt;/p&gt;  &lt;p&gt;The below XAML snippet shows how to apply the PresentationTraceSources.TraceLevel attached property to a binding.&amp;#160; &lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Window 
    &lt;/span&gt;&lt;span style="color: red"&gt;xmlns&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;diag&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;clr-namespace:System.Diagnostics;assembly=WindowsBase&amp;quot;
    &lt;/span&gt;&lt;span style="color: red"&gt;xmlns&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;local&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;clr-namespace:DebugDataBindings&amp;quot;
    &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Class&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;DebugDataBindings.MainWindow&amp;quot;
    &lt;/span&gt;&lt;span style="color: red"&gt;xmlns&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&amp;quot;
    &lt;/span&gt;&lt;span style="color: red"&gt;xmlns&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml&amp;quot;
    &lt;/span&gt;&lt;span style="color: red"&gt;Title&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;MainWindow&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;350&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;525&amp;quot;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;layoutRoot&amp;quot;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.Resources&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;local&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;DebugConverter &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Key&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;debugConverter&amp;quot; /&amp;gt; 
        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.Resources&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBox 
            &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=Customer.FirstName, &lt;/span&gt;&lt;span style="color: red"&gt;diag&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;PresentationTraceSources&lt;/span&gt;&lt;span style="color: blue"&gt;.TraceLevel=High}&amp;quot;   
            &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;23&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;HorizontalAlignment&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Left&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Margin&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;90,18,0,0&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Top&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;120&amp;quot;/&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Window&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&lt;/span&gt;&lt;/pre&gt;

&lt;h1&gt;Use the Debugger Quick Watch to View the DataContext &lt;/h1&gt;

&lt;p&gt;If the above suggestions to do not solve your problem: &lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Locate the control's parent panel like a Grid in your XAML &lt;/li&gt;

  &lt;li&gt;Apply a x:Name to the control &lt;/li&gt;

  &lt;li&gt;Set a break point in your code, and view the named panel control's DataContext property in the debugger &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Open the QuickWatch dialog, change the Expression to the named control in the XAML and look at the control's DataContext property. &lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;In the below image, I have changed the Expression to, &amp;quot;this.layoutRoot.DataContext&amp;quot; in VB.NET you would change it to, , &amp;quot;Me.layoutRoot.DataContext&amp;quot; &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This information will at least confirm the shape (Type) of the DataContext and the values inside the DataContext. &lt;/p&gt;

&lt;p&gt;This tip provides value in two ways: &lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;If the DataContext had been set then subsequently changed by some other code, you'll be expecting the initial value but will see another value &lt;/li&gt;

  &lt;li&gt;
    &lt;div&gt;If the property was nested within another class, you can easily see the shape of your DataContext and then ensure that your bindings are properly dotted in. &lt;/div&gt;

    &lt;ul&gt;
      &lt;li&gt;Notice the path to the FirstName property is DataContext.Customer.FirstName. &lt;/li&gt;

      &lt;li&gt;
        &lt;div&gt;This means that if you wanted to data bind to the Text property on a TextBox that was a child of the Grid named layoutRoot, the binding expression must read: &lt;/div&gt;

        &lt;p&gt;&lt;span style="font-family: consolas; color: blue; font-size: 9pt"&gt;&amp;lt;&lt;span style="color: #a31515"&gt;TextBox&lt;span style="color: red"&gt; Text&lt;span style="color: blue"&gt;=&amp;quot;{&lt;span style="color: #a31515"&gt;Binding&lt;span style="color: red"&gt; Path&lt;span style="color: blue"&gt;=Customer.FirstName}&amp;quot; ... /&amp;gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
      &lt;/li&gt;
    &lt;/ul&gt;

    &lt;p&gt;&lt;img alt="" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/6560.070110_5F00_0341_5F00_DebuggingDa2.png" /&gt;&lt;/p&gt;

    &lt;h1&gt;&lt;/h1&gt;

    &lt;p&gt;&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;Place a Breakpoint inside the Source Property Getter &lt;/h1&gt;

&lt;p&gt;If you are binding to a CLR object, put a breakpoint in the source property getter to see that it's actually being queried. &lt;/p&gt;

&lt;p&gt;If it's not be queried, you have a mismatch in the property name, property is not properly dotted in, DataContext is null or does not contain this property. &lt;/p&gt;

&lt;h1&gt;Add a Converter to a binding, then put a Breakpoint in the Converter &lt;/h1&gt;

&lt;div&gt;
  &lt;table style="border-collapse: collapse" border="0" width="100%"&gt;&lt;colgroup&gt;&lt;col /&gt;&lt;/colgroup&gt;&lt;tbody valign="top"&gt;
      &lt;tr style="background: #c0504d"&gt;
        &lt;td style="border-bottom: #c0504d 1pt solid; border-left: #c0504d 1pt solid; padding-left: 7px; padding-right: 7px; border-top: #c0504d 1pt solid; border-right: #c0504d 1pt solid"&gt;
          &lt;p&gt;&lt;span style="color: white"&gt;&lt;strong&gt;Important&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
        &lt;/td&gt;
      &lt;/tr&gt;

      &lt;tr&gt;
        &lt;td style="border-bottom: #c0504d 1pt solid; border-left: #c0504d 1pt solid; padding-left: 7px; padding-right: 7px; border-top-style: none; border-right: #c0504d 1pt solid"&gt;
          &lt;p&gt;The use of a converter to troubleshoot a data binding only works if the DataContext is not null, and the DataContext Type exposes a property with the same name in the binding expression.&lt;/p&gt;
        &lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;

&lt;p&gt;A ValueConverter allows you to view the data as its being moved between the target and source. In the below image the converter in the middle is named &amp;quot;ColorBrushConverter.&amp;quot; &lt;/p&gt;

&lt;p&gt;&lt;img alt="" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/2843.070110_5F00_0341_5F00_DebuggingDa3.png" /&gt; &lt;/p&gt;

&lt;p&gt;The below converter is a no-op converter named, &amp;quot;DebugConverter.&amp;quot; This reusable converter will allow you to place a breakpoint in the Convert and ConvertBack methods and then view the value of the &amp;quot;value&amp;quot; parameter at debug time.&amp;#160; &lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;using &lt;/span&gt;System;
&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Windows.Data;

&lt;span style="color: blue"&gt;namespace &lt;/span&gt;DebugDataBindings {
    &lt;span style="color: blue"&gt;public class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;DebugConverter &lt;/span&gt;: &lt;span style="color: #2b91af"&gt;IValueConverter &lt;/span&gt;{

        &lt;span style="color: blue"&gt;public &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Object &lt;/span&gt;Convert(&lt;span style="color: #2b91af"&gt;Object &lt;/span&gt;value, &lt;span style="color: #2b91af"&gt;Type &lt;/span&gt;targetType, &lt;span style="color: #2b91af"&gt;Object &lt;/span&gt;parameter, System.Globalization.&lt;span style="color: #2b91af"&gt;CultureInfo &lt;/span&gt;culture) {

            &lt;span style="color: green"&gt;//set a breakpoint here
            &lt;/span&gt;&lt;span style="color: blue"&gt;return &lt;/span&gt;value;
        }

        &lt;span style="color: blue"&gt;public &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Object &lt;/span&gt;ConvertBack(&lt;span style="color: #2b91af"&gt;Object &lt;/span&gt;value, &lt;span style="color: #2b91af"&gt;Type &lt;/span&gt;targetType, &lt;span style="color: #2b91af"&gt;Object &lt;/span&gt;parameter, System.Globalization.&lt;span style="color: #2b91af"&gt;CultureInfo &lt;/span&gt;culture) {

            &lt;span style="color: green"&gt;//set a breakpoint here
            &lt;/span&gt;&lt;span style="color: blue"&gt;return &lt;/span&gt;value;
        }
    }
}&lt;/pre&gt;

&lt;p&gt;The below XAML show the above converter being applied to the TextBox.Text property binding. &lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;layoutRoot&amp;quot;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.Resources&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;local&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;DebugConverter &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Key&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;debugConverter&amp;quot; /&amp;gt; 
        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.Resources&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBox &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=Customer.FirstName, &lt;/span&gt;&lt;span style="color: red"&gt;Converter&lt;/span&gt;&lt;span style="color: blue"&gt;={&lt;/span&gt;&lt;span style="color: #a31515"&gt;StaticResource &lt;/span&gt;&lt;span style="color: red"&gt;debugConverter&lt;/span&gt;&lt;span style="color: blue"&gt;}}&amp;quot;   
            &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;23&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;HorizontalAlignment&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Left&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Margin&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;90,18,0,0&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Top&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;120&amp;quot;/&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;

&lt;/span&gt;&lt;/pre&gt;

&lt;h1&gt;Comments &lt;/h1&gt;

&lt;p&gt;Microsoft values your opinion about our products and documentation. In addition to your general feedback it is very helpful to understand: &lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;How the above features enable your workflow &lt;/li&gt;

  &lt;li&gt;What is missing from the above features that would be helpful to you &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Thank you for your feedback and have a great day, &lt;/p&gt;

&lt;p&gt;Karl Shifflett 
  &lt;br /&gt;Expression Team &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10033241" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/wpfsldesigner/archive/tags/WPF/">WPF</category><category domain="http://blogs.msdn.com/b/wpfsldesigner/archive/tags/Silverlight/">Silverlight</category><category domain="http://blogs.msdn.com/b/wpfsldesigner/archive/tags/Tips+_2600_+Tricks/">Tips &amp; Tricks</category><category domain="http://blogs.msdn.com/b/wpfsldesigner/archive/tags/Data+Binding/">Data Binding</category><category domain="http://blogs.msdn.com/b/wpfsldesigner/archive/tags/Debugging/">Debugging</category></item><item><title>Tips and Tricks for working with the WPF and Silverlight Designer in Visual Studio 2010</title><link>http://blogs.msdn.com/b/wpfsldesigner/archive/2010/06/30/tips-and-tricks-for-working-with-the-wpf-and-silverlight-designer-in-visual-studio-2010.aspx</link><pubDate>Thu, 01 Jul 2010 01:32:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10033223</guid><dc:creator>karl140.6</dc:creator><slash:comments>7</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/wpfsldesigner/rsscomments.aspx?WeblogPostID=10033223</wfw:commentRss><comments>http://blogs.msdn.com/b/wpfsldesigner/archive/2010/06/30/tips-and-tricks-for-working-with-the-wpf-and-silverlight-designer-in-visual-studio-2010.aspx#comments</comments><description>&lt;p&gt;This article is a collection of tips and tricks that we have gathered over the time we've spent building and using the Visual Studio 2010 WPF and Silverlight Designer, which you might not find elsewhere. We think they make working in the designer more fun and productive experience &amp;ndash; we hope you'll agree! &lt;/p&gt;
&lt;div class="toc"&gt;
&lt;h4&gt;Table of Contents&lt;/h4&gt;
&lt;ol class="list"&gt;
&lt;li&gt;&lt;a href="#tip1"&gt;Tip 1: Install Silverlight 4 Tools even if you are building WPF apps &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#tip2"&gt;Tip 2: The Properties Window works when just editing XAML too. &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#tip3"&gt;Tip 3: Getting the Properties Window to work when working with Resource Dictionaries and App.xaml &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#tip4"&gt;Tip 4: Use Sample Data for a happier design experience in your templates &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#tip5"&gt;Tip 5: Quick way to add the d: namespace for Sample Data &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#tip6"&gt;Tip 5: Pressing Alt key while move/resize hides the snaplines: &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#tip7"&gt;Tip 6: Pressing the Spacebar lets you Pan the Design Surface with the Mouse &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#tip8"&gt;Tip 8: Easy ways to select hard-to-select things on the design surface &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#tip9"&gt;Tip 9: Use Bring to Front / Send to Back to set tab order within a panel &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#tip10"&gt;Tip 10: Use the new multi-monitor support to open my XAML and Design panes in separate windows &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#more"&gt;For more Tips &amp;amp; Tricks&amp;hellip; &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#comments"&gt;Comments &lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;
&lt;h1&gt;Tip 1: Install Silverlight 4 Tools even if you are building WPF apps&lt;a name="tip1" title="tip1" id="tip1"&gt;&amp;nbsp;&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;The Silverlight 4 Tools for Visual Studio 2010 contain many features and several bug fixes that are useful for WPF developers too (see this &lt;a href="http://blogs.msdn.com/b/wpfsldesigner/archive/2010/05/24/final-release-of-silverlight-4-tools-for-visual-studio-2010-is-now-available.aspx"&gt;blog post&lt;/a&gt; for details of the features) &amp;ndash; you should install it even if you are not working on Silverlight applications. &lt;/p&gt;
&lt;h1&gt;Tip 2: The Properties Window works when just editing XAML too.&lt;a name="tip2" title="tip2" id="tip2"&gt;&amp;nbsp;&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;The Properties Window has a lot of useful features such as the Binding and Resource Pickers, Go To Definition, and various useful editors like the Brush Editor. Lots of people assume the only time you can use these features is when you're working on the Design pane &amp;ndash; but that's not true! Open up the Properties Window next time you are in XAML view for your Page or Window, and you'll see that the XAML element your cursor is in is shown in the Properties Window, so you can use those features there too. You can see this tip illustrated in this &lt;a href="http://channel9.msdn.com/shows/SilverlightTV/WCF-RIA-Services-v10-Launch-Silverlight-TV-28/"&gt;video&lt;/a&gt;.&amp;nbsp; &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt; that if you have set your Tools-Options to open in XAML-only mode, or are working with a view that is XAML-only by default such as App.XAML or a Resource Dictionary, you'll need to use Tip 3 below to activate the properties window before you can use it.&lt;/p&gt;
&lt;h1&gt;Tip 3: Getting the Properties Window to work when working with Resource Dictionaries and App.xaml&lt;a name="tip3" title="tip3" id="tip3"&gt;&amp;nbsp;&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;Closely linked to Tip&amp;nbsp;2 &amp;ndash; for reasons of performance, by design the WPF and Silverlight Designer does not load the Properties Window (or the design view) for app.xaml and resource dictionary XAML files. In addition, users may have set their Tools-Options settings to open XAML in XAML only view (i.e. with no designer visible).&lt;/p&gt;
&lt;p&gt;However if you want to make use of the useful Properties Window features (such as the Go To Definition feature for instance) when in such a file, all you need to do is activate the design pane (use the splitter bar controls to activate split view, then click anywhere on the grey "Intentionally Left Blank" design pane screen). Then you can shift the splitter so that only a tiny part of the designer is visible to avoid wasting screen real-estate. &lt;/p&gt;
&lt;p&gt;The designer will remember this setting on a per-file basis, so next time you open that file, it will activate the designer too. You can see this tip illustrated in this &lt;a href="http://channel9.msdn.com/shows/SilverlightTV/WCF-RIA-Services-v10-Launch-Silverlight-TV-28/"&gt;video&lt;/a&gt;. &lt;/p&gt;
&lt;h1&gt;Tip 4: Use Sample Data for a happier design experience in your templates&lt;a name="tip4" title="tip4" id="tip4"&gt;&amp;nbsp;&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;You may have had the frustrating experience of attempting to edit an item template with no data in it &amp;ndash; it is nearly impossible to work out how your design will actually look based on the design-time experience, especially when your design sizes to the content it is bound to. Fortunately it is now possible to add sample data to your application. We show you how in this &lt;a href="http://www.msteched.com/2010/NorthAmerica/DEV313"&gt;video&lt;/a&gt;, and you should also check out &lt;a href="http://blogs.msdn.com/b/wpfsldesigner/archive/2010/06/30/sample-data-in-the-wpf-and-silverlight-designer.aspx"&gt;Sample Data in the Visual Studio 2010 WPF and Silverlight Designer&lt;/a&gt; for more details. This not only makes this sort of design easier, it can also help you avoid typos in your data binding statements by enabling the use of the Binding Builder. &lt;/p&gt;
&lt;h1&gt;Tip 5: Quick way to add the d: namespace for Sample Data&lt;a name="tip5" title="tip5" id="tip5"&gt;&amp;nbsp;&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;When working with Sample Data, you will need the d: namespace in your XAML. Entering the exact namespace and other required document heading definitions such as mc:ignorable for this is a pain &amp;ndash; but you don't have to! &lt;/p&gt;
&lt;p&gt;If you need to add these definitions to a Page, Window or UserControl in the designer: &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Select the root-most item (see Tip 8 below for selection tips) &lt;/li&gt;
&lt;li&gt;Click the root size mode button twice &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Clicking the root size mode button twice, will insert the necessary XAML header information but leave your design's root width/height behavior unaltered. For detailed information about the root size mode button please see &lt;a href="http://blogs.msdn.com/b/wpfsldesigner/archive/2010/01/14/setting-up-visual-studio-for-wpf-and-silverlight-development.aspx"&gt;this blog post&lt;/a&gt;. &lt;/p&gt;
&lt;h1&gt;Tip 5: Pressing Alt key while move/resize hides the snaplines:&lt;a name="tip6" title="tip6" id="tip6"&gt;&amp;nbsp;&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;For a complex form, move/resize of an element on the designer surface might result in a lot of snaplines being shown. If you don't want to see them, you can easily turn them OFF by pressing and holding the ALT key during drag move/resize. &lt;/p&gt;
&lt;h1&gt;Tip 6: Pressing the Spacebar lets you Pan the Design Surface with the Mouse&lt;a name="tip7" title="tip7" id="tip7"&gt;&amp;nbsp;&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;When you have a large design or are zoomed in, it can be very helpful to be able to pan with the mouse to get to the area you want to view. When you're over the Design Surface, just press the Spacebar and move your mouse to get panning. &lt;/p&gt;
&lt;h1&gt;Tip 8: Easy ways to select hard-to-select things on the design surface&lt;a name="tip8" title="tip8" id="tip8"&gt;&amp;nbsp;&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;Most of the time you can just click on an object to select it. Upon selection you'll notice that the element is also selected in the XAML Editor, Properties Window and Document Outline. &lt;/p&gt;
&lt;p&gt;However there are tricky scenarios where this isn't always possible to click on an object to select it. In those cases, these tips will come in handy: &lt;/p&gt;
&lt;h2&gt;Use Tab Key To Go To The Next Control On Design Surface &lt;/h2&gt;
&lt;p&gt;When a control on the design surface is selected, pressing the Tab key will change selection to the next control in the tabbing order.&amp;nbsp; Pressing SHIFT+TAB will select the previous control in the tabbing order. &lt;/p&gt;
&lt;h2&gt;Pressing ESC Key or right click and use the Selection menu to Select Parent Control&lt;span style="color: #365f91"&gt; &lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;With a control selected on the design surface, pressing the ESC key will cause selection to be changed it its parent control.&amp;nbsp; Continued pressing will continue to change selection to the next parent control. There's also a right-click menu action that lets you quickly select parent items of the selected item. &lt;/p&gt;
&lt;h2&gt;Use the Document Outline or the Path Control to view the XAML tree structure and select objects &lt;/h2&gt;
&lt;p&gt;The Document Outline window has a very useful view of the XAML tree and can be used to select any point in the tree. The Path Control at the bottom of the XAML editor also allows selection of parent controls (and children via the button at its right-hand end). &lt;/p&gt;
&lt;h1&gt;Tip 9: Use Bring to Front / Send to Back to set tab order within a panel&lt;a name="tip9" title="tip9" id="tip9"&gt;&amp;nbsp;&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;Because WPF and Silverlight use the Document Order (the order in which elements appear in the XAML) to set both Z Order AND Tab Order in a document by default, you can use the right click context menu to move items in a form forward and backward in the Tab Order as well as changing their Z-order. This is significantly easier than individually setting the Tab Order of items one by one. &lt;/p&gt;
&lt;h1&gt;Tip 10: Use the new multi-monitor support to open my XAML and Design panes in separate windows&lt;a name="tip10" title="tip10" id="tip10"&gt;&amp;nbsp;&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;Visual Studio 2010 has great multi-monitor support with tear-off windows etc. We would like to add real support for tearing off the two parts of the split view of the WPF and Silverlight Designer in a future release &amp;ndash; meanwhile there are a couple of workarounds: &lt;/p&gt;
&lt;p&gt;If your goal is multi-monitor with code on the right and design surface on the left (for instance), then you can maximize VS2010 across both screens, set the splitter to be VERTICAL (there are buttons in the splitter bar that let you do this), then place the splitter at the join between the two screens (quickest approach) &lt;/p&gt;
&lt;p&gt;If you want more flexibility, you can: &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Open a second tab group (right click on a tab and open new Vertical Tab Group) &lt;/li&gt;
&lt;li&gt;Open the XAML as normal in one of the tab groups &lt;/li&gt;
&lt;li&gt;Open the XAML again using "Open With"&amp;hellip;"Source Code Editor" &lt;/li&gt;
&lt;li&gt;Put the XAML and the designer in different tab groups, maximize the designer in the first, and now you've got full, tearable-window, multi-monitor friendly goodness for your XAML and designer views &lt;/li&gt;
&lt;/ul&gt;
&lt;h1&gt;For more Tips &amp;amp; Tricks&amp;hellip;&lt;a name="more" title="more" id="more"&gt;&amp;nbsp;&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;You might also want to check out the video from our &lt;a href="http://www.msteched.com/2010/NorthAmerica/DEV313"&gt;session at TechEd USA 2010&lt;/a&gt;, which shows many of the tips and tricks in this list in action. &lt;/p&gt;
&lt;h1&gt;Comments&lt;a name="comments" title="comments" id="comments"&gt;&amp;nbsp;&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;We hope you find these tips useful. We plan to update this post when we discover new tips and tricks that we think are useful. You can send us your own tips, your feedback on this article, or discuss any other WPF &amp;amp; Silverlight Designer topic, over on the &lt;a href="http://social.msdn.microsoft.com/Forums/en-US/vswpfdesigner"&gt;WPF and Silverlight Designer Forums&lt;/a&gt;! &lt;/p&gt;
&lt;p&gt;Microsoft values your opinion about our products and documentation. In addition to your general feedback it is very helpful to understand: &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;How the above features enable your workflow &lt;/li&gt;
&lt;li&gt;What is missing from the above features that would be helpful to you &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Thank you for your feedback and have a great day, &lt;/p&gt;
&lt;p&gt;Mark Wilson-Thomas &lt;br /&gt;Expression Team &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10033223" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/wpfsldesigner/archive/tags/WPF/">WPF</category><category domain="http://blogs.msdn.com/b/wpfsldesigner/archive/tags/Silverlight/">Silverlight</category><category domain="http://blogs.msdn.com/b/wpfsldesigner/archive/tags/Tips+_2600_amp_3B00_+Tricks/">Tips &amp;amp; Tricks</category></item><item><title>Sample Data in the WPF and Silverlight Designer</title><link>http://blogs.msdn.com/b/wpfsldesigner/archive/2010/06/30/sample-data-in-the-wpf-and-silverlight-designer.aspx</link><pubDate>Wed, 30 Jun 2010 22:58:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10033184</guid><dc:creator>karl140.6</dc:creator><slash:comments>3</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/wpfsldesigner/rsscomments.aspx?WeblogPostID=10033184</wfw:commentRss><comments>http://blogs.msdn.com/b/wpfsldesigner/archive/2010/06/30/sample-data-in-the-wpf-and-silverlight-designer.aspx#comments</comments><description>&lt;h1&gt;Objective&lt;/h1&gt;  &lt;p&gt;&lt;img alt="" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/7144.063010_5F00_2249_5F00_SampleDatai1.png" /&gt; &lt;/p&gt;  &lt;h2&gt;Requirements &lt;/h2&gt;  &lt;p&gt;Retail release of Visual Studio 2010 and the latest &lt;a href="http://www.silverlight.net/getstarted/"&gt;Silverlight 4 tools for Visual Studio 2010&lt;/a&gt;. &lt;/p&gt;  &lt;div class="toc"&gt;   &lt;h4&gt;Table of Contents&lt;/h4&gt;    &lt;ol class="list"&gt;      &lt;li&gt;&lt;a href="#background"&gt;Background &lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href="#faux"&gt;Faux Types and Real Types &lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href="#images"&gt;Images in Sample Data Files &lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href="#adding"&gt;Adding New Sample Data File &lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href="#consuming"&gt;Consuming Sample Data File &lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href="#wpf"&gt;WPF Sample Data Scenarios &lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href="#silverlight"&gt;Silverlight Sample Data Scenarios &lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href="#wcf"&gt;WCF RIA Services Sample Data Scenario &lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href="#choosing"&gt;Choosing Sample Data Loading Technique &lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href="#comments"&gt;Comments &lt;/a&gt;&lt;/li&gt;   &lt;/ol&gt; &lt;/div&gt;  &lt;h1&gt;Background&lt;a id="background" title="background" name="background"&gt;&amp;#160;&lt;/a&gt;&lt;/h1&gt;  &lt;h3&gt;Cider and Blend 4 &lt;/h3&gt;  &lt;p&gt;Developers using a visual Designer use sample data to light up their UI at design-time; to cause the Designer to render like it will at run-time. This time saving feature is especially important when designing DataTemplates or adjusting the layout of a DataGrid since the developer will not have to actually run the application to see what it will render like with data. &lt;/p&gt;  &lt;p&gt;Sample data in Cider and Blend is easy to understand and wire up. &lt;/p&gt;  &lt;p&gt;Sample data files are XAML files. Each sample data file contains one or more instances of user type's instantiated in XAML. The XAML sample data file and resulting instances of data are connected to the UI using the d:DesignData MarkupExtension. d:DesignData can be applied to a data source declared in XAML like a CollectionViewSource, DomainDataSource or can be assigned to a d:DataContext property. &lt;/p&gt;  &lt;p&gt;Each sample data file has an associated Build Action that determines if d:DesignData will create actual instances of the types in the sample data file or if faux types will be created. Faux types are necessary when the types in the sample data file are not creatable or if read-only properties need to be populated with sample data values. &lt;/p&gt;  &lt;h3&gt;Blend 4 &lt;/h3&gt;  &lt;p&gt;Blend has tooling to create and modify XAML sample data for a class. Blend also provides a sample data drag and drop experience to wire up the d:DataContext and appropriate properties. &lt;/p&gt;  &lt;p&gt;Blend provides an additional feature that enables creating XML sample data on the fly without a predefined class. The XML sample data can then be easily be configured and modified. This XML sample data only works in Blend. &lt;/p&gt;  &lt;p&gt;To learn more about Blend please see the &lt;a href="http://blogs.msdn.com/b/expression/default.aspx?wa=wsignin1.0"&gt;Expression Blend Blog&lt;/a&gt;, &lt;a href="http://blogs.msdn.com/b/unnir/"&gt;Unni's Blog&lt;/a&gt;, &lt;a href="http://www.kirupa.com/"&gt;Kirupa's Blog&lt;/a&gt; or &lt;a href="http://electricbeach.org/"&gt;Christian Schormann's Blog&lt;/a&gt;. &lt;/p&gt;  &lt;h1&gt;Faux Types and Real Types&lt;a id="faux" title="faux" name="faux"&gt;&amp;#160;&lt;/a&gt;&lt;/h1&gt;  &lt;p&gt;The term faux type is used in this document to indicate that a cloned type will be created instead of your actual type. Benefits of faux types include the ability to create an otherwise non-creatable type in sample data, the ability to set read-only properties in sample data and the by-passing of code in the real type's constructor. &lt;/p&gt;  &lt;p&gt;When using real types in sample data, be aware that any code in the type's constructor will be executed at design-time. For an entity object this would not normally be an issue, but if the real type is a ViewModel, the code in that ViewModel's constructor will be executed. If that constructor's code loads data from a database for example, problems could occur in the Designer when the sample data is loaded. User code running at design-time is responsible for over 20% of all Designer load failures. You can read up on running code in a constructor in this &lt;a href="http://blogs.msdn.com/b/wpfsldesigner/archive/2010/06/14/using-wpf-and-silverlight-usercontrols.aspx"&gt;blog post&lt;/a&gt;. &lt;/p&gt;  &lt;h1&gt;Images in Sample Data Files&lt;a id="images" title="images" name="images"&gt;&amp;#160;&lt;/a&gt;&lt;/h1&gt;  &lt;h2&gt;WPF Sample Data Files Only &lt;/h2&gt;  &lt;p&gt;If the image is part of the project, it can be referenced using the below relative folder syntax. &lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Customer &lt;/span&gt;&lt;span style="color: red"&gt;FirstName&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Alfons&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;LastName&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Parovszky&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Photo&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;../Images/image01.png&amp;quot;&amp;gt;
&lt;/span&gt;&lt;/pre&gt;

&lt;br /&gt;

&lt;h2&gt;WPF and Silverlight Sample Data Files &lt;/h2&gt;

&lt;p&gt;All images in Silverlight sample data files require the pack syntax. WPF projects must use this syntax if the image is located in another assembly: &lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Customer &lt;/span&gt;&lt;span style="color: red"&gt;FirstName&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Alfons&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;LastName&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Parovszky&amp;quot; 
            &lt;/span&gt;&lt;span style="color: red"&gt;Photo&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;/SLSampleDataScenarios;component/Images/image01.png&amp;quot;&amp;gt;
&lt;/span&gt;&lt;/pre&gt;

&lt;br /&gt;

&lt;p&gt;&lt;span style="font-family: consolas; color: blue; font-size: 8pt"&gt;&lt;span style="color: #a31515"&gt;&lt;span style="color: blue"&gt;&lt;span style="color: #a31515"&gt;&lt;span style="color: blue"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
If the image is not part of any project, you can use the below &lt;a&gt;file:///&lt;/a&gt; URI syntax to use an image in a sample data file. 

&lt;br /&gt;

&lt;br /&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Customer &lt;/span&gt;&lt;span style="color: red"&gt;FirstName&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Alfons&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;LastName&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Parovszky&amp;quot; 
            &lt;/span&gt;&lt;span style="color: red"&gt;Photo&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;file:///c:/Images/markbou.jpg&amp;quot;&amp;gt;
&lt;/span&gt;&lt;/pre&gt;

&lt;h1&gt;Adding New Sample Data File&lt;a id="adding" title="adding" name="adding"&gt;&amp;#160;&lt;/a&gt;&lt;/h1&gt;

&lt;p&gt;The following applies to both WPF and Silverlight applications. &lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;div&gt;Add a new ResourceDictionary or Text File to the project. &lt;/div&gt;

    &lt;ul&gt;
      &lt;li&gt;If ResourceDictionary delete the default file content. &lt;/li&gt;

      &lt;li&gt;If Text File, change file extension to .xaml &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;

  &lt;li&gt;
    &lt;div&gt;Using the file properties, set build action to either: &lt;/div&gt;

    &lt;ul&gt;
      &lt;li&gt;
        &lt;div style="background: white"&gt;DesignData – will create faux types &lt;/div&gt;
      &lt;/li&gt;

      &lt;li&gt;
        &lt;div style="background: white"&gt;DesignDataWithDesignTimeCreatableTypes – will create actual types &lt;/div&gt;
      &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;

  &lt;li&gt;
    &lt;div style="background: white"&gt;Using the file properties, set Copy to Output Directory to: Do not copy &lt;/div&gt;
  &lt;/li&gt;

  &lt;li&gt;
    &lt;div style="background: white"&gt;Using the file properties, set Custom Tool:&amp;#160; &amp;lt;blank&amp;gt; &lt;/div&gt;
  &lt;/li&gt;

  &lt;li&gt;Using XAML Editor add your sample data content to the file. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Sample Data File Properties &lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;img alt="" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/7673.063010_5F00_2249_5F00_SampleDatai2.png" /&gt; &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Single Instance Sample Data Example &lt;/strong&gt;&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Customer 
    &lt;/span&gt;&lt;span style="color: red"&gt;xmlns&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;clr-namespace:SampleDataScenarios.Model&amp;quot; 
    &lt;/span&gt;&lt;span style="color: red"&gt;FirstName&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Alfons&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;LastName&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Parovszky&amp;quot; 
    &lt;/span&gt;&lt;span style="color: red"&gt;Photo&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;../Images/image01.png&amp;quot;&amp;gt;
&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Customer&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;&lt;strong&gt;Multiple Instance Sample Data Example&lt;/strong&gt; &lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Customers &lt;/span&gt;&lt;span style="color: red"&gt;xmlns&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;clr-namespace:SampleDataScenarios.Model&amp;quot;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Customer &lt;/span&gt;&lt;span style="color: red"&gt;FirstName&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Alfons&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;LastName&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Parovszky&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Photo&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;../Images/image01.png&amp;quot;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Customer.Addresses&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Address &lt;/span&gt;&lt;span style="color: red"&gt;LineOne&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;125 North St&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;City&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Greatville&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;State&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;CA&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Zip&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;98004&amp;quot; /&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Address &lt;/span&gt;&lt;span style="color: red"&gt;LineOne&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;3000 1st St NE&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;City&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Coolville&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;State&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;CA&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Zip&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;98004&amp;quot; /&amp;gt;
        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Customer.Addresses&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Customer&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Customer &lt;/span&gt;&lt;span style="color: red"&gt;FirstName&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Lori&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;LastName&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Penor&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Photo&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;../Images/image02.png&amp;quot;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Customer.Addresses&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Address &lt;/span&gt;&lt;span style="color: red"&gt;LineOne&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;126 East St&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;City&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Greatville&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;State&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;CA&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Zip&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;98004&amp;quot; /&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Address &lt;/span&gt;&lt;span style="color: red"&gt;LineOne&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;3001 2st St NE&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;City&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Coolville&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;State&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;CA&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Zip&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;98004&amp;quot; /&amp;gt;
        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Customer.Addresses&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Customer&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Customer &lt;/span&gt;&lt;span style="color: red"&gt;FirstName&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Justin&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;LastName&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Harrison&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Photo&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;../Images/image03.png&amp;quot;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Customer.Addresses&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Address &lt;/span&gt;&lt;span style="color: red"&gt;LineOne&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;127 West St&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;City&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Greatville&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;State&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;CA&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Zip&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;98004&amp;quot; /&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Address &lt;/span&gt;&lt;span style="color: red"&gt;LineOne&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;3002 3st St NE&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;City&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Coolville&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;State&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;CA&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Zip&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;98004&amp;quot; /&amp;gt;
        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Customer.Addresses&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Customer&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Customers&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&lt;/span&gt;&lt;/pre&gt;

&lt;br /&gt;

&lt;h2&gt;WPF Supported Sample Data File Scenarios &lt;/h2&gt;

&lt;p&gt;For sample data files where the root object is a single instance, simply add the type to the sample data file as done in Single Instance Sample Data Example above. &lt;/p&gt;

&lt;p&gt;For collections, the root object can be an ArrayList or a custom type that derives from a collection or generic collection as done in Multiple Instance Sample Data Example above. Notice that WPF can also use the same technique as outlined below in Silverlight Scenarios. The Multiple Instance Sample Data Example uses the below DesignSampleDataCollection class as the root instead of an ArrayList. &lt;/p&gt;

&lt;h2&gt;Silverlight Supported Sample Data File Scenarios &lt;/h2&gt;

&lt;p&gt;For sample data files where the root object is a single instance, simply add the type to the sample data file as done in Single Instance Sample Data Example above. &lt;/p&gt;

&lt;p&gt;For collections, the root object must be a type that derives from a collection or generic collection. &lt;/p&gt;

&lt;h3&gt;Non-WCF RIA Services Scenario &lt;/h3&gt;

&lt;p&gt;If the project does not have a collection object for the desired root type and the type &lt;span style="text-decoration: underline"&gt;does not derive from the RIA Services Entity object&lt;/span&gt;, you need to create a generic reusable collection like the below DesignSampleDataCollection. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;C#&lt;/strong&gt;&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;namespace &lt;/span&gt;SampleDataScenarios.Model {
  &lt;span style="color: blue"&gt;public class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;DesignTimeSampleDataCollection &lt;/span&gt;: &lt;span style="color: #2b91af"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;Object&lt;/span&gt;&amp;gt; {

    &lt;span style="color: blue"&gt;public &lt;/span&gt;DesignTimeSampleDataCollection() { }
  }
}&lt;/pre&gt;

&lt;br /&gt;

&lt;p&gt;&lt;strong&gt;VB.NET&lt;/strong&gt;&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;Public Class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;DesignTimeSampleDataCollection
  &lt;/span&gt;&lt;span style="color: blue"&gt;Inherits &lt;/span&gt;&lt;span style="color: #2b91af"&gt;List&lt;/span&gt;(&lt;span style="color: blue"&gt;Of Object&lt;/span&gt;)

  &lt;span style="color: blue"&gt;Public Sub New&lt;/span&gt;()

  &lt;span style="color: blue"&gt;End Sub

End Class
&lt;/span&gt;&lt;/pre&gt;

&lt;br /&gt;

&lt;h3&gt;WCF RIA Services Scenario &lt;/h3&gt;

&lt;p&gt;If the project does not have a collection object for the desired root type and the type &lt;span style="text-decoration: underline"&gt;derives from the RIA Services Entity object&lt;/span&gt;, you need to create a generic reusable collection like the below DesignRIAEntitySampleDataCollection. &lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;namespace &lt;/span&gt;ContosoSales.SampleData {
    &lt;span style="color: blue"&gt;public class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;DesignRIAEntitySampleDataCollection &lt;/span&gt;: 
          &lt;span style="color: #2b91af"&gt;List&lt;/span&gt;&amp;lt;System.ServiceModel.DomainServices.Client.&lt;span style="color: #2b91af"&gt;Entity&lt;/span&gt;&amp;gt; {

        &lt;span style="color: blue"&gt;public &lt;/span&gt;DesignRIAEntitySampleDataCollection() { }
    }
}&lt;/pre&gt;

&lt;h1&gt;Consuming Sample Data File&lt;a id="consuming" title="consuming" name="consuming"&gt;&amp;#160;&lt;/a&gt;&lt;/h1&gt;

&lt;p&gt;The d:DesignData Markup Extension assumes the role of a sample data file loader and parser that provides instantiated or faux types to the consumer. &lt;/p&gt;

&lt;h2&gt;Sample Data Consumers &lt;/h2&gt;

&lt;p&gt;The following design-time properties can consume the sample data provided by d:DesignData: &lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;d:DataContext can be set on any FrameworkElement &lt;/li&gt;

  &lt;li&gt;d:DesignSource can be set on a CollectionViewSource &lt;/li&gt;

  &lt;li&gt;d:DesignData can be set on a DomainDataContext (RIA Services data object) &lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;WPF Sample Data Scenarios&lt;a id="wpf" title="wpf" name="wpf"&gt;&amp;#160;&lt;/a&gt;&lt;/h1&gt;

&lt;p&gt;Open either solution: CS-SampleDataScenarios or VB-SampleDataScenarios. &lt;/p&gt;

&lt;p&gt;Rebuild solution. &lt;/p&gt;

&lt;p&gt;The WPF samples are in the SampleDataScenarios project. &lt;/p&gt;

&lt;h2&gt;Demo-01 Single Customer &lt;/h2&gt;

&lt;p&gt;Open Demo01SingleCustomer.xaml. &lt;/p&gt;

&lt;p&gt;This is an example of a single instance sample data file consumed by a form. The single instance of Customer has 2 instances of Address. &lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Customer 
    &lt;/span&gt;&lt;span style="color: red"&gt;xmlns&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;clr-namespace:SampleDataScenarios.Model&amp;quot; 
    &lt;/span&gt;&lt;span style="color: red"&gt;FirstName&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Alfons&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;LastName&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Parovszky&amp;quot; 
    &lt;/span&gt;&lt;span style="color: red"&gt;Photo&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;../Images/image01.png&amp;quot;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Customer.Addresses&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Address &lt;/span&gt;&lt;span style="color: red"&gt;LineOne&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;125 North St&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;City&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Greatville&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;State&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;CA&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Zip&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;98004&amp;quot; /&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Address &lt;/span&gt;&lt;span style="color: red"&gt;LineOne&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;3000 1st St NE&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;City&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Coolville&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;State&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;CA&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Zip&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;98004&amp;quot; /&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Customer.Addresses&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Customer&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;In the below form, the Customer type is available in the root Grid's DataContext. This is important because the presence of d:DesignData and sample data not only feeds the DataContext to render data, but also enables the Designer tooling for creating and editing bindings using the Binding Builder. &lt;/p&gt;

&lt;p&gt;&lt;img alt="" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/1385.063010_5F00_2249_5F00_SampleDatai3.png" /&gt; &lt;/p&gt;

&lt;h3&gt;Connecting Sample Data &lt;/h3&gt;

&lt;p&gt;In the below XAML the CustomerSampleData.xaml file is loaded and parsed by the d:DesignData Markup Extension and assigned to the d:DataContext for the Grid. Child controls of the Grid can data bind to properties on the DataContext and the Designer Binding Builder tooling is enabled. &lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid &lt;/span&gt;&lt;span style="color: red"&gt;d&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;DataContext&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;d&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;DesignData &lt;/span&gt;&lt;span style="color: red"&gt;Source&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;/&lt;span style="color: blue"&gt;SampleData&lt;/span&gt;/&lt;span style="color: blue"&gt;CustomerSampleData.xaml}&amp;quot;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.RowDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;RowDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Auto&amp;quot; /&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;RowDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;*&amp;quot; /&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.RowDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.ColumnDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;*&amp;quot; /&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;*&amp;quot; /&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.ColumnDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;

    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Demo-01 Single Customer&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.ColumnSpan&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;2&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;FontWeight&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Bold&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;FontSize&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;14&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Margin&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;11&amp;quot; /&amp;gt;

    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Margin&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;6&amp;quot;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.RowDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;RowDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Auto&amp;quot; /&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;RowDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Auto&amp;quot; /&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;RowDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Auto&amp;quot; /&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;RowDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Auto&amp;quot; /&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;RowDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;*&amp;quot; /&amp;gt;
        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.RowDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.ColumnDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Auto&amp;quot; /&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;*&amp;quot; /&amp;gt;
        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.ColumnDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;

        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;First Name:&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Center&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;75&amp;quot; /&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBox &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=FirstName}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Center&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot;/&amp;gt;

        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Last Name:&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Center&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;75&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; /&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBox &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=LastName}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Center&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; /&amp;gt;

        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Ranking:&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Center&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;75&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;2&amp;quot; /&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=Ranking}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Center&amp;quot;  &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;2&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; /&amp;gt;

        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Margin&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;7&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Addresses&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;FontWeight&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Bold&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;3&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.ColumnSpan&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;2&amp;quot; /&amp;gt;

        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ListBox &lt;/span&gt;&lt;span style="color: red"&gt;ItemsSource&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=Addresses}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;4&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.ColumnSpan&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;2&amp;quot;&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ListBox.ItemTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.ColumnDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;100&amp;quot; /&amp;gt;
                            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;75&amp;quot; /&amp;gt;
                            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;30&amp;quot; /&amp;gt;
                            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Auto&amp;quot; /&amp;gt;
                        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.ColumnDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=LineOne}&amp;quot; /&amp;gt;
                        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=City}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; /&amp;gt;
                        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=State}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;2&amp;quot; /&amp;gt;
                        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=Zip}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;3&amp;quot; /&amp;gt;
                    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
            &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;ListBox.ItemTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;ListBox&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;

    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;

    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image &lt;/span&gt;&lt;span style="color: red"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Top&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Source&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=Photo}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Margin&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;6&amp;quot; /&amp;gt;
&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&lt;/span&gt;&lt;/pre&gt;

&lt;br /&gt;

&lt;h2&gt;Demo-02 Single Not Creatable Customer &lt;/h2&gt;

&lt;p&gt;Open Demo02SingleNotCreatableCustomer.xaml and NotCreatableCustomer.cs. &lt;/p&gt;

&lt;p&gt;This is an example of a single instance sample data file where the entity object is not creatable. The NotCreatableCustomer class has a private constructor. The single instance of NotCreatableCustomer has 2 instances of Address. &lt;/p&gt;

&lt;p&gt;Non-creatable types are common scenario in .NET, making this feature a very important addition to the Designer tooling. For example, RIA Services Entity types or types that are created by factories cannot be instantiated. Without this feature sample data would not work and the Designer tooling would be unable to provide DataContext and property name lists for a type. &lt;/p&gt;

&lt;div&gt;
  &lt;table style="border-collapse: collapse" border="0"&gt;&lt;colgroup&gt;&lt;col /&gt;&lt;/colgroup&gt;&lt;tbody valign="top"&gt;
      &lt;tr style="background: #c0504d"&gt;
        &lt;td style="border-bottom: #c0504d 1pt solid; border-left: #c0504d 1pt solid; padding-left: 7px; padding-right: 7px; border-top: #c0504d 1pt solid; border-right: #c0504d 1pt solid"&gt;
          &lt;p&gt;&lt;span style="color: white"&gt;&lt;strong&gt;Important&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
        &lt;/td&gt;
      &lt;/tr&gt;

      &lt;tr&gt;
        &lt;td style="border-bottom: #c0504d 1pt solid; border-left: #c0504d 1pt solid; padding-left: 7px; padding-right: 7px; border-top-style: none; border-right: #c0504d 1pt solid"&gt;
          &lt;p&gt;Sample data files that contain non-creatable types must have their Build Action set to: DesignData and not DesignDataWithDesignTimeCreatableTypes.&lt;/p&gt;
        &lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;

&lt;br /&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Customer 
    &lt;/span&gt;&lt;span style="color: red"&gt;xmlns&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;clr-namespace:SampleDataScenarios.Model&amp;quot; 
    &lt;/span&gt;&lt;span style="color: red"&gt;FirstName&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Alfons&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;LastName&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Parovszky&amp;quot; 
    &lt;/span&gt;&lt;span style="color: red"&gt;Photo&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;../Images/image01.png&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Ranking&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;101&amp;quot;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Customer.Addresses&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Address &lt;/span&gt;&lt;span style="color: red"&gt;LineOne&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;125 North St&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;City&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Greatville&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;State&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;CA&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Zip&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;98004&amp;quot; /&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Address &lt;/span&gt;&lt;span style="color: red"&gt;LineOne&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;3000 1st St NE&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;City&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Coolville&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;State&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;CA&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Zip&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;98004&amp;quot; /&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Customer.Addresses&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Customer&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;In the below form, the NotCreatableCustomer type is available in the root Grid's DataContext. Again, even though the NotCreatableCustomer type has a private constructor the sample data displays and the Binding Builder works normally. &lt;/p&gt;

&lt;p&gt;&lt;img alt="" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/4431.063010_5F00_2249_5F00_SampleDatai4.png" /&gt; &lt;/p&gt;

&lt;h3&gt;Connecting Sample Data &lt;/h3&gt;

&lt;p&gt;In the below XAML the NotCreatableCustomerSampleData.xaml file is loaded and parsed by the d:DesignData Markup Extension and assigned to the d:DataContext for the Grid. Child controls of the Grid can data bind to properties on the DataContext and the Designer Binding Builder tooling is enabled. &lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid &lt;/span&gt;&lt;span style="color: red"&gt;d&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;DataContext&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;d&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;DesignData &lt;/span&gt;&lt;span style="color: red"&gt;Source&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;/&lt;span style="color: blue"&gt;SampleData&lt;/span&gt;/&lt;span style="color: blue"&gt;NotCreatableCustomerSampleData.xaml}&amp;quot;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.RowDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;RowDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Auto&amp;quot; /&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;RowDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;*&amp;quot; /&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.RowDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.ColumnDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;*&amp;quot; /&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;*&amp;quot; /&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.ColumnDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Demo-02 Single Not Creatable Customer&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.ColumnSpan&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;2&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;FontWeight&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Bold&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;FontSize&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;14&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Margin&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;11&amp;quot; /&amp;gt;
        
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Margin&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;6&amp;quot;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.RowDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;RowDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Auto&amp;quot; /&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;RowDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Auto&amp;quot; /&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;RowDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Auto&amp;quot; /&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;RowDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Auto&amp;quot; /&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;RowDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;*&amp;quot; /&amp;gt;
        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.RowDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.ColumnDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Auto&amp;quot; /&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;*&amp;quot; /&amp;gt;
        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.ColumnDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;

        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;First Name:&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Center&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;75&amp;quot; /&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBox &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=FirstName}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Center&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot;/&amp;gt;

        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Last Name:&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Center&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;75&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; /&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBox &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=LastName}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Center&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; /&amp;gt;

        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Ranking:&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Center&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;75&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;2&amp;quot; /&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=Ranking}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Center&amp;quot;  &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;2&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; /&amp;gt;

        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Margin&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;7&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Addresses&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;FontWeight&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Bold&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;3&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.ColumnSpan&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;2&amp;quot; /&amp;gt;

        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ListBox &lt;/span&gt;&lt;span style="color: red"&gt;ItemsSource&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=Addresses}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;4&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.ColumnSpan&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;2&amp;quot;&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ListBox.ItemTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.ColumnDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;100&amp;quot; /&amp;gt;
                            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;75&amp;quot; /&amp;gt;
                            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;30&amp;quot; /&amp;gt;
                            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Auto&amp;quot; /&amp;gt;
                        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.ColumnDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=LineOne}&amp;quot; /&amp;gt;
                        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=City}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; /&amp;gt;
                        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=State}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;2&amp;quot; /&amp;gt;
                        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=Zip}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;3&amp;quot; /&amp;gt;
                    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
            &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;ListBox.ItemTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;ListBox&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;

    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image &lt;/span&gt;&lt;span style="color: red"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Top&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Source&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=Photo}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Margin&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;3&amp;quot; /&amp;gt;
&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&lt;/span&gt;&lt;/pre&gt;

&lt;br /&gt;

&lt;h2&gt;Demo-03 Customer ViewModel &lt;/h2&gt;

&lt;p&gt;Open Demo03CustomerViewModel.xaml. &lt;/p&gt;

&lt;p&gt;This is an example of using a design-time ViewModel as the d:DataContext. DesignTimeCustomerViewModel derives from CustomerViewModel. In its constructor it populates the ViewModel properties and collection. Since the DesignTimeCustomerViewModel's properties are populated, they are rendered on the design surface. &lt;/p&gt;

&lt;p&gt;The below code demonstrates creating sample data instead of using the typical sample data XAML file. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;C#&lt;/strong&gt;&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;namespace &lt;/span&gt;SampleDataScenarios.ViewModel {
  &lt;span style="color: blue"&gt;public class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;DesignTimeCustomerViewModel &lt;/span&gt;: &lt;span style="color: #2b91af"&gt;CustomerViewModel &lt;/span&gt;{

    &lt;span style="color: blue"&gt;public &lt;/span&gt;DesignTimeCustomerViewModel()
      : &lt;span style="color: blue"&gt;base&lt;/span&gt;() {

      &lt;span style="color: blue"&gt;base&lt;/span&gt;.Customer = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Customer&lt;/span&gt;() {
        FirstName = &lt;span style="color: #a31515"&gt;&amp;quot;Alfons&amp;quot;&lt;/span&gt;, LastName = &lt;span style="color: #a31515"&gt;&amp;quot;Parovszky&amp;quot;&lt;/span&gt;, Photo = &lt;span style="color: #a31515"&gt;&amp;quot;../Images/image01.png&amp;quot;
      &lt;/span&gt;};
      &lt;span style="color: blue"&gt;base&lt;/span&gt;.Customer.CalculateRank();
      &lt;span style="color: blue"&gt;base&lt;/span&gt;.Customer.Addresses.Add(
          &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Address&lt;/span&gt;() { LineOne = &lt;span style="color: #a31515"&gt;&amp;quot;125 North St&amp;quot;&lt;/span&gt;, City = &lt;span style="color: #a31515"&gt;&amp;quot;Greatville&amp;quot;&lt;/span&gt;, State = &lt;span style="color: #a31515"&gt;&amp;quot;CA&amp;quot;&lt;/span&gt;, Zip = &lt;span style="color: #a31515"&gt;&amp;quot;98004&amp;quot; &lt;/span&gt;});
      &lt;span style="color: blue"&gt;base&lt;/span&gt;.Customer.Addresses.Add(
          &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Address&lt;/span&gt;() { LineOne = &lt;span style="color: #a31515"&gt;&amp;quot;3000 1st St NE&amp;quot;&lt;/span&gt;, City = &lt;span style="color: #a31515"&gt;&amp;quot;Coolville&amp;quot;&lt;/span&gt;, State = &lt;span style="color: #a31515"&gt;&amp;quot;CA&amp;quot;&lt;/span&gt;, Zip = &lt;span style="color: #a31515"&gt;&amp;quot;98004&amp;quot; &lt;/span&gt;});
    }
  }
}&lt;/pre&gt;

&lt;p&gt;&lt;strong&gt;VB.NET&lt;/strong&gt;&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;Public Class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;DesignTimeCustomerViewModel
  &lt;/span&gt;&lt;span style="color: blue"&gt;Inherits &lt;/span&gt;&lt;span style="color: #2b91af"&gt;CustomerViewModel

  &lt;/span&gt;&lt;span style="color: blue"&gt;Public Sub New&lt;/span&gt;()
    &lt;span style="color: blue"&gt;MyBase&lt;/span&gt;.New()

    &lt;span style="color: blue"&gt;MyBase&lt;/span&gt;.Customer = &lt;span style="color: blue"&gt;New &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Customer &lt;/span&gt;&lt;span style="color: blue"&gt;With &lt;/span&gt;{.FirstName = &lt;span style="color: #a31515"&gt;&amp;quot;Alfons&amp;quot;&lt;/span&gt;, .LastName = &lt;span style="color: #a31515"&gt;&amp;quot;Parovszky&amp;quot;&lt;/span&gt;, .Photo = &lt;span style="color: #a31515"&gt;&amp;quot;../Images/image01.png&amp;quot;&lt;/span&gt;}
    &lt;span style="color: blue"&gt;MyBase&lt;/span&gt;.Customer.CalculateRank()
    &lt;span style="color: blue"&gt;MyBase&lt;/span&gt;.Customer.Addresses.Add(&lt;span style="color: blue"&gt;New &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Address &lt;/span&gt;&lt;span style="color: blue"&gt;With &lt;/span&gt;{.LineOne = &lt;span style="color: #a31515"&gt;&amp;quot;125 North St&amp;quot;&lt;/span&gt;, .City = &lt;span style="color: #a31515"&gt;&amp;quot;Greatville&amp;quot;&lt;/span&gt;, .State = &lt;span style="color: #a31515"&gt;&amp;quot;CA&amp;quot;&lt;/span&gt;, .Zip = &lt;span style="color: #a31515"&gt;&amp;quot;98004&amp;quot;&lt;/span&gt;})
    &lt;span style="color: blue"&gt;MyBase&lt;/span&gt;.Customer.Addresses.Add(&lt;span style="color: blue"&gt;New &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Address &lt;/span&gt;&lt;span style="color: blue"&gt;With &lt;/span&gt;{.LineOne = &lt;span style="color: #a31515"&gt;&amp;quot;3000 1st St NE&amp;quot;&lt;/span&gt;, .City = &lt;span style="color: #a31515"&gt;&amp;quot;Coolville&amp;quot;&lt;/span&gt;, .State = &lt;span style="color: #a31515"&gt;&amp;quot;CA&amp;quot;&lt;/span&gt;, .Zip = &lt;span style="color: #a31515"&gt;&amp;quot;98004&amp;quot;&lt;/span&gt;})

  &lt;span style="color: blue"&gt;End Sub

End Class
&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;&lt;img alt="" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/7673.063010_5F00_2249_5F00_SampleDatai5.png" /&gt; &lt;/p&gt;

&lt;h3&gt;Connecting Sample Data &lt;/h3&gt;

&lt;p&gt;The below XAML demonstrates using d:DesignInstance with IsDesignTimeCreatable set to true to have Visual Studio instantiate DesignTimeCustomerViewModel and assign the instance as the d:DataContext. Since the instantiated instance has properties populated with data, that data will render exactly like other XAML file sample data in the Designer. This works because the DesignTimeCustomerViewModel is creatable at design-time and the below DesignInstance has IsDesignTimeCreatable set to true. Child controls of the Grid can data bind to properties on the DataContext and the Designer Binding Builder tooling is enabled. &lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid &lt;/span&gt;&lt;span style="color: red"&gt;d&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;DataContext&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;d&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;DesignInstance &lt;/span&gt;&lt;span style="color: red"&gt;vm&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;DesignTimeCustomerViewModel&lt;/span&gt;&lt;span style="color: blue"&gt;, &lt;/span&gt;&lt;span style="color: red"&gt;IsDesignTimeCreatable&lt;/span&gt;&lt;span style="color: blue"&gt;=True}&amp;quot;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.RowDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;RowDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Auto&amp;quot; /&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;RowDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;*&amp;quot; /&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.RowDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.ColumnDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;*&amp;quot; /&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;*&amp;quot; /&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.ColumnDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;

    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=FormTitle}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.ColumnSpan&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;2&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;FontWeight&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Bold&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;FontSize&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;14&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Margin&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;11&amp;quot; /&amp;gt;

    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Margin&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;6&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;DataContext&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=Customer}&amp;quot;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.RowDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;RowDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Auto&amp;quot; /&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;RowDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Auto&amp;quot; /&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;RowDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Auto&amp;quot; /&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;RowDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Auto&amp;quot; /&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;RowDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;*&amp;quot; /&amp;gt;
        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.RowDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.ColumnDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Auto&amp;quot; /&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;*&amp;quot; /&amp;gt;
        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.ColumnDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;

        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;First Name:&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Center&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;75&amp;quot; /&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBox &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=FirstName}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Center&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot;/&amp;gt;

        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Last Name:&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Center&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;75&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; /&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBox &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=LastName}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Center&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; /&amp;gt;

        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Ranking:&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Center&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;75&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;2&amp;quot; /&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=Ranking}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Center&amp;quot;  &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;2&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; /&amp;gt;

        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Margin&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;7&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Addresses&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;FontWeight&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Bold&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;3&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.ColumnSpan&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;2&amp;quot; /&amp;gt;

        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ListBox &lt;/span&gt;&lt;span style="color: red"&gt;ItemsSource&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=Addresses}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;4&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.ColumnSpan&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;2&amp;quot;&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ListBox.ItemTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.ColumnDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;100&amp;quot; /&amp;gt;
                            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;75&amp;quot; /&amp;gt;
                            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;30&amp;quot; /&amp;gt;
                            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Auto&amp;quot; /&amp;gt;
                        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.ColumnDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=LineOne}&amp;quot; /&amp;gt;
                        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=City}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; /&amp;gt;
                        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=State}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;2&amp;quot; /&amp;gt;
                        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=Zip}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;3&amp;quot; /&amp;gt;
                    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
            &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;ListBox.ItemTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;ListBox&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;

    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;

    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image &lt;/span&gt;&lt;span style="color: red"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Top&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Source&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=Customer.Photo}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Margin&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;6&amp;quot; /&amp;gt;
&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;

&lt;/span&gt;&lt;/pre&gt;

&lt;br /&gt;

&lt;h2&gt;Demo-04 Northwind Master Details Details &lt;/h2&gt;

&lt;p&gt;Open Demo04NorthwindMasterDetailsDetails.xaml. &lt;/p&gt;

&lt;p&gt;This is an example of using chained CollectionViewSources where the top level CollectionViewSource is the DataContext for a form. It is assumed that the CollectionViewSources will be populated at run-time from a code-behind method. &lt;/p&gt;

&lt;p&gt;This example uses an EntityFramework model for the entity types. &lt;/p&gt;

&lt;p&gt;The below sample data file has 2 instances of Customer each with 1 instance of Order and each Order has three instances of Order_Detail. &lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;sysCol&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;ArrayList &lt;/span&gt;&lt;span style="color: red"&gt;xmlns&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;sysCol&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;clr-namespace:System.Collections;assembly=mscorlib&amp;quot;
                  &lt;/span&gt;&lt;span style="color: red"&gt;xmlns&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;nw&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;clr-namespace:SampleDataScenarios.NorthwindModel&amp;quot;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;nw&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Customer &lt;/span&gt;&lt;span style="color: red"&gt;Contact_Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Jim Hance&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Company_Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Adatum&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Contact_Title&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Software Developer&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Customer_ID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;nw&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Customer.Orders&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;nw&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Order &lt;/span&gt;&lt;span style="color: red"&gt;Order_Date&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;12/12/2009&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Ship_Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Jim Hance&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Customer_ID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Order_ID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot;
                      &lt;/span&gt;&lt;span style="color: red"&gt;Ship_Address&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;125 North St&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Employee_ID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;74&amp;quot;&amp;gt;
                &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;nw&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Order.Order_Details&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;nw&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Order_Detail &lt;/span&gt;&lt;span style="color: red"&gt;Product_ID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;125&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Discount&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;50&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Order_ID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Quantity&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;5&amp;quot; 
                                     &lt;/span&gt;&lt;span style="color: red"&gt;Unit_Price&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;75.99&amp;quot; /&amp;gt;
                    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;nw&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Order_Detail &lt;/span&gt;&lt;span style="color: red"&gt;Product_ID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;742&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Order_ID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Quantity&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;9&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Unit_Price&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;5.99&amp;quot; /&amp;gt;
                    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;nw&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Order_Detail &lt;/span&gt;&lt;span style="color: red"&gt;Product_ID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;2555&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Order_ID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Quantity&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;50&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Unit_Price&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;6.25&amp;quot; /&amp;gt;
                &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;nw&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Order.Order_Details&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
            &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;nw&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Order&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;nw&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Customer.Orders&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;nw&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Customer&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;nw&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Customer &lt;/span&gt;&lt;span style="color: red"&gt;Contact_Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Michael Patten&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Company_Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Contoso&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Contact_Title&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Sales Manager&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Customer_ID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;2&amp;quot;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;nw&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Customer.Orders&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;nw&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Order &lt;/span&gt;&lt;span style="color: red"&gt;Order_Date&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;12/12/2009&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Ship_Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Michael Patten&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Customer_ID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;2&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Order_ID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;71&amp;quot;
                      &lt;/span&gt;&lt;span style="color: red"&gt;Ship_Address&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;125 North St&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Employee_ID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;55&amp;quot;&amp;gt;
                &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;nw&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Order.Order_Details&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;nw&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Order_Detail &lt;/span&gt;&lt;span style="color: red"&gt;Product_ID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;547&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Discount&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;50&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Order_ID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;71&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Quantity&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;5&amp;quot; 
                                     &lt;/span&gt;&lt;span style="color: red"&gt;Unit_Price&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;75.99&amp;quot; /&amp;gt;
                    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;nw&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Order_Detail &lt;/span&gt;&lt;span style="color: red"&gt;Product_ID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;62&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Order_ID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;71&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Quantity&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;9&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Unit_Price&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;5.99&amp;quot; /&amp;gt;
                    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;nw&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Order_Detail &lt;/span&gt;&lt;span style="color: red"&gt;Product_ID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;11&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Order_ID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;71&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Quantity&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;50&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Unit_Price&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;6.25&amp;quot; /&amp;gt;
                &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;nw&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Order.Order_Details&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
            &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;nw&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Order&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;nw&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Customer.Orders&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;nw&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Customer&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;sysCol&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;ArrayList&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;&lt;img alt="" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/5123.063010_5F00_2249_5F00_SampleDatai6.png" /&gt; &lt;/p&gt;

&lt;h3&gt;Connecting Sample Data &lt;/h3&gt;

&lt;p&gt;In the below XAML the NorthwindSampleData.xaml file is loaded and parsed by the d:DesignData Markup Extension and assigned to the d:DesignSource for the top level customersViewSource CollectionViewSource. The two remaining CollectionViewSources chain to collection properties on the customersViewSource. &lt;/p&gt;

&lt;p&gt;Child controls of the Grid can data bind to properties on the DataContext and the Designer Binding Builder tooling is enabled. Notice the two DataGrid ItemsSource's are the two chained CollectionViewSources. The two DataGrid's also have their sample data populated and the Designer Binding Builder tooling is enabled. &lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;UserControl.Resources&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
  &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;CollectionViewSource 
    &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Key&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;customersViewSource&amp;quot; 
    &lt;/span&gt;&lt;span style="color: red"&gt;d&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;DesignSource&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;d&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;DesignData &lt;/span&gt;&lt;span style="color: red"&gt;Source&lt;/span&gt;&lt;span style="color: blue"&gt;=..&lt;/span&gt;/&lt;span style="color: blue"&gt;SampleData&lt;/span&gt;/&lt;span style="color: blue"&gt;NorthwindSampleData.xaml}&amp;quot; /&amp;gt;
  &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;CollectionViewSource 
    &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Key&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;customersOrdersViewSource&amp;quot; 
    &lt;/span&gt;&lt;span style="color: red"&gt;Source&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=Orders, &lt;/span&gt;&lt;span style="color: red"&gt;Source&lt;/span&gt;&lt;span style="color: blue"&gt;={&lt;/span&gt;&lt;span style="color: #a31515"&gt;StaticResource &lt;/span&gt;&lt;span style="color: red"&gt;customersViewSource&lt;/span&gt;&lt;span style="color: blue"&gt;}}&amp;quot; /&amp;gt;
  &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;CollectionViewSource 
    &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Key&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;customersOrdersOrder_DetailsViewSource&amp;quot; 
    &lt;/span&gt;&lt;span style="color: red"&gt;Source&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=Order_Details, &lt;/span&gt;&lt;span style="color: red"&gt;Source&lt;/span&gt;&lt;span style="color: blue"&gt;={&lt;/span&gt;&lt;span style="color: #a31515"&gt;StaticResource &lt;/span&gt;&lt;span style="color: red"&gt;customersOrdersViewSource&lt;/span&gt;&lt;span style="color: blue"&gt;}}&amp;quot; /&amp;gt;
&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;UserControl.Resources&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid &lt;/span&gt;&lt;span style="color: red"&gt;DataContext&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;StaticResource &lt;/span&gt;&lt;span style="color: red"&gt;customersViewSource&lt;/span&gt;&lt;span style="color: blue"&gt;}&amp;quot;&amp;gt;
  &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.RowDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;RowDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Auto&amp;quot; /&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;RowDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;*&amp;quot; /&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;RowDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;*&amp;quot; /&amp;gt;
  &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.RowDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
  &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.ColumnDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;200&amp;quot; /&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;*&amp;quot; /&amp;gt;
  &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.ColumnDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;

  &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Demo-04 Northwind Master Details Details&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.ColumnSpan&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;2&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;FontWeight&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Bold&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;FontSize&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;14&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Margin&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;11&amp;quot; /&amp;gt;

  &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ListView 
    &lt;/span&gt;&lt;span style="color: red"&gt;SelectedIndex&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;0&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;ItemsSource&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding&lt;/span&gt;&lt;span style="color: blue"&gt;}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;customersListView&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;SelectionMode&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Single&amp;quot; 
    &lt;/span&gt;&lt;span style="color: red"&gt;Margin&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;3.5,4&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.RowSpan&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;2&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ListView.ItemContainerStyle&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Style&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Setter &lt;/span&gt;&lt;span style="color: red"&gt;Property&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Control.HorizontalContentAlignment&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Value&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Stretch&amp;quot; /&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Setter &lt;/span&gt;&lt;span style="color: red"&gt;Property&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Control.VerticalContentAlignment&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Value&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Stretch&amp;quot; /&amp;gt;
      &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Style&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;ListView.ItemContainerStyle&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ListView.View&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;GridView&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;GridViewColumn &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;company_NameColumn&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Header&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Company Name&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;90&amp;quot;&amp;gt;
          &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;GridViewColumn.CellTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
              &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBox 
                &lt;/span&gt;&lt;span style="color: red"&gt;Margin&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;-6,-1&amp;quot; 
                &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=Company_Name, &lt;/span&gt;&lt;span style="color: red"&gt;Mode&lt;/span&gt;&lt;span style="color: blue"&gt;=TwoWay, &lt;/span&gt;&lt;span style="color: red"&gt;ValidatesOnExceptions&lt;/span&gt;&lt;span style="color: blue"&gt;=true, &lt;/span&gt;&lt;span style="color: red"&gt;NotifyOnValidationError&lt;/span&gt;&lt;span style="color: blue"&gt;=true}&amp;quot; /&amp;gt;
            &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
          &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;GridViewColumn.CellTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;GridViewColumn&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;GridViewColumn &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;contact_NameColumn&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Header&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Contact Name&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;90&amp;quot;&amp;gt;
          &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;GridViewColumn.CellTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
              &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBox 
                &lt;/span&gt;&lt;span style="color: red"&gt;Margin&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;-6,-1&amp;quot; 
                &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=Contact_Name, &lt;/span&gt;&lt;span style="color: red"&gt;Mode&lt;/span&gt;&lt;span style="color: blue"&gt;=TwoWay, &lt;/span&gt;&lt;span style="color: red"&gt;ValidatesOnExceptions&lt;/span&gt;&lt;span style="color: blue"&gt;=true, &lt;/span&gt;&lt;span style="color: red"&gt;NotifyOnValidationError&lt;/span&gt;&lt;span style="color: blue"&gt;=true}&amp;quot; /&amp;gt;
            &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
          &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;GridViewColumn.CellTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;GridViewColumn&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
      &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;GridView&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;ListView.View&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
  &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;ListView&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;

  &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Margin&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;3.5&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataGrid 
      &lt;/span&gt;&lt;span style="color: red"&gt;AutoGenerateColumns&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;False&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;EnableRowVirtualization&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;True&amp;quot; 
      &lt;/span&gt;&lt;span style="color: red"&gt;ItemsSource&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Source&lt;/span&gt;&lt;span style="color: blue"&gt;={&lt;/span&gt;&lt;span style="color: #a31515"&gt;StaticResource &lt;/span&gt;&lt;span style="color: red"&gt;customersOrdersViewSource&lt;/span&gt;&lt;span style="color: blue"&gt;}}&amp;quot; 
      &lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;ordersDataGrid&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;RowDetailsVisibilityMode&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;VisibleWhenSelected&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Margin&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;3.5&amp;quot;&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataGrid.Columns&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataGridTextColumn 
          &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;order_IDColumn&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Binding&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=Order_ID}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Header&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Order ID&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;SizeToHeader&amp;quot; /&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataGridTextColumn 
          &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;customer_IDColumn&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Binding&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=Customer_ID}&amp;quot; 
          &lt;/span&gt;&lt;span style="color: red"&gt;Header&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Customer ID&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;SizeToHeader&amp;quot; /&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataGridTextColumn 
          &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;employee_IDColumn&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Binding&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=Employee_ID}&amp;quot; 
          &lt;/span&gt;&lt;span style="color: red"&gt;Header&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Employee ID&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;SizeToHeader&amp;quot; /&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataGridTextColumn 
          &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;ship_NameColumn&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Binding&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=Ship_Name}&amp;quot; 
          &lt;/span&gt;&lt;span style="color: red"&gt;Header&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Ship Name&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;SizeToHeader&amp;quot; /&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataGridTextColumn 
          &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;ship_AddressColumn&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Binding&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=Ship_Address}&amp;quot; 
          &lt;/span&gt;&lt;span style="color: red"&gt;Header&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Ship Address&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;SizeToHeader&amp;quot; /&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataGridTextColumn 
          &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;ship_CityColumn&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Binding&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=Ship_City}&amp;quot; 
          &lt;/span&gt;&lt;span style="color: red"&gt;Header&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Ship City&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;SizeToHeader&amp;quot; /&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataGridTextColumn 
          &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;ship_RegionColumn&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Binding&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=Ship_Region}&amp;quot; 
          &lt;/span&gt;&lt;span style="color: red"&gt;Header&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Ship Region&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;SizeToHeader&amp;quot; /&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataGridTextColumn 
          &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;ship_Postal_CodeColumn&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Binding&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=Ship_Postal_Code}&amp;quot; 
          &lt;/span&gt;&lt;span style="color: red"&gt;Header&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Ship Postal Code&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;SizeToHeader&amp;quot; /&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataGridTextColumn 
          &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;ship_CountryColumn&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Binding&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=Ship_Country}&amp;quot; 
          &lt;/span&gt;&lt;span style="color: red"&gt;Header&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Ship Country&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;SizeToHeader&amp;quot; /&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataGridTextColumn 
          &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;ship_ViaColumn&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Binding&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=Ship_Via}&amp;quot; 
          &lt;/span&gt;&lt;span style="color: red"&gt;Header&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Ship Via&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;SizeToHeader&amp;quot; /&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataGridTemplateColumn 
          &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;order_DateColumn&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Header&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Order Date&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;SizeToHeader&amp;quot;&amp;gt;
          &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataGridTemplateColumn.CellTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
              &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;DatePicker 
                &lt;/span&gt;&lt;span style="color: red"&gt;SelectedDate&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=Order_Date, &lt;/span&gt;&lt;span style="color: red"&gt;Mode&lt;/span&gt;&lt;span style="color: blue"&gt;=TwoWay, 
                                &lt;/span&gt;&lt;span style="color: red"&gt;ValidatesOnExceptions&lt;/span&gt;&lt;span style="color: blue"&gt;=true, &lt;/span&gt;&lt;span style="color: red"&gt;NotifyOnValidationError&lt;/span&gt;&lt;span style="color: blue"&gt;=true}&amp;quot; /&amp;gt;
            &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
          &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataGridTemplateColumn.CellTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataGridTemplateColumn&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataGridTemplateColumn &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;required_DateColumn&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Header&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Required Date&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;SizeToHeader&amp;quot;&amp;gt;
          &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataGridTemplateColumn.CellTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
              &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;DatePicker 
                &lt;/span&gt;&lt;span style="color: red"&gt;SelectedDate&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=Required_Date, &lt;/span&gt;&lt;span style="color: red"&gt;Mode&lt;/span&gt;&lt;span style="color: blue"&gt;=TwoWay, 
                                &lt;/span&gt;&lt;span style="color: red"&gt;ValidatesOnExceptions&lt;/span&gt;&lt;span style="color: blue"&gt;=true, &lt;/span&gt;&lt;span style="color: red"&gt;NotifyOnValidationError&lt;/span&gt;&lt;span style="color: blue"&gt;=true}&amp;quot; /&amp;gt;
            &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
          &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataGridTemplateColumn.CellTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataGridTemplateColumn&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataGridTemplateColumn &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;shipped_DateColumn&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Header&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Shipped Date&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;SizeToHeader&amp;quot;&amp;gt;
          &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataGridTemplateColumn.CellTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
              &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;DatePicker 
                &lt;/span&gt;&lt;span style="color: red"&gt;SelectedDate&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=Shipped_Date, &lt;/span&gt;&lt;span style="color: red"&gt;Mode&lt;/span&gt;&lt;span style="color: blue"&gt;=TwoWay, 
                                &lt;/span&gt;&lt;span style="color: red"&gt;ValidatesOnExceptions&lt;/span&gt;&lt;span style="color: blue"&gt;=true, &lt;/span&gt;&lt;span style="color: red"&gt;NotifyOnValidationError&lt;/span&gt;&lt;span style="color: blue"&gt;=true}&amp;quot; /&amp;gt;
            &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
          &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataGridTemplateColumn.CellTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataGridTemplateColumn&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataGridTextColumn 
          &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;freightColumn&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Binding&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=Freight}&amp;quot; 
          &lt;/span&gt;&lt;span style="color: red"&gt;Header&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Freight&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;SizeToHeader&amp;quot; /&amp;gt;
      &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataGrid.Columns&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataGrid&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
  &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
  &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataGrid 
    &lt;/span&gt;&lt;span style="color: red"&gt;AutoGenerateColumns&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;False&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;EnableRowVirtualization&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;True&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;2&amp;quot; 
    &lt;/span&gt;&lt;span style="color: red"&gt;ItemsSource&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Source&lt;/span&gt;&lt;span style="color: blue"&gt;={&lt;/span&gt;&lt;span style="color: #a31515"&gt;StaticResource &lt;/span&gt;&lt;span style="color: red"&gt;customersOrdersOrder_DetailsViewSource&lt;/span&gt;&lt;span style="color: blue"&gt;}}&amp;quot; 
    &lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;order_DetailsDataGrid&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;RowDetailsVisibilityMode&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;VisibleWhenSelected&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Margin&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;3.5&amp;quot;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataGrid.Columns&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataGridTextColumn 
        &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;order_IDColumn1&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Binding&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=Order_ID}&amp;quot; 
        &lt;/span&gt;&lt;span style="color: red"&gt;Header&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Order ID&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;SizeToHeader&amp;quot; /&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataGridTextColumn 
        &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;product_IDColumn&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Binding&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=Product_ID}&amp;quot; 
        &lt;/span&gt;&lt;span style="color: red"&gt;Header&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Product ID&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;SizeToHeader&amp;quot; /&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataGridTextColumn 
        &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;unit_PriceColumn&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Binding&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=Unit_Price}&amp;quot; 
        &lt;/span&gt;&lt;span style="color: red"&gt;Header&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Unit Price&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;SizeToHeader&amp;quot; /&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataGridTextColumn 
        &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;quantityColumn&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Binding&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=Quantity}&amp;quot; 
        &lt;/span&gt;&lt;span style="color: red"&gt;Header&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Quantity&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;SizeToHeader&amp;quot; /&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataGridTextColumn 
        &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;discountColumn&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Binding&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=Discount}&amp;quot; 
        &lt;/span&gt;&lt;span style="color: red"&gt;Header&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Discount&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;SizeToHeader&amp;quot; /&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataGrid.Columns&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
  &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataGrid&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&lt;/span&gt;&lt;/pre&gt;

&lt;br /&gt;

&lt;h2&gt;Demo-05 Select Customer From List &lt;/h2&gt;

&lt;p&gt;Open Demo05SelectCustomerFromList.xaml. &lt;/p&gt;

&lt;p&gt;This is an example of a multiple instance sample data file consumed by a form. The sample data consists of 3 Customers, each with 2 Addresses. &lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Customers &lt;/span&gt;&lt;span style="color: red"&gt;xmlns&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;clr-namespace:SampleDataScenarios.Model&amp;quot;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Customer &lt;/span&gt;&lt;span style="color: red"&gt;FirstName&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Alfons&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;LastName&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Parovszky&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Photo&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;../Images/image01.png&amp;quot;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Customer.Addresses&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Address &lt;/span&gt;&lt;span style="color: red"&gt;LineOne&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;125 North St&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;City&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Greatville&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;State&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;CA&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Zip&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;98004&amp;quot; /&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Address &lt;/span&gt;&lt;span style="color: red"&gt;LineOne&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;3000 1st St NE&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;City&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Coolville&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;State&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;CA&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Zip&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;98004&amp;quot; /&amp;gt;
        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Customer.Addresses&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Customer&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Customer &lt;/span&gt;&lt;span style="color: red"&gt;FirstName&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Lori&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;LastName&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Penor&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Photo&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;../Images/image02.png&amp;quot;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Customer.Addresses&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Address &lt;/span&gt;&lt;span style="color: red"&gt;LineOne&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;126 East St&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;City&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Greatville&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;State&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;CA&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Zip&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;98004&amp;quot; /&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Address &lt;/span&gt;&lt;span style="color: red"&gt;LineOne&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;3001 2st St NE&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;City&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Coolville&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;State&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;CA&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Zip&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;98004&amp;quot; /&amp;gt;
        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Customer.Addresses&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Customer&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Customer &lt;/span&gt;&lt;span style="color: red"&gt;FirstName&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Justin&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;LastName&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Harrison&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Photo&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;../Images/image03.png&amp;quot;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Customer.Addresses&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Address &lt;/span&gt;&lt;span style="color: red"&gt;LineOne&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;127 West St&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;City&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Greatville&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;State&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;CA&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Zip&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;98004&amp;quot; /&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Address &lt;/span&gt;&lt;span style="color: red"&gt;LineOne&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;3002 3st St NE&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;City&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Coolville&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;State&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;CA&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Zip&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;98004&amp;quot; /&amp;gt;
        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Customer.Addresses&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Customer&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Customers&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;In the below form, the collection of Customers is available in the root Grid's DataContext. This is important because the presence of d:DesignData and sample data not only feeds the DataContext to render data, but also enables the Designer tooling for creating and editing bindings in the Binding Builder. &lt;/p&gt;

&lt;p&gt;The data entry form to the right of the ListBox, has its DataContext set to the ListBox.SelectedItem. When ListBox selection changes the form data automatically changes. &lt;/p&gt;

&lt;p&gt;&lt;img alt="" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/0638.063010_5F00_2249_5F00_SampleDatai7.png" /&gt; &lt;/p&gt;

&lt;h3&gt;Connecting Sample Data &lt;/h3&gt;

&lt;p&gt;In the below XAML the CustomersSampleData.xaml file is loaded and parsed by the d:DesignData Markup Extension and assigned to the d:DataContext for the Grid. Child controls of the Grid can data bind to properties on the DataContext and the Designer Binding Builder tooling is enabled. &lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid &lt;/span&gt;&lt;span style="color: red"&gt;d&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;DataContext&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;d&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;DesignData &lt;/span&gt;&lt;span style="color: red"&gt;Source&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;/&lt;span style="color: blue"&gt;SampleData&lt;/span&gt;/&lt;span style="color: blue"&gt;CustomersSampleData.xaml}&amp;quot;&amp;gt;
  &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.RowDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;RowDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Auto&amp;quot; /&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;RowDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;*&amp;quot; /&amp;gt;
  &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.RowDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
  &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.ColumnDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;126&amp;quot; /&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;*&amp;quot; /&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;*&amp;quot; /&amp;gt;
  &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.ColumnDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;

  &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Demo-05 Select Customer From List&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.ColumnSpan&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;3&amp;quot; 
                  &lt;/span&gt;&lt;span style="color: red"&gt;FontWeight&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Bold&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;FontSize&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;14&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Margin&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;11&amp;quot; /&amp;gt;

  &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ListBox &lt;/span&gt;&lt;span style="color: red"&gt;SelectedIndex&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;0&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;lbCustomers&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Margin&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;6&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;ItemsSource&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding&lt;/span&gt;&lt;span style="color: blue"&gt;}&amp;quot;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ListBox.ItemTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;StackPanel &lt;/span&gt;&lt;span style="color: red"&gt;Orientation&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Horizontal&amp;quot;&amp;gt;
          &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=FirstName}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Margin&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;0,0,4,0&amp;quot; /&amp;gt;
          &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=LastName}&amp;quot; /&amp;gt;
        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;StackPanel&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
      &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;ListBox.ItemTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
  &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;ListBox&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;

  &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Margin&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;6&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;DataContext&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;ElementName&lt;/span&gt;&lt;span style="color: blue"&gt;=lbCustomers, &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=SelectedItem}&amp;quot;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.RowDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;RowDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Auto&amp;quot; /&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;RowDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Auto&amp;quot; /&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;RowDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Auto&amp;quot; /&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;RowDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Auto&amp;quot; /&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;RowDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;*&amp;quot; /&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.RowDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.ColumnDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Auto&amp;quot; /&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;*&amp;quot; /&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.ColumnDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;

    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;First Name:&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Center&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;75&amp;quot; /&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBox &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=FirstName}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Center&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot;/&amp;gt;

    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Last Name:&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Center&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;75&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; /&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBox &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=LastName}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Center&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; /&amp;gt;

    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Ranking:&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Center&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;75&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;2&amp;quot; /&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=Ranking}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Center&amp;quot;  &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;2&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; /&amp;gt;

    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Margin&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;7&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Addresses&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;FontWeight&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Bold&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;3&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.ColumnSpan&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;2&amp;quot; /&amp;gt;

    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ListBox &lt;/span&gt;&lt;span style="color: red"&gt;ItemsSource&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=Addresses}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;4&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.ColumnSpan&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;2&amp;quot;&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ListBox.ItemTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
          &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.ColumnDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
              &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;100&amp;quot; /&amp;gt;
              &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;75&amp;quot; /&amp;gt;
              &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;30&amp;quot; /&amp;gt;
              &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Auto&amp;quot; /&amp;gt;
            &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.ColumnDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=LineOne}&amp;quot; /&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=City}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; /&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=State}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;2&amp;quot; /&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=Zip}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;3&amp;quot; /&amp;gt;
          &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
      &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;ListBox.ItemTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;ListBox&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;

  &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;

  &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image &lt;/span&gt;&lt;span style="color: red"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Top&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Source&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=Photo}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;2&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Margin&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;6&amp;quot; /&amp;gt;
&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;

&lt;/span&gt;&lt;/pre&gt;

&lt;br /&gt;

&lt;h2&gt;Demo-06 Typed DataTemplate &lt;/h2&gt;

&lt;p&gt;Open Demo06TypedDataTemplate.xaml. &lt;/p&gt;

&lt;p&gt;The example demonstrates the requirements for displaying sample data when that data is rendered using a typed DataTemplate in a Resource. The key point here is that the DataTemplate is typed and in a Resource. &lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Customer 
    &lt;/span&gt;&lt;span style="color: red"&gt;xmlns&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;clr-namespace:SampleDataScenarios.Model&amp;quot; 
    &lt;/span&gt;&lt;span style="color: red"&gt;FirstName&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Alfons&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;LastName&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Parovszky&amp;quot; 
    &lt;/span&gt;&lt;span style="color: red"&gt;Photo&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;../Images/image01.png&amp;quot;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Customer.Addresses&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Address &lt;/span&gt;&lt;span style="color: red"&gt;LineOne&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;125 North St&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;City&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Greatville&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;State&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;CA&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Zip&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;98004&amp;quot; /&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Address &lt;/span&gt;&lt;span style="color: red"&gt;LineOne&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;3000 1st St NE&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;City&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Coolville&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;State&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;CA&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Zip&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;98004&amp;quot; /&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Customer.Addresses&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Customer&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;

&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;Typed DataTemplates are looked up based on DataType. If WPF cannot match the DataTemplate.DataType property with the sample data type, the DataTemplate will not be used to render the sample data. Additionally, any mismatch will also affect using the Designer Binding Builder as it won't be able to resolve properties in the DataContext. The results of a mismatch are pictured in the right column of the two below tables. &lt;/p&gt;

&lt;p&gt;When the sample data file Build Action is DesignDataWithDesignTimeCreatableTypes, the DataTemplate must have the d:IsDesignTimeCreatable property set to True or not set at all. &lt;/p&gt;

&lt;div&gt;
  &lt;table style="border-collapse: collapse" border="0"&gt;&lt;colgroup&gt;&lt;col /&gt;&lt;col /&gt;&lt;/colgroup&gt;&lt;tbody valign="top"&gt;
      &lt;tr&gt;
        &lt;td style="border-bottom: #a6a6a6 0.5pt solid; border-left: #a6a6a6 0.5pt solid; padding-left: 7px; padding-right: 7px; border-top: #a6a6a6 0.5pt solid; border-right: #a6a6a6 0.5pt solid"&gt;
          &lt;p&gt;&lt;span style="font-size: 10pt"&gt;&lt;strong&gt;Correct Setting on Data Template When &lt;/strong&gt;&lt;/span&gt;

            &lt;br /&gt;&lt;span style="font-size: 10pt"&gt;&lt;strong&gt;Build Action = DesignDataWithDesignTimeCreatableTypes&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
        &lt;/td&gt;

        &lt;td style="border-bottom: #a6a6a6 0.5pt solid; padding-left: 7px; padding-right: 7px; border-left-style: none; border-top: #a6a6a6 0.5pt solid; border-right: #a6a6a6 0.5pt solid"&gt;
          &lt;p&gt;&lt;span style="font-size: 10pt"&gt;&lt;strong&gt;Incorrect Setting on the DataTemplate When &lt;/strong&gt;&lt;/span&gt;

            &lt;br /&gt;&lt;span style="font-size: 10pt"&gt;&lt;strong&gt;Build Action = DesignDataWithDesignTimeCreatableTypes &lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;

          &lt;br /&gt;

          &lt;p&gt;&lt;span style="font-size: 9pt"&gt;&lt;em&gt;Notice that ListBox is not using the typed DataTemplate to render the Address items.&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;
        &lt;/td&gt;
      &lt;/tr&gt;

      &lt;tr&gt;
        &lt;td style="border-bottom: #a6a6a6 0.5pt solid; border-left: #a6a6a6 0.5pt solid; padding-left: 7px; padding-right: 7px; border-top-style: none; border-right: #a6a6a6 0.5pt solid"&gt;
          &lt;p&gt;&lt;span style="font-family: consolas; color: blue; font-size: 8pt"&gt;&amp;lt;&lt;span style="color: #a31515"&gt;DataTemplate&lt;span style="color: red"&gt; DataType&lt;span style="color: blue"&gt;=&amp;quot;{&lt;span style="color: #a31515"&gt;x&lt;span style="color: blue"&gt;:&lt;span style="color: #a31515"&gt;Type&lt;span style="color: red"&gt; m&lt;span style="color: blue"&gt;:&lt;span style="color: red"&gt;Address&lt;span style="color: blue"&gt;}&amp;quot; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

          &lt;p&gt;&lt;span style="font-family: consolas; color: blue; font-size: 8pt"&gt;&lt;span style="color: #a31515"&gt;&lt;span style="color: red"&gt;&lt;span style="color: blue"&gt;&lt;span style="color: #a31515"&gt;&lt;span style="color: blue"&gt;&lt;span style="color: #a31515"&gt;&lt;span style="color: red"&gt;&lt;span style="color: blue"&gt;&lt;span style="color: red"&gt;&lt;span style="color: blue"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: consolas; color: red; font-size: 8pt"&gt;d&lt;span style="color: blue"&gt;:&lt;span style="color: red"&gt;IsDesignTimeCreatable&lt;span style="color: blue"&gt;=&amp;quot;True&amp;quot; &amp;gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

          &lt;p style="text-align: center"&gt;&lt;span style="font-family: consolas; font-size: 8pt"&gt;&lt;strong&gt;---or--- &lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;

          &lt;p&gt;&lt;span style="font-family: consolas; color: blue; font-size: 8pt"&gt;&amp;lt;&lt;span style="color: #a31515"&gt;DataTemplate&lt;span style="color: red"&gt; DataType&lt;span style="color: blue"&gt;=&amp;quot;{&lt;span style="color: #a31515"&gt;x&lt;span style="color: blue"&gt;:&lt;span style="color: #a31515"&gt;Type&lt;span style="color: red"&gt; m&lt;span style="color: blue"&gt;:&lt;span style="color: red"&gt;Address&lt;span style="color: blue"&gt;}&amp;quot;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
        &lt;/td&gt;

        &lt;td style="border-bottom: #a6a6a6 0.5pt solid; padding-left: 7px; padding-right: 7px; border-top-style: none; border-left-style: none; border-right: #a6a6a6 0.5pt solid"&gt;
          &lt;p&gt;&lt;span style="font-family: consolas; color: blue; font-size: 8pt"&gt;&amp;lt;&lt;span style="color: #a31515"&gt;DataTemplate&lt;span style="color: red"&gt; DataType&lt;span style="color: blue"&gt;=&amp;quot;{&lt;span style="color: #a31515"&gt;x&lt;span style="color: blue"&gt;:&lt;span style="color: #a31515"&gt;Type&lt;span style="color: red"&gt; m&lt;span style="color: blue"&gt;:&lt;span style="color: red"&gt;Address&lt;span style="color: blue"&gt;}&amp;quot;&lt;span style="color: red"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

          &lt;p&gt;&lt;span style="font-family: consolas; color: red; font-size: 8pt"&gt;d&lt;span style="color: blue"&gt;:&lt;span style="color: red"&gt;IsDesignTimeCreatable&lt;span style="color: blue"&gt;=&amp;quot;False&amp;quot; &amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
        &lt;/td&gt;
      &lt;/tr&gt;

      &lt;tr&gt;
        &lt;td style="border-bottom: #a6a6a6 0.5pt solid; border-left: #a6a6a6 0.5pt solid; padding-left: 7px; padding-right: 7px; border-top-style: none; border-right: #a6a6a6 0.5pt solid"&gt;
          &lt;p&gt;&lt;img alt="" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/6012.063010_5F00_2249_5F00_SampleDatai8.png" /&gt;&lt;/p&gt;
        &lt;/td&gt;

        &lt;td style="border-bottom: #a6a6a6 0.5pt solid; padding-left: 7px; padding-right: 7px; border-top-style: none; border-left-style: none; border-right: #a6a6a6 0.5pt solid"&gt;
          &lt;p&gt;&lt;img alt="" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/0310.063010_5F00_2249_5F00_SampleDatai9.png" /&gt;&lt;/p&gt;
        &lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;

&lt;p&gt;When the sample data file Build Action is DesignData, the DataTemplate must have the d:IsDesignTimeCreatable property set to False. &lt;/p&gt;

&lt;div&gt;
  &lt;table style="border-collapse: collapse" border="0"&gt;&lt;colgroup&gt;&lt;col /&gt;&lt;col /&gt;&lt;/colgroup&gt;&lt;tbody valign="top"&gt;
      &lt;tr&gt;
        &lt;td style="border-bottom: #a6a6a6 0.5pt solid; border-left: #a6a6a6 0.5pt solid; padding-left: 7px; padding-right: 7px; border-top: #a6a6a6 0.5pt solid; border-right: #a6a6a6 0.5pt solid"&gt;
          &lt;p&gt;&lt;span style="font-size: 10pt"&gt;&lt;strong&gt;Correct Setting on the DataTemplate &lt;/strong&gt;&lt;/span&gt;

            &lt;br /&gt;&lt;span style="font-size: 10pt"&gt;&lt;strong&gt;Build Action = DesignData&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
        &lt;/td&gt;

        &lt;td style="border-bottom: #a6a6a6 0.5pt solid; padding-left: 7px; padding-right: 7px; border-left-style: none; border-top: #a6a6a6 0.5pt solid; border-right: #a6a6a6 0.5pt solid"&gt;
          &lt;p&gt;&lt;span style="font-size: 10pt"&gt;&lt;strong&gt;Incorrect Setting on the DataTemplate &lt;/strong&gt;&lt;/span&gt;

            &lt;br /&gt;&lt;span style="font-size: 10pt"&gt;&lt;strong&gt;Build Action = DesignData &lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;

          &lt;br /&gt;

          &lt;p&gt;&lt;span style="font-size: 9pt"&gt;&lt;em&gt;Notice that ListBox is not using the typed DataTemplate to render the Address items.&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;
        &lt;/td&gt;
      &lt;/tr&gt;

      &lt;tr&gt;
        &lt;td style="border-bottom: #a6a6a6 0.5pt solid; border-left: #a6a6a6 0.5pt solid; padding-left: 7px; padding-right: 7px; border-top-style: none; border-right: #a6a6a6 0.5pt solid"&gt;
          &lt;p&gt;&lt;span style="font-family: consolas; color: blue; font-size: 8pt"&gt;&amp;lt;&lt;span style="color: #a31515"&gt;DataTemplate&lt;span style="color: red"&gt; DataType&lt;span style="color: blue"&gt;=&amp;quot;{&lt;span style="color: #a31515"&gt;x&lt;span style="color: blue"&gt;:&lt;span style="color: #a31515"&gt;Type&lt;span style="color: red"&gt; m&lt;span style="color: blue"&gt;:&lt;span style="color: red"&gt;Address&lt;span style="color: blue"&gt;}&amp;quot;&lt;span style="color: red"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

          &lt;p&gt;&lt;span style="font-family: consolas; color: red; font-size: 8pt"&gt;d&lt;span style="color: blue"&gt;:&lt;span style="color: red"&gt;IsDesignTimeCreatable&lt;span style="color: blue"&gt;=&amp;quot;False&amp;quot; &amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
        &lt;/td&gt;

        &lt;td style="border-bottom: #a6a6a6 0.5pt solid; padding-left: 7px; padding-right: 7px; border-top-style: none; border-left-style: none; border-right: #a6a6a6 0.5pt solid"&gt;
          &lt;p&gt;&lt;span style="font-family: consolas; color: blue; font-size: 8pt"&gt;&amp;lt;&lt;span style="color: #a31515"&gt;DataTemplate&lt;span style="color: red"&gt; DataType&lt;span style="color: blue"&gt;=&amp;quot;{&lt;span style="color: #a31515"&gt;x&lt;span style="color: blue"&gt;:&lt;span style="color: #a31515"&gt;Type&lt;span style="color: red"&gt; m&lt;span style="color: blue"&gt;:&lt;span style="color: red"&gt;Address&lt;span style="color: blue"&gt;}&amp;quot;&lt;span style="color: red"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

          &lt;p&gt;&lt;span style="font-family: consolas; color: red; font-size: 8pt"&gt;d&lt;span style="color: blue"&gt;:&lt;span style="color: red"&gt;IsDesignTimeCreatable&lt;span style="color: blue"&gt;=&amp;quot;True&amp;quot; &amp;gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

          &lt;p style="text-align: center"&gt;&lt;span style="font-family: consolas; font-size: 8pt"&gt;&lt;strong&gt;---or--- &lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;

          &lt;p&gt;&lt;span style="font-family: consolas; color: blue; font-size: 8pt"&gt;&amp;lt;&lt;span style="color: #a31515"&gt;DataTemplate&lt;span style="color: red"&gt; DataType&lt;span style="color: blue"&gt;=&amp;quot;{&lt;span style="color: #a31515"&gt;x&lt;span style="color: blue"&gt;:&lt;span style="color: #a31515"&gt;Type&lt;span style="color: red"&gt; m&lt;span style="color: blue"&gt;:&lt;span style="color: red"&gt;Address&lt;span style="color: blue"&gt;}&amp;quot;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
        &lt;/td&gt;
      &lt;/tr&gt;

      &lt;tr&gt;
        &lt;td style="border-bottom: #a6a6a6 0.5pt solid; border-left: #a6a6a6 0.5pt solid; padding-left: 7px; padding-right: 7px; border-top-style: none; border-right: #a6a6a6 0.5pt solid"&gt;
          &lt;p&gt;&lt;img alt="" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/6683.063010_5F00_2249_5F00_SampleDatai10.png" /&gt;&lt;/p&gt;
        &lt;/td&gt;

        &lt;td style="border-bottom: #a6a6a6 0.5pt solid; padding-left: 7px; padding-right: 7px; border-top-style: none; border-left-style: none; border-right: #a6a6a6 0.5pt solid"&gt;
          &lt;p&gt;&lt;img alt="" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/7563.063010_5F00_2249_5F00_SampleDatai11.png" /&gt;&lt;/p&gt;
        &lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;

&lt;br /&gt;

&lt;h3&gt;Connecting Sample Data &lt;/h3&gt;

&lt;p&gt;In the below XAML the CustomerSampleData.xaml file is loaded and parsed by the d:DesignData Markup Extension and assigned to the d:DataContext for the Grid. Child controls of the Grid can data bind to properties on the DataContext and the Designer Binding Builder tooling is enabled. &lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;UserControl.Resources&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
  &lt;/span&gt;&lt;span style="color: green"&gt;&amp;lt;!--Because the sample data is using the DesignDataWithDesignTimeCreatableTypes build action, the 
      DataTemplate must have the property d:IsDesignTimeCreatable=&amp;quot;True&amp;quot; or not at all so that the  
      types will match and be resolved correctly by the designer.--&amp;gt;
  &lt;/span&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataTemplate &lt;/span&gt;&lt;span style="color: red"&gt;DataType&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Type &lt;/span&gt;&lt;span style="color: red"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Address&lt;/span&gt;&lt;span style="color: blue"&gt;}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;d&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;IsDesignTimeCreatable&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;True&amp;quot; &amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.ColumnDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;100&amp;quot; /&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;75&amp;quot; /&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;30&amp;quot; /&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Auto&amp;quot; /&amp;gt;
      &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.ColumnDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=LineOne}&amp;quot; /&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=City}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; /&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=State}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;2&amp;quot; /&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=Zip}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;3&amp;quot; /&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
  &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;

&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;UserControl.Resources&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid &lt;/span&gt;&lt;span style="color: red"&gt;d&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;DataContext&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;d&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;DesignData &lt;/span&gt;&lt;span style="color: red"&gt;Source&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;/&lt;span style="color: blue"&gt;SampleData&lt;/span&gt;/&lt;span style="color: blue"&gt;CustomerSampleData.xaml}&amp;quot;&amp;gt;
  &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.RowDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;RowDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Auto&amp;quot; /&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;RowDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;*&amp;quot; /&amp;gt;
  &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.RowDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
  &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.ColumnDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;*&amp;quot; /&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;*&amp;quot; /&amp;gt;
  &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.ColumnDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;

  &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Demo-06 Typed DataTemplate&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.ColumnSpan&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;2&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;FontWeight&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Bold&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;FontSize&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;14&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Margin&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;11&amp;quot; /&amp;gt;

  &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Margin&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;6&amp;quot;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.RowDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;RowDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Auto&amp;quot; /&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;RowDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Auto&amp;quot; /&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;RowDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Auto&amp;quot; /&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;RowDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Auto&amp;quot; /&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;RowDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;*&amp;quot; /&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.RowDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.ColumnDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Auto&amp;quot; /&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;*&amp;quot; /&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.ColumnDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;

    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;First Name:&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Center&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;75&amp;quot; /&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBox &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=FirstName}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Center&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot;/&amp;gt;

    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Last Name:&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Center&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;75&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; /&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBox &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=LastName}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Center&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; /&amp;gt;

    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Ranking:&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Center&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;75&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;2&amp;quot; /&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=Ranking}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Center&amp;quot;  &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;2&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; /&amp;gt;

    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Margin&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;7&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Addresses&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;FontWeight&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Bold&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;3&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.ColumnSpan&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;2&amp;quot; /&amp;gt;

    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ListBox &lt;/span&gt;&lt;span style="color: red"&gt;ItemsSource&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=Addresses}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;4&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.ColumnSpan&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;2&amp;quot; /&amp;gt;

  &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;

  &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image &lt;/span&gt;&lt;span style="color: red"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Top&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Source&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=Photo}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Margin&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;6&amp;quot; /&amp;gt;
&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&lt;/span&gt;&lt;/pre&gt;

&lt;h1&gt;Silverlight Sample Data Scenarios&lt;a id="silverlight" title="silverlight" name="silverlight"&gt;&amp;#160;&lt;/a&gt;&lt;/h1&gt;

&lt;p&gt;The above WPF scenarios are also valid for Silverlight and won't be repeated here. The biggest difference between the two platforms with respect to sample data is the required pack syntax for images in sample data files. &lt;/p&gt;

&lt;p&gt;Open either solution: CS-SampleDataScenarios or VB-SampleDataScenarios. &lt;/p&gt;

&lt;p&gt;Rebuild solution. &lt;/p&gt;

&lt;p&gt;The WPF samples are in the SLSampleDataScenarios project. &lt;/p&gt;

&lt;h2&gt;Demo-01 Single Customer &lt;/h2&gt;

&lt;p&gt;Open Demo01SingleCustomer.xaml. &lt;/p&gt;

&lt;p&gt;This is an example of a single instance sample data file consumed by a form. The single instance of Customer has 2 instances of Address. Notice the assembly name; component syntax is used to identify an image in the project that has its Build Action set to Resource. &lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Customer 
    &lt;/span&gt;&lt;span style="color: red"&gt;xmlns&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;clr-namespace:SLSampleDataScenarios.Model&amp;quot; 
    &lt;/span&gt;&lt;span style="color: red"&gt;FirstName&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Alfons&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;LastName&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Parovszky&amp;quot; 
    &lt;/span&gt;&lt;span style="color: red"&gt;Photo&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;/SLSampleDataScenarios;component/Images/image01.png&amp;quot;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Customer.Addresses&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Address &lt;/span&gt;&lt;span style="color: red"&gt;LineOne&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;125 North St&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;City&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Greatville&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;State&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;CA&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Zip&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;98004&amp;quot; /&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Address &lt;/span&gt;&lt;span style="color: red"&gt;LineOne&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;3000 1st St NE&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;City&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Coolville&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;State&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;CA&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Zip&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;98004&amp;quot; /&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Customer.Addresses&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Customer&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;

&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;In the below form, the Customer type is available in the root Grid's DataContext. This is important because the presence of d:DesignData and sample data not only feeds the DataContext to render data, but also enables the Designer tooling for creating and editing bindings in the Binding Builder. &lt;/p&gt;

&lt;p&gt;&lt;img alt="" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/1715.063010_5F00_2249_5F00_SampleDatai12.png" /&gt; &lt;/p&gt;

&lt;h3&gt;Connecting Sample Data &lt;/h3&gt;

&lt;p&gt;In the below XAML the CustomerSampleData.xaml file is loaded and parsed by the d:DesignData Markup Extension and assigned to the d:DataContext for the Grid. Child controls of the Grid can data bind to properties on the DataContext and the Designer Binding Builder tooling is enabled. &lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid &lt;/span&gt;&lt;span style="color: red"&gt;d&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;DataContext&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;d&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;DesignData &lt;/span&gt;&lt;span style="color: red"&gt;Source&lt;/span&gt;&lt;span style="color: blue"&gt;=..&lt;/span&gt;/&lt;span style="color: blue"&gt;SampleData&lt;/span&gt;/&lt;span style="color: blue"&gt;CustomerSampleData.xaml}&amp;quot;&amp;gt;
  &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.RowDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;RowDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Auto&amp;quot; /&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;RowDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;*&amp;quot; /&amp;gt;
  &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.RowDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
  &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.ColumnDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;*&amp;quot; /&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;*&amp;quot; /&amp;gt;
  &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.ColumnDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;

  &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Demo-01 Single Customer&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.ColumnSpan&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;2&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;FontWeight&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Bold&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;FontSize&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;14&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Margin&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;11&amp;quot; /&amp;gt;

  &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Margin&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;6&amp;quot;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.RowDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;RowDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Auto&amp;quot; /&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;RowDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Auto&amp;quot; /&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;RowDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Auto&amp;quot; /&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;RowDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Auto&amp;quot; /&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;RowDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;*&amp;quot; /&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.RowDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.ColumnDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Auto&amp;quot; /&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;*&amp;quot; /&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.ColumnDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;

    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;First Name:&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Center&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;75&amp;quot; /&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBox &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=FirstName}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Center&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot;/&amp;gt;

    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Last Name:&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Center&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;75&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; /&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBox &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=LastName}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Center&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; /&amp;gt;

    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Ranking:&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Center&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;75&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;2&amp;quot; /&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=Ranking}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Center&amp;quot;  &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;2&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; /&amp;gt;

    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Margin&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;7&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Addresses&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;FontWeight&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Bold&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;3&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.ColumnSpan&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;2&amp;quot; /&amp;gt;

    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ListBox &lt;/span&gt;&lt;span style="color: red"&gt;ItemsSource&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=Addresses}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;4&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.ColumnSpan&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;2&amp;quot;&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ListBox.ItemTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
          &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.ColumnDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
              &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;100&amp;quot; /&amp;gt;
              &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;75&amp;quot; /&amp;gt;
              &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;30&amp;quot; /&amp;gt;
              &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Auto&amp;quot; /&amp;gt;
            &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.ColumnDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=LineOne}&amp;quot; /&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=City}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; /&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=State}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;2&amp;quot; /&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=Zip}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;3&amp;quot; /&amp;gt;
          &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
      &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;ListBox.ItemTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;ListBox&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;

  &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;

  &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image &lt;/span&gt;&lt;span style="color: red"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Top&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Source&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=Photo}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Margin&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;6&amp;quot; /&amp;gt;
&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;

&lt;/span&gt;&lt;/pre&gt;

&lt;br /&gt;

&lt;h2&gt;Demo-02 Customers DataSources Window &lt;/h2&gt;

&lt;p&gt;Open Demo02CustomersDataSourcesWindow.xaml. &lt;/p&gt;

&lt;p&gt;This is an example of using a CollectionViewSource that has sample data as the DataContext for a form. It is assumed that the CollectionViewSource will be populated at run-time from a code-behind method. &lt;/p&gt;

&lt;p&gt;The below sample data file has 3 instances of Customer, each with 2 instances of Address. Notice the root collection. &lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Customers &lt;/span&gt;&lt;span style="color: red"&gt;xmlns&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;clr-namespace:SLSampleDataScenarios.Model&amp;quot;&amp;gt;
&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Customer &lt;/span&gt;&lt;span style="color: red"&gt;FirstName&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Alfons&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;LastName&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Parovszky&amp;quot; 
            &lt;/span&gt;&lt;span style="color: red"&gt;Photo&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;/SLSampleDataScenarios;component/Images/image01.png&amp;quot;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Customer.Addresses&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Address &lt;/span&gt;&lt;span style="color: red"&gt;LineOne&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;125 North St&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;City&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Greatville&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;State&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;CA&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Zip&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;98004&amp;quot; /&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Address &lt;/span&gt;&lt;span style="color: red"&gt;LineOne&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;3000 1st St NE&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;City&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Coolville&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;State&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;CA&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Zip&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;98004&amp;quot; /&amp;gt;
        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Customer.Addresses&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Customer&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Customer &lt;/span&gt;&lt;span style="color: red"&gt;FirstName&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Lori&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;LastName&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Penor&amp;quot; 
                &lt;/span&gt;&lt;span style="color: red"&gt;Photo&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;/SLSampleDataScenarios;component/Images/image02.png&amp;quot;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Customer.Addresses&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Address &lt;/span&gt;&lt;span style="color: red"&gt;LineOne&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;126 East St&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;City&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Greatville&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;State&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;CA&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Zip&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;98004&amp;quot; /&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Address &lt;/span&gt;&lt;span style="color: red"&gt;LineOne&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;3001 2st St NE&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;City&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Coolville&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;State&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;CA&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Zip&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;98004&amp;quot; /&amp;gt;
        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Customer.Addresses&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Customer&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Customer &lt;/span&gt;&lt;span style="color: red"&gt;FirstName&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Justin&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;LastName&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Harrison&amp;quot; 
                &lt;/span&gt;&lt;span style="color: red"&gt;Photo&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;/SLSampleDataScenarios;component/Images/image03.png&amp;quot;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Customer.Addresses&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Address &lt;/span&gt;&lt;span style="color: red"&gt;LineOne&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;127 West St&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;City&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Greatville&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;State&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;CA&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Zip&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;98004&amp;quot; /&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Address &lt;/span&gt;&lt;span style="color: red"&gt;LineOne&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;3002 3st St NE&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;City&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Coolville&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;State&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;CA&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Zip&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;98004&amp;quot; /&amp;gt;
        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Customer.Addresses&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Customer&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;m&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Customers&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;

&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;In the below form, the ComboBox is used to set the CurrentItem for the CollectionViewSource. The Grid that contains the Customer data entry form has its DataContext set to the CollectionViewSource. When the ComboBox selection changes the CollectionViewSource CurrentItem, the data entry form CurrentItem will automatically change. This is one technique for providing record selection. &lt;/p&gt;

&lt;p&gt;&lt;img alt="" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/3365.063010_5F00_2249_5F00_SampleDatai13.png" /&gt; &lt;/p&gt;

&lt;h3&gt;Connecting Sample Data &lt;/h3&gt;

&lt;p&gt;In the below XAML, the CustomersSampleData.xaml file is loaded and parsed by the d:DesignData Markup Extension and assigned to the d:DesignSource for the CollectionViewSource. &lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;UserControl.Resources&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
  &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;CollectionViewSource 
    &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Key&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;customerViewSource&amp;quot; 
    &lt;/span&gt;&lt;span style="color: red"&gt;d&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;DesignSource&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;d&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;DesignData &lt;/span&gt;&lt;span style="color: red"&gt;Source&lt;/span&gt;&lt;span style="color: blue"&gt;=..&lt;/span&gt;/&lt;span style="color: blue"&gt;SampleData&lt;/span&gt;/&lt;span style="color: blue"&gt;CustomersSampleData.xaml}&amp;quot; /&amp;gt;
&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;UserControl.Resources&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
  &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.RowDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;RowDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Auto&amp;quot; /&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;RowDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Auto&amp;quot; /&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;RowDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;*&amp;quot; /&amp;gt;
  &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.RowDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;

  &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock 
    &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Demo-02 Customers Data Sources Window&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;FontWeight&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Bold&amp;quot; 
    &lt;/span&gt;&lt;span style="color: red"&gt;FontSize&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;14&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Margin&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;11&amp;quot; /&amp;gt;

  &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;StackPanel 
    &lt;/span&gt;&lt;span style="color: red"&gt;Margin&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;6&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Orientation&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Horizontal&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; 
    &lt;/span&gt;&lt;span style="color: red"&gt;DataContext&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;StaticResource &lt;/span&gt;&lt;span style="color: red"&gt;customerViewSource&lt;/span&gt;&lt;span style="color: blue"&gt;}&amp;quot;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Center&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Select Customer:&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Margin&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;7,0&amp;quot;  /&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ComboBox &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;200&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Center&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;ItemsSource&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding&lt;/span&gt;&lt;span style="color: blue"&gt;}&amp;quot;&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ComboBox.ItemTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
          &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;StackPanel &lt;/span&gt;&lt;span style="color: red"&gt;Orientation&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Horizontal&amp;quot;&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=FirstName}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Margin&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;0,0,7,0&amp;quot; /&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=LastName}&amp;quot; /&amp;gt;
          &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;StackPanel&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
      &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;ComboBox.ItemTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;ComboBox&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
  &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;StackPanel&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;

  &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;2&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Margin&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;6&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;DataContext&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;StaticResource &lt;/span&gt;&lt;span style="color: red"&gt;customerViewSource&lt;/span&gt;&lt;span style="color: blue"&gt;}&amp;quot;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.RowDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;RowDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Auto&amp;quot; /&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;RowDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Auto&amp;quot; /&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;RowDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Auto&amp;quot; /&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;RowDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Auto&amp;quot; /&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;RowDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;*&amp;quot; /&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.RowDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.ColumnDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Auto&amp;quot; /&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;*&amp;quot; /&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;*&amp;quot; /&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.ColumnDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;

    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;First Name:&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Center&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;75&amp;quot; /&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBox &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=FirstName}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Center&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot;/&amp;gt;

    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Last Name:&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Center&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;75&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; /&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBox &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=LastName}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Center&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; /&amp;gt;

    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Ranking:&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Center&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;75&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;2&amp;quot; /&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=Ranking}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Center&amp;quot;  &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;2&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; /&amp;gt;

    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Margin&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;7&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Addresses&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;FontWeight&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Bold&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;3&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.ColumnSpan&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;2&amp;quot; /&amp;gt;

    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ListBox &lt;/span&gt;&lt;span style="color: red"&gt;ItemsSource&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=Addresses}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;4&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.ColumnSpan&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;2&amp;quot;&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ListBox.ItemTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
          &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.ColumnDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
              &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;100&amp;quot; /&amp;gt;
              &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;75&amp;quot; /&amp;gt;
              &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;30&amp;quot; /&amp;gt;
              &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Auto&amp;quot; /&amp;gt;
            &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.ColumnDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=LineOne}&amp;quot; /&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=City}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; /&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=State}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;2&amp;quot; /&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=Zip}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;3&amp;quot; /&amp;gt;
          &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
      &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;ListBox.ItemTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;ListBox&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;

    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image &lt;/span&gt;&lt;span style="color: red"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Top&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Source&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=Photo}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.RowSpan&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;5&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;2&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Margin&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;6&amp;quot; /&amp;gt;
  &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    
&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&lt;/span&gt;&lt;/pre&gt;

&lt;h1&gt;WCF RIA Services Sample Data Scenario&lt;a id="wcf" title="wcf" name="wcf"&gt;&amp;#160;&lt;/a&gt;&lt;/h1&gt;

&lt;p&gt;The below scenario will concentrate on surfacing design-time sample data in the Designer. &lt;/p&gt;

&lt;p&gt;Open solution: ContosoSales.Mix10. &lt;/p&gt;

&lt;p&gt;Rebuild solution. &lt;/p&gt;

&lt;p&gt;Open \Views\Home.xaml. &lt;/p&gt;

&lt;p&gt;This is an example form from the PDC 2010 RIA Services Demo. This demo has been upgraded to display design-time sample data. &lt;/p&gt;

&lt;p&gt;The sample data file contains 2 Store records that each contains 2 Contacts. &lt;/p&gt;

&lt;div&gt;
  &lt;table style="border-collapse: collapse" border="0"&gt;&lt;colgroup&gt;&lt;col /&gt;&lt;/colgroup&gt;&lt;tbody valign="top"&gt;
      &lt;tr style="background: #c0504d"&gt;
        &lt;td style="border-bottom: #c0504d 1pt solid; border-left: #c0504d 1pt solid; padding-left: 7px; padding-right: 7px; border-top: #c0504d 1pt solid; border-right: #c0504d 1pt solid"&gt;
          &lt;p&gt;&lt;span style="color: white"&gt;&lt;strong&gt;Important&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
        &lt;/td&gt;
      &lt;/tr&gt;

      &lt;tr&gt;
        &lt;td style="border-bottom: #c0504d 1pt solid; border-left: #c0504d 1pt solid; padding-left: 7px; padding-right: 7px; border-top-style: none; border-right: #c0504d 1pt solid"&gt;
          &lt;p&gt;In WCF RIA Services, types deriving from Entity are not creatable. As a result, all sample data files must have their Build Action set to: DesignData and not DesignDataWithDesignTimeCreatableTypes.&lt;/p&gt;
        &lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;

&lt;br /&gt;

&lt;br /&gt;

&lt;div&gt;
  &lt;table style="border-collapse: collapse" border="0"&gt;&lt;colgroup&gt;&lt;col /&gt;&lt;/colgroup&gt;&lt;tbody valign="top"&gt;
      &lt;tr style="background: #4f81bd"&gt;
        &lt;td style="border-bottom: #4f81bd 1pt solid; border-left: #4f81bd 1pt solid; padding-left: 7px; padding-right: 7px; border-top: #4f81bd 1pt solid; border-right: #4f81bd 1pt solid"&gt;
          &lt;p&gt;&lt;span style="color: white"&gt;&lt;strong&gt;Note&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
        &lt;/td&gt;
      &lt;/tr&gt;

      &lt;tr&gt;
        &lt;td style="border-bottom: #4f81bd 1pt solid; border-left: #4f81bd 1pt solid; padding-left: 7px; padding-right: 7px; border-top-style: none; border-right: #4f81bd 1pt solid"&gt;
          &lt;p&gt;Blend does not support the DomainDataSource d:DesignData property. As a result, sample data applied to the DomainDataSource will not render in Blend on the art board (design surface).&lt;/p&gt;
        &lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;

&lt;br /&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ria&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;DesignRIAEntitySampleDataCollection 
    &lt;/span&gt;&lt;span style="color: red"&gt;xmlns&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;web&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;clr-namespace:ContosoSales.Web&amp;quot;
    &lt;/span&gt;&lt;span style="color: red"&gt;xmlns&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;ria&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;clr-namespace:ContosoSales.SampleData&amp;quot;&amp;gt;

  &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;web&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Store &lt;/span&gt;&lt;span style="color: red"&gt;City&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Bellevue&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;StateProvince&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;CA&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;StoreID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;StoreName&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;A. Datum Corporation&amp;quot;
            &lt;/span&gt;&lt;span style="color: red"&gt;StoreImage&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;/ContosoSales;component/SampleDataImages/StoreFront.png&amp;quot; &amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;web&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Store.StoreContacts&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;web&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;StoreContact &lt;/span&gt;&lt;span style="color: red"&gt;ContactID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;55&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Position&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Artist&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;StoreID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;web&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;StoreContact.Contact&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
          &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;web&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Contact &lt;/span&gt;&lt;span style="color: red"&gt;ContactPhoto&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;/ContosoSales;component/SampleDataImages/jeffhand.jpg&amp;quot; 
                       &lt;/span&gt;&lt;span style="color: red"&gt;ContactID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;55&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;FirstName&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Alfons&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;LastName&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Parovszky&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;SalesTarget&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;900&amp;quot; 
                       &lt;/span&gt;&lt;span style="color: red"&gt;WorkEmail&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;alfons@adatum.com&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;WorkPhone&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;411&amp;quot; /&amp;gt;
        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;web&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;StoreContact.Contact&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
      &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;web&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;StoreContact&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;web&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;StoreContact &lt;/span&gt;&lt;span style="color: red"&gt;ContactID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;655&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Position&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Artist&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Store&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;A. Datum Corporation&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;StoreID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;web&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;StoreContact.Contact&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
          &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;web&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Contact &lt;/span&gt;&lt;span style="color: red"&gt;ContactPhoto&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;/ContosoSales;component/SampleDataImages/dineshku.jpg&amp;quot; 
                       &lt;/span&gt;&lt;span style="color: red"&gt;ContactID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;655&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;FirstName&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Lori&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;LastName&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Penor&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;SalesTarget&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;900&amp;quot; 
                       &lt;/span&gt;&lt;span style="color: red"&gt;WorkEmail&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;lori@adatum.com&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;WorkPhone&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;411&amp;quot; /&amp;gt;
        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;web&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;StoreContact.Contact&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
      &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;web&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;StoreContact&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;web&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Store.StoreContacts&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
  &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;web&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Store&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
  &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;web&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Store &lt;/span&gt;&lt;span style="color: red"&gt;City&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Bellevue&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;StateProvince&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;CA&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;StoreID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;12&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;StoreName&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Adventure Works&amp;quot;
               &lt;/span&gt;&lt;span style="color: red"&gt;StoreImage&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;/ContosoSales;component/SampleDataImages/StoreFront.png&amp;quot; &amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;web&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Store.StoreContacts&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;web&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;StoreContact &lt;/span&gt;&lt;span style="color: red"&gt;ContactID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;15&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Position&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Sales&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;StoreID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;2&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Store&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Adventure Works&amp;quot;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;web&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;StoreContact.Contact&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
          &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;web&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Contact &lt;/span&gt;&lt;span style="color: red"&gt;ContactPhoto&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;/ContosoSales;component/SampleDataImages/jeffhand.jpg&amp;quot; 
                       &lt;/span&gt;&lt;span style="color: red"&gt;ContactID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;15&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;FirstName&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Justin&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;LastName&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Harrison&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;SalesTarget&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;000&amp;quot; 
                       &lt;/span&gt;&lt;span style="color: red"&gt;WorkEmail&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;justin@adventure-works.com&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;WorkPhone&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;411&amp;quot; /&amp;gt;
        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;web&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;StoreContact.Contact&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
      &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;web&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;StoreContact&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;web&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;StoreContact &lt;/span&gt;&lt;span style="color: red"&gt;ContactID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;655&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Position&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Artist&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Store&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Adventure Works&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;StoreID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;web&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;StoreContact.Contact&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
          &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;web&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Contact &lt;/span&gt;&lt;span style="color: red"&gt;ContactPhoto&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;/ContosoSales;component/SampleDataImages/dineshku.jpg&amp;quot;
                       &lt;/span&gt;&lt;span style="color: red"&gt;ContactID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;655&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;FirstName&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Mark&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;LastName&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Harrington&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;SalesTarget&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;900&amp;quot; 
                       &lt;/span&gt;&lt;span style="color: red"&gt;WorkEmail&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;mark@adventure-works.com&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;WorkPhone&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;411&amp;quot; /&amp;gt;
        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;web&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;StoreContact.Contact&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
      &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;web&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;StoreContact&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;web&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Store.StoreContacts&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
  &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;web&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Store&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;ria&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;DesignRIAEntitySampleDataCollection&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;Another important distinction is that the root collection must derive from List&amp;lt;Entity&amp;gt;. This is a requirement of RIA Services. Developers must create a class similar to the below class to act as a container for RIA Services sample data objects. Note, this collection does not actually care which type of entity is in the collection so long as the object derives from Entity. &lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;namespace &lt;/span&gt;ContosoSales.SampleData {
    &lt;span style="color: blue"&gt;public class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;DesignRIAEntitySampleDataCollection &lt;/span&gt;: 
          &lt;span style="color: #2b91af"&gt;List&lt;/span&gt;&amp;lt;System.ServiceModel.DomainServices.Client.&lt;span style="color: #2b91af"&gt;Entity&lt;/span&gt;&amp;gt; {

        &lt;span style="color: blue"&gt;public &lt;/span&gt;DesignRIAEntitySampleDataCollection() { }
    }
}&lt;/pre&gt;

&lt;p&gt;This Store class comes from the code that Visual Studio generates in the Silverlight client application. This is contained in the hidden Generated_Code folder. &lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;public sealed partial class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Store &lt;/span&gt;: &lt;span style="color: #2b91af"&gt;Entity
&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;&lt;img alt="" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/8662.063010_5F00_2249_5F00_SampleDatai14.png" /&gt; &lt;/p&gt;

&lt;h3&gt;Connecting Sample Data &lt;/h3&gt;

&lt;p&gt;Sample data in a RIA Services application is applied to the d:DesignData property of the DomainDataSource. &lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;riaControls&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;DomainDataSource 
    &lt;/span&gt;&lt;span style="color: red"&gt;SubmittedChanges&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;storeDomainDataSource_SubmittedChanges&amp;quot;  &lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;storeDomainDataSource&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;AutoLoad&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;True&amp;quot;
    &lt;/span&gt;&lt;span style="color: red"&gt;LoadedData&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;storeDomainDataSource_LoadedData&amp;quot; 
    &lt;/span&gt;&lt;span style="color: red"&gt;d&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;DesignData&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;d&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;DesignData &lt;/span&gt;&lt;span style="color: red"&gt;Source&lt;/span&gt;&lt;span style="color: blue"&gt;=..&lt;/span&gt;/&lt;span style="color: blue"&gt;SampleData&lt;/span&gt;/&lt;span style="color: blue"&gt;RIASampleData.xaml}&amp;quot;
    &lt;/span&gt;&lt;span style="color: red"&gt;QueryName&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;GetStoresQuery&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;FilterOperator&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Or&amp;quot;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;riaControls&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;DomainDataSource.DomainContext&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;my&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;ContactContext &lt;/span&gt;&lt;span style="color: blue"&gt;/&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;riaControls&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;DomainDataSource.DomainContext&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &lt;/span&gt;&lt;span style="color: #a31515"&gt;...
&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;riaControls&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;DomainDataSource&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;The Home.xaml file listing is long, nested and complex so I won't display the XAML here. &lt;/p&gt;

&lt;p&gt;The way the Home UserControl works at design-time is very similar to the previous WPF or Silverlight examples. The major difference is that the DomainDataSource is the control that receives the sample data. From here, other CollectionViewSources can &amp;quot;dot&amp;quot; into the data exposed by the Data property to populate their CollectionView and ultimately the bound UI objects. &lt;/p&gt;

&lt;p&gt;Have a look at the below storeStoreContactsViewSource CollectionViewSource. Its Source is set to the Data.StoreContacts. In this case, Data is actually pointing to the selected Store from the left hand ListBox in the UI. The below Grid contains the data entry form on the right hand side of the form. When the ListBox selection changes the DataContext of the data entry form changes to the SelectedItem in the ListBox. &lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;CollectionViewSource 
    &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Key&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;storeStoreContactsViewSource&amp;quot; 
    &lt;/span&gt;&lt;span style="color: red"&gt;Source&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=Data.StoreContacts, &lt;/span&gt;&lt;span style="color: red"&gt;ElementName&lt;/span&gt;&lt;span style="color: blue"&gt;=storeDomainDataSource}&amp;quot; /&amp;gt;
&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;&lt;span style="font-family: consolas; font-size: 8pt"&gt;&lt;span style="color: red"&gt;&lt;span style="color: blue"&gt;&lt;span style="color: red"&gt;&lt;span style="color: blue"&gt;&lt;span style="color: #a31515"&gt;&lt;span style="color: red"&gt;&amp;#160;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ListBox 
    &lt;/span&gt;&lt;span style="color: red"&gt;ItemsSource&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Source&lt;/span&gt;&lt;span style="color: blue"&gt;={&lt;/span&gt;&lt;span style="color: #a31515"&gt;StaticResource &lt;/span&gt;&lt;span style="color: red"&gt;storeStoreContactsViewSource&lt;/span&gt;&lt;span style="color: blue"&gt;}}&amp;quot; 
    &lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;storeContactsListBox&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Style&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;StaticResource &lt;/span&gt;&lt;span style="color: red"&gt;ContactListBox&lt;/span&gt;&lt;span style="color: blue"&gt;}&amp;quot; /&amp;gt;
&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;&lt;span style="font-family: consolas; font-size: 8pt"&gt;&lt;span style="color: red"&gt;&lt;span style="color: blue"&gt;&lt;span style="color: #a31515"&gt;&lt;span style="color: red"&gt;&lt;span style="color: blue"&gt;&lt;span style="color: #a31515"&gt;&lt;span style="color: red"&gt;&lt;span style="color: blue"&gt;&lt;span style="color: red"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid &lt;/span&gt;&lt;span style="color: red"&gt;BindingValidationError&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Home_BindingValidationError&amp;quot; 
    &lt;/span&gt;&lt;span style="color: red"&gt;DataContext&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Source&lt;/span&gt;&lt;span style="color: blue"&gt;={&lt;/span&gt;&lt;span style="color: #a31515"&gt;StaticResource &lt;/span&gt;&lt;span style="color: red"&gt;storeStoreContactsViewSource&lt;/span&gt;&lt;span style="color: blue"&gt;}}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;grid1&amp;quot;&amp;gt;
&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;This UI synchronization was accomplished without a single line of code. &lt;/p&gt;

&lt;h1&gt;Choosing Sample Data Loading Technique&lt;a id="choosing" title="choosing" name="choosing"&gt;&amp;#160;&lt;/a&gt;&lt;/h1&gt;

&lt;p&gt;From the document you can see there are a number of ways to structure your applications and thus load sample data. One of the goals for the Design-Time Sample Data Feature for Visual Studio 2010 was to not limit or box developers in from using a technique that made business sense for the type of application they are writing. For example, many developers like the power of CollectionViewSources while other developers prefer to have their XAML files DataContext set to a ViewModel. This feature combined with the above techniques easily handles these and most other scenarios. &lt;/p&gt;

&lt;p&gt;Using d:DesignData with a corresponding XAML Sample Data file is the recommended technique for surfacing sample data in WPF and Silverlight line of business applications. This technique surfaces design-time instances of your data classes and enables the Designer Binding Builder tooling. None of the sample data files or design-time XAML is compiled into your applications, making this technique simple and clean. &lt;/p&gt;

&lt;p&gt;Choosing to surface sample data using d:DesignData leaves open endless possibilities for your application architecture and in-fact decouples sample data from the rest of your application. &lt;/p&gt;

&lt;p&gt;However, as a developer you are not limited to just d:DesignData as the WPF Demo-03 Customer ViewModel demonstrated. &lt;/p&gt;

&lt;h1&gt;Comments&lt;a id="comments" title="comments" name="comments"&gt;&amp;#160;&lt;/a&gt;&lt;/h1&gt;

&lt;p&gt;Microsoft values your opinion about our products and documentation. In addition to your general feedback it is very helpful to understand: &lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;How the above features enable your workflow &lt;/li&gt;

  &lt;li&gt;What is missing from the above features that would be helpful to you &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Thank you for your feedback and have a great day, &lt;/p&gt;

&lt;p&gt;Karl Shifflett 
  &lt;br /&gt;Expression Team &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10033184" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-components-postattachments/00-10-03-31-84/SampleDataSolutions.zip" length="5736204" type="application/x-zip-compressed" /><category domain="http://blogs.msdn.com/b/wpfsldesigner/archive/tags/WPF/">WPF</category><category domain="http://blogs.msdn.com/b/wpfsldesigner/archive/tags/Silverlight/">Silverlight</category><category domain="http://blogs.msdn.com/b/wpfsldesigner/archive/tags/How+To/">How To</category><category domain="http://blogs.msdn.com/b/wpfsldesigner/archive/tags/Data+Binding/">Data Binding</category><category domain="http://blogs.msdn.com/b/wpfsldesigner/archive/tags/Sample+Data/">Sample Data</category></item><item><title>Known Issue: Control Design-Time Assemblies File Locking When Using WPF and Silverlight Designer</title><link>http://blogs.msdn.com/b/wpfsldesigner/archive/2010/06/18/known-issue-control-design-time-assemblies-file-locking-when-using-wpf-and-silverlight-designer.aspx</link><pubDate>Fri, 18 Jun 2010 20:09:07 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10027288</guid><dc:creator>karl140.6</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/wpfsldesigner/rsscomments.aspx?WeblogPostID=10027288</wfw:commentRss><comments>http://blogs.msdn.com/b/wpfsldesigner/archive/2010/06/18/known-issue-control-design-time-assemblies-file-locking-when-using-wpf-and-silverlight-designer.aspx#comments</comments><description>&lt;h1&gt;File Locking Issues when using WPF and Silverlight Designer &lt;/h1&gt;  &lt;p&gt;When creating and testing a registered assembly (e.g. an assembly registered via TCI), it is possible to run into a file locking issue that causes compilation to fail.&amp;#160; While there are a few different manifestations of this particular issue, the root cause is the same.&amp;#160; Visual Studio 2010 treats any assembly found in the GAC, Private Assemblies folder, or Registry as a framework assembly and thus locks these files.&amp;#160; Once these assemblies are loaded by the designer, any attempt to copy over them will fail with the following error message: &lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;span style="color: red"&gt;Unable to copy file &amp;quot;obj\Debug\&amp;lt;Assembly Name&amp;gt;&amp;quot; to &amp;quot;..\..\&amp;lt;Assembly Name&amp;gt;&amp;quot;. The process cannot access the file '..\..\&amp;lt;Assembly Name&amp;gt;' because it is being used by another process. &lt;/span&gt;&lt;/p&gt; &lt;/blockquote&gt; &lt;br /&gt; &lt;p&gt;It does not matter if this copy is happening as the result of a compilation; build action, or manual copy.&amp;#160; Once these assemblies are loaded by Visual Studio, they will be locked and attempts to overwrite these files will fail.&lt;span style="color: red"&gt; &lt;/span&gt;&lt;/p&gt;  &lt;h1&gt;Recommended Rules to Avoid Locking Issue &lt;/h1&gt;  &lt;p&gt;To avoid this scenario, you should follow these rules for development and deployment testing of your registered assemblies:&amp;#160; &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;If at all possible, assembly deployment testing (e.g. assembly registration) should not be done on the same machine as development of the assembly.&amp;#160; This is the definitive way to avoid this issue.&amp;#160;&amp;#160; Also, if the assembly you're building is using a public key and has already been registered on your development box, you have no choice but to follow this rule.&amp;#160; There is no other reliable way around this issue. Two popular examples of projects that use a public key are the WPF toolkit and the Silverlight toolkit.&amp;#160; If you download and install these toolkits, you will see this locking issue (regardless of what the project output path is set to) if you attempt to also build these toolkits on the same machine. &lt;/li&gt;    &lt;li&gt;     &lt;div&gt;If, however, your assembly does not use a public key, and you must do development and deployment testing on the same box, you will need to follow these rules instead: &lt;/div&gt;      &lt;ul&gt;       &lt;li&gt;Make sure your project output does not write directly to a path which has been registered in any way.&amp;#160; For example, your output path should never be to any path that's registered in AssemblyFoldersEx. &lt;/li&gt;        &lt;li&gt;Any Visual Studio instance which has already loaded your assembly must be closed before you can either rebuild the assembly, or copy a new version of the assembly to the &lt;span style="color: black"&gt;registered path.&amp;#160; For example, if you're using a different Visual Studio instance for testing, you will need to close this test instance of VS before you can rebuild or replace the assemblies that have been loaded by this instance.&lt;/span&gt; &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt; &lt;/ul&gt;  &lt;h1&gt;Recommended Pattern for Testing Controls During Development &lt;/h1&gt;  &lt;p&gt;First, it's important to point out that TCI registration is not &lt;span style="color: black"&gt;required to develop/test/debug design-time features.&lt;/span&gt;&amp;#160;&amp;#160; It is recommended that you separate out the functional testing of control libraries from the testing of deployment scenarios.&amp;#160; One easy way to accomplish this is to create a test project directly in your working solution.&amp;#160; This will allow you to take full advantage of the Toolbox Auto-pop and will make it easy to create controls from the toolbox, all without the need for TCI registration.&amp;#160; You do need to ensure that the controls that you are building have not been placed in the GAC, Private Assemblies Folder, or in the registry (such as under the AssembyFoldersEx node).&amp;#160; &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Please contact us if you need additional help with this issue.&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;WPF &amp;amp; Silverlight Designer Team &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10027288" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/wpfsldesigner/archive/tags/Extensibility/">Extensibility</category><category domain="http://blogs.msdn.com/b/wpfsldesigner/archive/tags/WPF/">WPF</category><category domain="http://blogs.msdn.com/b/wpfsldesigner/archive/tags/Silverlight/">Silverlight</category><category domain="http://blogs.msdn.com/b/wpfsldesigner/archive/tags/Known+Issue/">Known Issue</category></item><item><title>Three New WPF and Silverlight Designer Videos Posted</title><link>http://blogs.msdn.com/b/wpfsldesigner/archive/2010/06/16/three-new-wpf-and-silverlight-designer-videos-posted.aspx</link><pubDate>Wed, 16 Jun 2010 17:41:06 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10025922</guid><dc:creator>karl140.6</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/wpfsldesigner/rsscomments.aspx?WeblogPostID=10025922</wfw:commentRss><comments>http://blogs.msdn.com/b/wpfsldesigner/archive/2010/06/16/three-new-wpf-and-silverlight-designer-videos-posted.aspx#comments</comments><description>&lt;p&gt;The WPF and Silverlight Designer Team has posted the following new widescreen videos:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://windowsclient.net/learn/video.aspx?v=324332" target="_blank"&gt;Layout Techniques for Windows Forms Developers&lt;/a&gt;       &lt;br /&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://windowsclient.net/learn/video.aspx?v=324331" target="_blank"&gt;Grid Control Design-Time Row and Column Manipulation Features&lt;/a&gt;       &lt;br /&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://windowsclient.net/learn/video.aspx?v=324328" target="_blank"&gt;Creating and Consuming Resource Dictionaries in WPF and Silverlight&lt;/a&gt;       &lt;br /&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Each video has a link to a corresponding article.&lt;/p&gt;  &lt;p&gt;Videos can be viewed using the Silverlight player or downloaded to your computer in 5 formats.&lt;/p&gt;  &lt;h1&gt;Comments&lt;/h1&gt;  &lt;p&gt;Microsoft values your opinion about our products and documentation. In addition to your general feedback it is very helpful to understand: &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;How the above features enable your workflow &lt;/li&gt;    &lt;li&gt;What is missing from the above features that would be helpful to you &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Thank you for your feedback and have a great day, &lt;/p&gt;  &lt;p&gt;Karl Shifflett    &lt;br /&gt;Expression Team&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10025922" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/wpfsldesigner/archive/tags/How+To/">How To</category><category domain="http://blogs.msdn.com/b/wpfsldesigner/archive/tags/Video/">Video</category></item><item><title>How to Enable Using the Binding Builder in WPF and Silverlight Applications</title><link>http://blogs.msdn.com/b/wpfsldesigner/archive/2010/06/14/how-to-enable-using-the-binding-builder-in-wpf-and-silverlight-applications.aspx</link><pubDate>Mon, 14 Jun 2010 23:25:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10024919</guid><dc:creator>karl140.6</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/wpfsldesigner/rsscomments.aspx?WeblogPostID=10024919</wfw:commentRss><comments>http://blogs.msdn.com/b/wpfsldesigner/archive/2010/06/14/how-to-enable-using-the-binding-builder-in-wpf-and-silverlight-applications.aspx#comments</comments><description>&lt;p&gt;When the Data Sources Window is used to generate the UI, the generated XAML injects design-time information so that the Binding Builder can be used to create bindings for the UI controls. &lt;/p&gt;  &lt;p&gt;What if your application was written in Visual Studio 2005 or 2008; or you used the XAML Editor, the Designer or Expression Blend without the Data Sources Window and you now want to take advantage of the new Binding Builder? &lt;/p&gt;  &lt;p&gt;What if your coding style is to assign the DataContext for your forms in code and not data bind to CollectionViewSources in your XAML? &lt;/p&gt;  &lt;p&gt;This very short walk-though will demonstrate the simple requirements to enable you to use the new Binding Builder in a variety of scenarios like the ones mentioned above. &lt;/p&gt;  &lt;h2&gt;Requirements &lt;/h2&gt;  &lt;p&gt;This walk-through assumes you have the opened the attached solution. The attached zip file contains both a VB.NET and C# version of the solution. &lt;/p&gt;  &lt;div class="toc"&gt;   &lt;h4&gt;Table of Contents&lt;/h4&gt;    &lt;ol class="list"&gt;     &lt;li&gt;&lt;a href="#why"&gt;Why use the Binding Builder? &lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href="#what"&gt;What is the Problem we Trying to Solve? &lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href="#design-time"&gt;Design-Time Properties &lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href="#let's"&gt;Let's Implement the Solution &lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href="#binding"&gt;Binding Builder in XAML View &lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href="#links"&gt;Links &lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href="#comments"&gt;Comments &lt;/a&gt;&lt;/li&gt;   &lt;/ol&gt; &lt;/div&gt;  &lt;h1&gt;Why use the Binding Builder?&lt;a id="why" title="why" name="why"&gt;&amp;#160;&lt;/a&gt;&lt;/h1&gt;  &lt;p&gt;The Binding Builder makes it easier to set up bindings and more importantly makes it easier to create accurate bindings so that you don't need to debug so often. This alone will save you time, limit frustration and increase your productivity. &lt;/p&gt;  &lt;p&gt;If you add to this all the other improvements in the WPF and Silverlight Designer like the image picker, the resource picker, the brush editor, etc. I believe that we have a much-improved experience for WPF and Silverlight developers in Visual Studio 2010. &lt;/p&gt;  &lt;h1&gt;What is the Problem we Trying to Solve?&lt;a id="what" title="what" name="what"&gt;&amp;#160;&lt;/a&gt;&lt;/h1&gt;  &lt;p&gt;Let's first run the application to get a feel for how it works at run-time. After starting the application change the selected Customer using the ComboBox at the top. Resize the application; notice how the DataGrid allows data editing. &lt;/p&gt;  &lt;p&gt;This application was hand coded using the XAML Editor and the DataContext is set in the Loaded event of the Window. As a result, the tooling has no way to determine the DataContext at design-time; additionally, the Binding Builder will have no way to list properties in its Path section. &lt;/p&gt;  &lt;p&gt;A picture is worth a thousand words so… &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Open MainWindow.xaml in the Designer &lt;/li&gt;    &lt;li&gt;Select the ComboBox to the right of the Select Customer TextBlock &lt;/li&gt;    &lt;li&gt;     &lt;div&gt;Using the Properties Window: &lt;/div&gt;      &lt;ul&gt;       &lt;li&gt;Click on the ItemsSource property Property Marker pointed to by the red arrow &lt;/li&gt;        &lt;li&gt;Select Apply Data Binding… from the Context Menu &lt;/li&gt;        &lt;li&gt;Optionally, you can also click the gray text to the right of the Property Marker to open the Binding Builder &lt;/li&gt;     &lt;/ul&gt;      &lt;p&gt;&lt;img style="margin: 10px 0px 0px" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/4405.061410_5F00_2325_5F00_HowtoEnable1.png" /&gt; &lt;/p&gt;   &lt;/li&gt;    &lt;li&gt;     &lt;div&gt;In the below image we have two problem indicators &lt;/div&gt;      &lt;ul&gt;       &lt;li&gt;First, the DataContext is null. This is indicated by the text pointed to by the top red arrow; it does not display class type name that is assigned to the DataContext or what class type name the DataContext is inheriting from. &lt;/li&gt;        &lt;li&gt;Second, since the DataContext is null, the Path Customers pointed to by the bottom red arrow; cannot be resolved by the Binding Builder which is indicated by the dash line under the Path property name. &lt;/li&gt;     &lt;/ul&gt;      &lt;p&gt;&lt;img style="margin: 10px 0px 0px" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/2450.061410_5F00_2325_5F00_HowtoEnable2.png" width="632" height="480" /&gt; &lt;/p&gt;   &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Let's look at one more example. &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Select the TextBox to the right of the Email Label &lt;/li&gt;    &lt;li&gt;Using the Properties Window open the Binding Builder for the Text property &lt;/li&gt;    &lt;li&gt;     &lt;div&gt;First, the DataContext is bound to Object. Object does not have properties we can use to set the binding paths. &lt;/div&gt;      &lt;ul&gt;       &lt;li&gt;In this case, the TextBox is inheriting DataContext from the parent Grid control &lt;/li&gt;        &lt;li&gt;The parent Grid control has its DataContent bound to the SelectedItem of the ComboBox, which is why the Email TextBox has its DataContext set to Object. &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;Second, the Email TextBox Text property path is set to Email but like the previous example, it has a dashed underline indicating the Binding Builder was unable to resolve the Email property path. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;img style="margin: 0px 0px 0px 20px" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/2055.061410_5F00_2325_5F00_HowtoEnable3.png" /&gt; &lt;/p&gt;  &lt;h1&gt;Design-Time Properties&lt;a id="design-time" title="design-time" name="design-time"&gt;&amp;#160;&lt;/a&gt;&lt;/h1&gt;  &lt;p&gt;The problem we need to solve is how to provide &amp;quot;a shape&amp;quot; to the Binding Builder at design-time. When I say &amp;quot;shape&amp;quot; I mean an instantiated Type that the Building Builder can reflect over and then list those properties in the Path selection tab to establish the binding. &lt;/p&gt;  &lt;p&gt;In this walk-through we will use the d:DataContext property and d:DesignInstance MarkupExtension. &lt;/p&gt;  &lt;p&gt;The &amp;quot;d:&amp;quot; in above property and Markup Extension is the alias to the design namespace where the all the design properties are members of. Here are links to MSDN topics that cover all the &amp;quot;d:&amp;quot; properties and Markup Extensions. &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ee839627.aspx"&gt;MSDN topic Design-Time Attributes in the WPF Designer&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ff602277(VS.95).aspx"&gt;MSDN topic Design-Time Attributes in the Silverlight Designer&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;The &amp;quot;d:&amp;quot; properties and Markup Extensions cannot be created in user code or extended in user code; they can only be used in XAML. &lt;/p&gt;  &lt;p&gt;The &amp;quot;d:&amp;quot; properties and Markup Extensions are not compiled into your application; they are only used by the Visual Studio WPF and Silverlight Designer and Expression Blend tooling. &lt;/p&gt;  &lt;h2&gt;d:DataContext Property &lt;/h2&gt;  &lt;p&gt;d:DataContext, specifies a design-time data context for a control and its children. When specifying d:DataContext, you should always provide the same &amp;quot;shape&amp;quot; to the design-time DataContext as the run-time DataContext. &lt;/p&gt;  &lt;p&gt;If both a DataContext and d:DataContext are specified for a control, the tooling will use the d:DataContext. &lt;/p&gt;  &lt;h2&gt;d:DesignInstance Markup Extension &lt;/h2&gt;  &lt;p&gt;If MarkupExtensions are new to you, please read this &lt;a href="http://msdn.microsoft.com/en-us/library/ms747254.aspx"&gt;MSDN topic Markup Extensions and WPF XAML&lt;/a&gt;. &lt;/p&gt;  &lt;p&gt;d:DesignInstance, returns the an instantiated Type (&amp;quot;shape&amp;quot;) that you want to assign as the data source for binding to controls in the designer. The type does not need to be creatable to be used for establishing &amp;quot;shape.&amp;quot; &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;d:DesignInstance MarkupExtension Properties &lt;/strong&gt;&lt;/p&gt;  &lt;div sizcache="1" sizset="0"&gt;   &lt;table style="border-collapse: collapse" border="0" width="1149"&gt;&lt;colgroup&gt;&lt;col style="width: 36px" /&gt;&lt;col /&gt;&lt;col style="width: 151px" /&gt;&lt;col /&gt;&lt;col style="width: 451px" /&gt;&lt;col /&gt;&lt;/colgroup&gt;&lt;tbody valign="top"&gt;       &lt;tr&gt;         &lt;td style="padding-left: 7px; padding-right: 7px"&gt;           &lt;p&gt;&lt;img src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/7144.061410_5F00_2325_5F00_HowtoEnable4.png" /&gt;&lt;/p&gt;         &lt;/td&gt;          &lt;td style="padding-left: 7px; padding-right: 7px"&gt;           &lt;p&gt;Type&lt;/p&gt;         &lt;/td&gt;          &lt;td style="padding-left: 7px; padding-right: 7px" width="946"&gt;           &lt;p&gt;Name of the Type that will be created. Type is the default parameter in the constructor.&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td style="padding-left: 7px; padding-right: 7px"&gt;           &lt;p&gt;&lt;img src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/0218.061410_5F00_2325_5F00_HowtoEnable5.png" /&gt;&lt;/p&gt;         &lt;/td&gt;          &lt;td style="padding-left: 7px; padding-right: 7px"&gt;           &lt;p&gt;IsDesignTimeCreatable&lt;/p&gt;         &lt;/td&gt;          &lt;td style="padding-left: 7px; padding-right: 7px" width="946"&gt;           &lt;p&gt;Defaults to False. Is the specified type creatable? When false, a faux type will be created instead of the &amp;quot;real&amp;quot; type.&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td style="padding-left: 7px; padding-right: 7px"&gt;           &lt;p&gt;&lt;img src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/7635.061410_5F00_2325_5F00_HowtoEnable6.png" /&gt;&lt;/p&gt;         &lt;/td&gt;          &lt;td style="padding-left: 7px; padding-right: 7px"&gt;           &lt;p&gt;CreateList&lt;/p&gt;         &lt;/td&gt;          &lt;td style="padding-left: 7px; padding-right: 7px" width="946"&gt;           &lt;p&gt;Defaults to False. When true, will return generic list of the specified type.&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;     &lt;/tbody&gt;&lt;/table&gt; &lt;/div&gt;  &lt;h2&gt;Visual Studio Markup Extension IntelliSense &lt;/h2&gt;  &lt;p&gt;The XAML Editor in Visual Studio 2010 provides IntelliSense when editing Markup Extensions, making the entry of design-time properties and Markup Extensions easy. &lt;/p&gt;  &lt;h1&gt;Let's Implement the Solution&lt;a id="let&amp;#39;s" title="let&amp;#39;s" name="let&amp;#39;s"&gt;&amp;#160;&lt;/a&gt;&lt;/h1&gt;  &lt;p&gt;In this application's Loaded event, I assign the Data class to the Window's DataContext property. To follow this same pattern, we need to assign the Data class to a design-time DataContext or d:DataContext to either the Window or top level Grid control in the XAML file. By doing this, we are allowing the d:DataContext to be inherited down the tree of elements, just like it does when the application is at run-time. &lt;/p&gt;  &lt;p&gt;The below red arrow indicates DataContext inheritance for the Grid control's child controls. Notice how the ComboBox ItemsSource property is bound to the Customers property on the inherited DataContext, which is the Data class. &lt;/p&gt;  &lt;h2&gt;Top ComboBox &lt;/h2&gt;  &lt;ul&gt;   &lt;li&gt;Change MainWindow.xaml into XAML View &lt;/li&gt;    &lt;li&gt;     &lt;div&gt;Locate the root Grid named &amp;quot;layoutRoot&amp;quot; add the following XAML as pictured below: &lt;/div&gt;   &lt;/li&gt; &lt;/ul&gt;  &lt;br /&gt;  &lt;pre class="code"&gt;&lt;span style="color: red"&gt;d&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;DataContext&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;d&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;DesignInstance &lt;/span&gt;&lt;span style="color: red"&gt;local&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Data&lt;/span&gt;&lt;span style="color: blue"&gt;}&amp;quot;
&lt;/span&gt;&lt;/pre&gt;

&lt;br /&gt;

&lt;p&gt;&lt;img style="margin: 10px 0px 0px 25px" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/6746.061410_5F00_2325_5F00_HowtoEnable7.png" /&gt; &lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Change MainWindow.xaml back to Design View &lt;/li&gt;

  &lt;li&gt;Select the ComboBox &lt;/li&gt;

  &lt;li&gt;
    &lt;div&gt;Using the Properties Window, open the Binding Builder for the ItemsSource property: &lt;/div&gt;

    &lt;ul&gt;
      &lt;li&gt;First, the DataContext now has a &amp;quot;shape,&amp;quot; the Data class &lt;/li&gt;

      &lt;li&gt;Second, the Customers Path property name is no longer has a dashed underline because, the Building Builder can resolve the property name on the DataContext &lt;/li&gt;

      &lt;li&gt;Third, since Data.Customers is a collection, the individual properties of the Customer class are now listed in the Path section as part of the &lt;em&gt;Current Item&lt;/em&gt;. These properties would be used if we were editing a DataTemplate for the ComboBox. &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/7651.061410_5F00_2325_5F00_HowtoEnable8.png" /&gt; &lt;/p&gt;

&lt;h2&gt;Middle Data Form &lt;/h2&gt;

&lt;p&gt;The below red arrow indicates d:DataContext inheritance for the child controls of the Grid; this enables property resolution for the Binding Builder tool. &lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Change MainWindow.xaml into XAML View &lt;/li&gt;

  &lt;li&gt;Locate the middle Grid that has its DataContext bound as pictured below and then add the following XAML as pictured below: &lt;/li&gt;
&lt;/ul&gt;

&lt;br /&gt;

&lt;pre class="code"&gt;&lt;span style="color: red"&gt;d&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;DataContext&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;d&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;DesignInstance &lt;/span&gt;&lt;span style="color: red"&gt;local&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Customer&lt;/span&gt;&lt;span style="color: blue"&gt;}&amp;quot;
&lt;/span&gt;&lt;/pre&gt;

&lt;br /&gt;

&lt;p style="margin-left: 18pt"&gt;&lt;img style="margin: 10px 0px 0px 25px" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/3022.061410_5F00_2325_5F00_HowtoEnable9.png" /&gt; &lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Change MainWindow.xaml back to Design View &lt;/li&gt;

  &lt;li&gt;Select the Email TextBox &lt;/li&gt;

  &lt;li&gt;
    &lt;div&gt;Using the Properties Window, open the Binding Builder for the Text property: &lt;/div&gt;

    &lt;ul&gt;
      &lt;li&gt;First, the Customer ID TextBlock now displays a 0. This is because the design-time DataContext is now a real instance of the Customer class. The CustomerID property is an Int32 that has a value of 0 &lt;/li&gt;

      &lt;li&gt;Secord, the DataContext now has a &amp;quot;shape,&amp;quot; the Customer class &lt;/li&gt;

      &lt;li&gt;Third, the Email Path property name is no longer has a dashed underline because, the Building Builder can resolve the property name on the DataContext &lt;/li&gt;

      &lt;li&gt;Fourth, all of the properties exposed by Customer type are available for selection in the Path section of the Binding Builder &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img style="margin: 0px 0px 0px 40px" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/3857.061410_5F00_2325_5F00_HowtoEnable10.png" /&gt; &lt;/p&gt;

&lt;h2&gt;DataGrid &lt;/h2&gt;

&lt;p&gt;At run-time, the Grid's DataContext is a collection of Addresses that comes from the Addresses collection property on the selected Customer class. &lt;/p&gt;

&lt;p&gt;Now we need to provide the same &amp;quot;shape&amp;quot; to the design-time DataContext of the Grid. &lt;/p&gt;

&lt;p&gt;The below top red arrow indicates d:DataContext inheritance for the child controls of the Grid; the ItemsSource for the DataGrid is a collection of Addresses at both design-time and run-time. &lt;/p&gt;

&lt;p&gt;The individual rows in the DataGrid will each be bound to an instance of the Customer class. The bottom red arrow indicates the relationship between the ItemsSource property and the individual properties that are bound to each DataGridRow. &lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Change MainWindow.xaml into XAML View &lt;/li&gt;

  &lt;li&gt;In the next step, we will use the d:DesignInstance Markup Extension to create a list of Address instances for the design-time DataContext &lt;/li&gt;

  &lt;li&gt;Locate the Grid control at the bottom of the file. Add the following XAML as pictured below: &lt;/li&gt;
&lt;/ul&gt;

&lt;br /&gt;

&lt;pre class="code"&gt;&lt;span style="color: red"&gt;d&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;DataContext&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;d&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;DesignInstance &lt;/span&gt;&lt;span style="color: red"&gt;local&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Address&lt;/span&gt;&lt;span style="color: blue"&gt;, &lt;/span&gt;&lt;span style="color: red"&gt;CreateList&lt;/span&gt;&lt;span style="color: blue"&gt;=True}&amp;quot; 
&lt;/span&gt;&lt;/pre&gt;

&lt;p style="margin-left: 18pt"&gt;&lt;img style="margin: 10px 0px 0px" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/1307.061410_5F00_2325_5F00_HowtoEnable11.png" /&gt; &lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Change MainWindow.xaml back to Design View &lt;/li&gt;

  &lt;li&gt;Select the DataGrid by clicking it like the below image on the left &lt;/li&gt;

  &lt;li&gt;Using the Properties Window, open the Columns property Collection Editor by clicking the ellipsis button as in the below image &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img style="margin: 0px 0px 0px 30px" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/6683.061410_5F00_2325_5F00_HowtoEnable12.png" /&gt; &lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;First, select the first DataGridTextColumn &lt;/li&gt;

  &lt;li&gt;
    &lt;div&gt;Second, click the Binding property Property Marker, select Apply Data Binding… from the Context Menu: &lt;/div&gt;

    &lt;ul&gt;
      &lt;li&gt;Third, the DataContext &amp;quot;shape&amp;quot; is the Address class &lt;/li&gt;

      &lt;li&gt;Fourth, Street is not underlined with dashes &lt;/li&gt;

      &lt;li&gt;Fifth, all of the properties exposed by Address type are available for selection in the Path section of the Binding Builder &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img style="margin: 0px 0px 0px 20px" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/5428.061410_5F00_2325_5F00_HowtoEnable13.png" /&gt; &lt;/p&gt;

&lt;h1&gt;Binding Builder in XAML View&lt;a id="binding" title="binding" name="binding"&gt;&amp;#160;&lt;/a&gt;&lt;/h1&gt;

&lt;p&gt;Developers working in the XAML Editor will be surprised to know that the Properties Window and its features like selection sync with the XAML Editor, Binding Builder, Resource Picker and Image Picker continue to work even if the Designer is not visible. &lt;/p&gt;

&lt;p&gt;In order to utilize the Properties Window in the XAML Editor, the Designer must load, not necessarily be visible. &lt;/p&gt;

&lt;p&gt;If you open a XAML View and the Properties Window does not load, momentarily switch to Design View then back to XAML View by clicking these two tabs pictured below. &lt;/p&gt;

&lt;p&gt;Notice the Grid is selected in XAML View and is displayed in the Tag Navigator. &lt;/p&gt;

&lt;p&gt;&lt;img src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/5516.061410_5F00_2325_5F00_HowtoEnable14.png" /&gt; &lt;/p&gt;

&lt;h1&gt;Links&lt;a id="links" title="links" name="links"&gt;&amp;#160;&lt;/a&gt;&lt;/h1&gt;

&lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ms752347.aspx"&gt;MSDN topic Data Binding Overview&lt;/a&gt; (must read for all WPF and Silverlight developers) &lt;/p&gt;

&lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/dd490796.aspx"&gt;MSDN topic Walkthrough: Using a DesignInstance to Bind to Data in the WPF Designer&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ee839627.aspx"&gt;MSDN topic Design-Time Attributes in the WPF Designer&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ff602277(VS.95).aspx"&gt;MSDN topic Design-Time Attributes in the Silverlight Designer&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ff602274(VS.95).aspx"&gt;MSDN topic Walkthrough: Using a DesignInstance to Bind to Data in the Silverlight Designer&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ms747254.aspx"&gt;MSDN topic Markup Extensions and WPF XAML&lt;/a&gt; &lt;/p&gt;

&lt;h1&gt;Comments&lt;a id="comments" title="comments" name="comments"&gt;&amp;#160;&lt;/a&gt;&lt;/h1&gt;

&lt;p&gt;Microsoft values your opinion about our products and documentation. In addition to your general feedback it is very helpful to understand: &lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;How the above features enable your workflow &lt;/li&gt;

  &lt;li&gt;What is missing from the above features that would be helpful to you &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Thank you for your feedback and have a great day, &lt;/p&gt;

&lt;p&gt;Karl Shifflett 
  &lt;br /&gt;Expression Team&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10024919" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-components-postattachments/00-10-02-49-19/EnablingTheBindingBuilder.zip" length="172529" type="application/x-zip-compressed" /><category domain="http://blogs.msdn.com/b/wpfsldesigner/archive/tags/WPF/">WPF</category><category domain="http://blogs.msdn.com/b/wpfsldesigner/archive/tags/Silverlight/">Silverlight</category><category domain="http://blogs.msdn.com/b/wpfsldesigner/archive/tags/How+To/">How To</category><category domain="http://blogs.msdn.com/b/wpfsldesigner/archive/tags/Binding+Builder/">Binding Builder</category><category domain="http://blogs.msdn.com/b/wpfsldesigner/archive/tags/Data+Binding/">Data Binding</category></item><item><title>Using WPF and Silverlight UserControls</title><link>http://blogs.msdn.com/b/wpfsldesigner/archive/2010/06/14/using-wpf-and-silverlight-usercontrols.aspx</link><pubDate>Mon, 14 Jun 2010 18:01:13 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10024661</guid><dc:creator>karl140.6</dc:creator><slash:comments>13</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/wpfsldesigner/rsscomments.aspx?WeblogPostID=10024661</wfw:commentRss><comments>http://blogs.msdn.com/b/wpfsldesigner/archive/2010/06/14/using-wpf-and-silverlight-usercontrols.aspx#comments</comments><description>&lt;p&gt;UserControls promote code reuse, separation of concerns and simplify development by partitioning applications into smaller blocks of code. &lt;/p&gt;  &lt;p&gt;In this article you'll learn why you would use a UserControl, how to create one from the Toolbox, understand when design-time code executes and how to prevent blocks of code from running at design-time. &lt;/p&gt;  &lt;div class="toc"&gt;   &lt;h4&gt;Table of Contents&lt;/h4&gt;    &lt;ol class="list"&gt;     &lt;li&gt;&lt;a href="#introduction"&gt;Introduction &lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href="#automatically"&gt;Automatically Populate Toolbox Items &lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href="#root"&gt;Root Object and Instances of Controls at Design-time &lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href="#running"&gt;Running Code in a Constructor &lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href="#comments"&gt;Comments&lt;/a&gt; &lt;/li&gt;   &lt;/ol&gt; &lt;/div&gt;  &lt;h1&gt;Introduction&lt;a id="introduction" title="introduction" name="introduction"&gt;&amp;#160;&lt;/a&gt;&lt;/h1&gt;  &lt;p&gt;The below demo application will be used in this article to illustrate important UserControl concepts. When writing WPF or Silverlight applications you have the option to partition your code into manageable blocks. This separating of concerns and responsibilities makes authoring and maintaining of the application easier and provides opportunities for code reuse. Additionally, unit and integration testing is simpler when testing smaller units of code. &lt;/p&gt;  &lt;p&gt;The below application is very simple. It could easily be written with all the code in a single XAML file with a corresponding code-behind file. As time passes, requirements change, more fields are added, more tabs get added and before long you have a huge XAML file that gets difficult to understand and edit. &lt;/p&gt;  &lt;p&gt;However, if we treat the below Window object as a &amp;quot;shell&amp;quot; for an application; we can then easily extend the application by adding small self-contained units of code such as UserControls. &lt;/p&gt;  &lt;p&gt;&lt;img alt="" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/6428.061410_5F00_1801_5F00_UsingWPFand1.png" /&gt; &lt;/p&gt;  &lt;p&gt;Notice how short and simple the below XAML is. This is the XAML for the above form. &lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TabControl&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TabItem &lt;/span&gt;&lt;span style="color: red"&gt;Header&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Customers&amp;quot;&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;my&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;CustomersUserControl &lt;/span&gt;&lt;span style="color: blue"&gt;/&amp;gt;
            &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;TabItem&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TabItem &lt;/span&gt;&lt;span style="color: red"&gt;Header&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Sales&amp;quot; &amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid &lt;/span&gt;&lt;span style="color: blue"&gt;/&amp;gt;
        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;TabItem&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;TabControl&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;In the below image, you can see the outer Window, the CustomersUserControl that is hosted in a TabItem and the CustomerEditUserControl that is nested within the CustomersUserControl. &lt;/p&gt;

&lt;p&gt;In terms of separation of concerns and responsibilities, the Window is responsible for application navigation. This is accomplished by hosting UserControls within TabItems. The Window does not need to know anything about customers or sales, how to search and edit them, how to connect to a database or validate data entry. &lt;/p&gt;

&lt;p&gt;The CustomersUserControl is responsible for providing search capabilities and for setting the DataContext on the CustomerEditUserControl when a Customer is selected. &lt;/p&gt;

&lt;p&gt;The CustomerEditUserControl is responsible for providing editing capabilities. This UsesrControl can also be reused in other maintenance forms or possibly in an application child window (dialog box) if the requirements call for this functionality. &lt;/p&gt;

&lt;p&gt;&lt;img alt="" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/5873.061410_5F00_1801_5F00_UsingWPFand3.png" /&gt; &lt;/p&gt;

&lt;p&gt;The below XAML is from the CustomersUserControl. Again, note the short and simple XAML. &lt;/p&gt;

&lt;p&gt;&lt;img alt="" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/8103.061410_5F00_1801_5F00_UsingWPFand4.png" width="500" height="297" /&gt; &lt;/p&gt;

&lt;p&gt;The below short and simple XAML is from the CustomerEditUserControl. &lt;/p&gt;

&lt;p&gt;&lt;img alt="" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/5367.061410_5F00_1801_5F00_UsingWPFand5.png" width="500" height="351" /&gt; &lt;/p&gt;

&lt;p&gt;After looking over the XAML for the Window and two UserControls, you can see that we have simplified the application by breaking it into small manageable components. The separated application is easier to maintain over time and test. Another benefit of this separation of the XAML is that the accompanying code-behind will also be simpler, shorter and with fewer methods per class. &lt;/p&gt;

&lt;h1&gt;Automatically Populate Toolbox Items&lt;a id="automatically" title="automatically" name="automatically"&gt;&amp;#160;&lt;/a&gt;&lt;/h1&gt;

&lt;p&gt;By default, in Visual Studio 2010, each time you build a WPF and Silverlight project, any types that derive from FrameworkElement or higher will be automatically added to the Toolbox. The types that are added are grouped into Toolbox tab by assembly. &lt;/p&gt;

&lt;p&gt;The purpose of this feature is to make it easy for developers to consume the UserControls and CustomControls they create on a form. &lt;/p&gt;

&lt;p&gt;In the below image you can see two UserControls in the Toolbox in the CreateConsumeUserControl Toolbox Tab. These controls can be dragged onto the design surface just like the default WPF or Silverlight controls. &lt;/p&gt;

&lt;p&gt;&lt;img alt="" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/7848.061410_5F00_1801_5F00_UsingWPFand6.png" width="640" height="351" /&gt; &lt;/p&gt;

&lt;h2&gt;Enable or Disable Automatically Populate Feature &lt;/h2&gt;

&lt;p&gt;At your option you can enable or disable this feature by using the Visual Studio Options dialog. &lt;/p&gt;

&lt;p&gt;To open this dialog: &lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Click the Visual Studio Tools menu item &lt;/li&gt;

  &lt;li&gt;Select Options… &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Using the TreeView select: &lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Text Editor &lt;/li&gt;

  &lt;li&gt;XAML &lt;/li&gt;

  &lt;li&gt;Miscellaneous &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To enabled or disable the feature, check or uncheck the Automatically populate toolbox items CheckBox. &lt;/p&gt;

&lt;p&gt;&lt;img alt="" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/2555.061410_5F00_1801_5F00_UsingWPFand7.png" width="640" height="372" /&gt; &lt;/p&gt;

&lt;h2&gt;DesignTimeVisible Attribute &lt;/h2&gt;

&lt;p&gt;At your option, you can keep individual items from appearing by decorating the class with the System.ComponentModel.DesignTimeVisible attribute. &lt;/p&gt;

&lt;p&gt;The below code demonstrates how to keep the CustomerEditUserControl from appearing in the automatically populated Toolbox items listing. &lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;span style="font-family: consolas; font-size: 14pt"&gt;&lt;/span&gt;&lt;/p&gt;&amp;#160;&amp;#160;&amp;#160; &lt;strong&gt;C#&lt;/strong&gt; 

&lt;p&gt;&lt;/p&gt;

&lt;pre class="code"&gt;[&lt;span style="color: #2b91af"&gt;DesignTimeVisible&lt;/span&gt;(&lt;span style="color: blue"&gt;false&lt;/span&gt;)]
&lt;span style="color: blue"&gt;public partial class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;CustomerEditUserControl &lt;/span&gt;: &lt;span style="color: #2b91af"&gt;UserControl &lt;/span&gt;{&lt;/pre&gt;

&lt;p&gt;&lt;strong&gt;VB.NET&lt;/strong&gt;&lt;/p&gt;

&lt;pre class="code"&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;DesignTimeVisible&lt;/span&gt;(&lt;span style="color: blue"&gt;false&lt;/span&gt;)&amp;gt;
&lt;span style="color: blue"&gt;Public Class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;CustomerEditUserControl

&lt;/span&gt;&lt;/pre&gt;

&lt;h6&gt;&lt;/h6&gt;

&lt;h2&gt;Silverlight Page Control &lt;/h2&gt;

&lt;p&gt;While the Silverlight Page derives from UserControl and you would expect these objects to appear in the Toolbox items listing, these controls are not listed in the Toolbox items listing. &lt;/p&gt;

&lt;p&gt;The reason these are not listed is because these are root controls that are not typically consumed in other controls, instead they are navigated to and loaded into a Frame control. Since that are not typically consumed by other controls, there is no reason to load them into the Toolbox. &lt;/p&gt;

&lt;h1&gt;Root Object and Instances of Controls at Design-time&lt;a id="root" title="root" name="root"&gt;&amp;#160;&lt;/a&gt;&lt;/h1&gt;

&lt;p&gt;It's very important to understand when and what user-code the WPF and Silverlight Designer runs at design-time, so that you can avoid unnecessary design-time load failures. &lt;/p&gt;

&lt;h2&gt;Root Object &lt;/h2&gt;

&lt;p&gt;The &amp;quot;root object&amp;quot; is the top level (or root) Window or Page or UserControl that you are actually designing. None of the code in the code-behind file for the root object is executed at design time (for example code in the constructor or Loaded event code). The MainWindow is the root object in the below image.&amp;#160; &lt;/p&gt;

&lt;h2&gt;What Code Executes, What Code Doesn't Execute &lt;/h2&gt;

&lt;p&gt;What code executes at design-time? Everything that gets created in the XAML: &lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Instances of Controls and UserControls &lt;/li&gt;

  &lt;li&gt;ValueConverters &lt;/li&gt;

  &lt;li&gt;DataTemplateSelectors &lt;/li&gt;

  &lt;li&gt;Classes referenced as resources &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What code does not execute at design-time? The top level object you are designing: &lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Window, UserControl, Page etc. when you are designing it &lt;/li&gt;

  &lt;li&gt;Your Application class &lt;/li&gt;
&lt;/ul&gt;

&lt;br /&gt;

&lt;div&gt;
  &lt;table style="border-collapse: collapse" border="0"&gt;&lt;colgroup&gt;&lt;col /&gt;&lt;/colgroup&gt;&lt;tbody valign="top"&gt;
      &lt;tr style="background: #c0504d"&gt;
        &lt;td style="border-bottom: #c0504d 1pt solid; border-left: #c0504d 1pt solid; padding-left: 7px; padding-right: 7px; border-top: #c0504d 1pt solid; border-right: #c0504d 1pt solid"&gt;
          &lt;p&gt;&lt;span style="color: white"&gt;&lt;strong&gt;Important&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
        &lt;/td&gt;
      &lt;/tr&gt;

      &lt;tr&gt;
        &lt;td style="border-bottom: #c0504d 1pt solid; border-left: #c0504d 1pt solid; padding-left: 7px; padding-right: 7px; border-top-style: none; border-right: #c0504d 1pt solid"&gt;
          &lt;p&gt;Never reference the Application or App class in code that gets executed at design-time because this will always be null (Nothing in VB.NET).&lt;/p&gt;
        &lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;

&lt;br /&gt;

&lt;h2&gt;Instances of Controls &lt;/h2&gt;

&lt;p&gt;The Designer will execute all constructors and Loaded event code for each instances of any child controls. &lt;/p&gt;

&lt;p&gt;In the below image both the CustomersUserControl and CustomerEditUserControl constructors and Loaded event code will be executed at design-time. &lt;/p&gt;

&lt;p&gt;&lt;img alt="" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/4212.061410_5F00_1801_5F00_UsingWPFand8.png" /&gt; &lt;/p&gt;

&lt;h4&gt;XAML View of the Above Form &lt;/h4&gt;

&lt;p&gt;&lt;img alt="" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/0181.061410_5F00_1801_5F00_UsingWPFand9.png" /&gt; &lt;/p&gt;

&lt;p&gt;The reason this is so important to understand is, your code may make assumptions that are always true at run-time and the application works property, however those same assumptions may not be true at design-time and could cause Designer load failures. &lt;/p&gt;

&lt;p&gt;If you have not coded defensively, your user-code can cause unhandled exceptions that will prevent the Designer from loading. A NullReferenceException at design-time is the most common cause of Designer load failure. This is also true of Converters and DataTemplateSelectors that do not make null reference checks before attempting to access a reference type. &lt;/p&gt;

&lt;p&gt;Please read the MSDN topic, &lt;a href="http://msdn.microsoft.com/en-us/library/bb546934.aspx"&gt;Troubleshooting WPF and Silverlight Designer Load Failures&lt;/a&gt;. This topic contains good information about authoring design-time friendly code and troubleshooting common load failures. &lt;/p&gt;

&lt;h1&gt;Running Code in a Constructor&lt;a id="running" title="running" name="running"&gt;&amp;#160;&lt;/a&gt;&lt;/h1&gt;

&lt;p&gt;Some developers choose to initiate an asynchronous method calls in their constructors. Running these method calls at design-time can cause design-time problems and load failures. For example, trying to call a web service when the web service is not running, or trying to access the database when the connection string information is in the Application object that is null at design-time; these will both cause problem and possibly keep the form from loading or unhandled exceptions thrown. &lt;/p&gt;

&lt;p&gt;Both WPF and Silverlight developers have the ability to run a simple check that will verify if the code is currently running at design-time or not. &lt;/p&gt;

&lt;p&gt;In the below Silverlight code, the line below InitializeComponent, System.ComponentModel.DesignerProperites.GetIsInDesignMode performs the check. If false (at run-time), then the code will execute. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;C#&lt;/strong&gt;&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;public partial class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;ProductsView &lt;/span&gt;: &lt;span style="color: #2b91af"&gt;UserControl &lt;/span&gt;{
    &lt;span style="color: blue"&gt;public &lt;/span&gt;ProductsView() {
        InitializeComponent();

        &lt;span style="color: blue"&gt;if &lt;/span&gt;(!&lt;span style="color: #2b91af"&gt;DesignerProperties&lt;/span&gt;.GetIsInDesignMode(&lt;span style="color: blue"&gt;this&lt;/span&gt;)) {
            &lt;span style="color: blue"&gt;this&lt;/span&gt;.tbStatusBar.Text = &lt;span style="color: #a31515"&gt;&amp;quot;Getting products list...&amp;quot;&lt;/span&gt;;
            ProductsServiceReference.&lt;span style="color: #2b91af"&gt;ProductsServiceClient &lt;/span&gt;client =
                &lt;span style="color: blue"&gt;new &lt;/span&gt;ProductsServiceReference.&lt;span style="color: #2b91af"&gt;ProductsServiceClient&lt;/span&gt;();
            client.DoWorkCompleted += &lt;span style="color: blue"&gt;new
                &lt;/span&gt;&lt;span style="color: #2b91af"&gt;EventHandler&lt;/span&gt;&amp;lt;System.ComponentModel.&lt;span style="color: #2b91af"&gt;AsyncCompletedEventArgs&lt;/span&gt;&amp;gt;(client_DoWorkCompleted);
            client.DoWorkAsync();
        }
    }

    &lt;span style="color: blue"&gt;void &lt;/span&gt;client_DoWorkCompleted(&lt;span style="color: blue"&gt;object &lt;/span&gt;sender, System.ComponentModel.&lt;span style="color: #2b91af"&gt;AsyncCompletedEventArgs &lt;/span&gt;e) {
        &lt;span style="color: blue"&gt;if &lt;/span&gt;(e.Error == &lt;span style="color: blue"&gt;null&lt;/span&gt;) {
            &lt;span style="color: blue"&gt;this&lt;/span&gt;.tbStatusBar.Text = &lt;span style="color: #a31515"&gt;&amp;quot;Products loaded&amp;quot;&lt;/span&gt;;
        } &lt;span style="color: blue"&gt;else &lt;/span&gt;{
            &lt;span style="color: blue"&gt;this&lt;/span&gt;.tbStatusBar.Text = e.Error.Message;
        }
    }
}&lt;/pre&gt;

&lt;p&gt;&lt;strong&gt;VB.NET&lt;/strong&gt;&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;Partial Public Class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;ProductsView
    &lt;/span&gt;&lt;span style="color: blue"&gt;Inherits &lt;/span&gt;&lt;span style="color: #2b91af"&gt;UserControl

    &lt;/span&gt;&lt;span style="color: blue"&gt;Public Sub New&lt;/span&gt;()
        InitializeComponent()

        &lt;span style="color: blue"&gt;If Not &lt;/span&gt;&lt;span style="color: #2b91af"&gt;DesignerProperties&lt;/span&gt;.GetIsInDesignMode(&lt;span style="color: blue"&gt;Me&lt;/span&gt;) &lt;span style="color: blue"&gt;Then
            Me&lt;/span&gt;.tbStatusBar.Text = &lt;span style="color: #a31515"&gt;&amp;quot;Getting products list...&amp;quot;
            &lt;/span&gt;&lt;span style="color: blue"&gt;Dim &lt;/span&gt;client &lt;span style="color: blue"&gt;As new &lt;/span&gt;ProductsServiceReference.&lt;span style="color: #2b91af"&gt;ProductsServiceClient&lt;/span&gt;()
            &lt;span style="color: blue"&gt;AddHandler &lt;/span&gt;client.DoWorkCompleted, &lt;span style="color: blue"&gt;AddressOf &lt;/span&gt;client_DoWorkCompleted
            client.DoWorkAsync()
        &lt;span style="color: blue"&gt;End If
    End Sub

    Private Sub &lt;/span&gt;client_DoWorkCompleted(&lt;span style="color: blue"&gt;ByVal &lt;/span&gt;sender &lt;span style="color: blue"&gt;As Object&lt;/span&gt;,
                                       &lt;span style="color: blue"&gt;ByVal &lt;/span&gt;e &lt;span style="color: blue"&gt;As &lt;/span&gt;System.ComponentModel.&lt;span style="color: #2b91af"&gt;AsyncCompletedEventArgs&lt;/span&gt;)
        &lt;span style="color: blue"&gt;If &lt;/span&gt;e.Error &lt;span style="color: blue"&gt;Is Nothing Then
            Me&lt;/span&gt;.tbStatusBar.Text = &lt;span style="color: #a31515"&gt;&amp;quot;Products loaded&amp;quot;
        &lt;/span&gt;&lt;span style="color: blue"&gt;Else
            Me&lt;/span&gt;.tbStatusBar.Text = e.Error.Message
        &lt;span style="color: blue"&gt;End If
    End Sub

End Class
&lt;/span&gt;&lt;/pre&gt;

&lt;h1&gt;Comments&lt;a id="comments" title="comments" name="comments"&gt;&amp;#160;&lt;/a&gt;&lt;/h1&gt;

&lt;p&gt;Microsoft values your opinion about our products and documentation. In addition to your general feedback it is very helpful to understand: &lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;How the above feature enables your workflow &lt;/li&gt;

  &lt;li&gt;What is missing from the above feature that would be helpful to you &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Thank you for your feedback and have a great day, &lt;/p&gt;

&lt;p&gt;Karl Shifflett 
  &lt;br /&gt;Expression Team&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10024661" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/wpfsldesigner/archive/tags/WPF/">WPF</category><category domain="http://blogs.msdn.com/b/wpfsldesigner/archive/tags/Silverlight/">Silverlight</category><category domain="http://blogs.msdn.com/b/wpfsldesigner/archive/tags/How+To/">How To</category></item><item><title>Layout Techniques for Windows Forms Developers</title><link>http://blogs.msdn.com/b/wpfsldesigner/archive/2010/06/04/layout-techniques-for-windows-forms-developers.aspx</link><pubDate>Fri, 04 Jun 2010 08:17:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10019753</guid><dc:creator>karl140.6</dc:creator><slash:comments>5</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/wpfsldesigner/rsscomments.aspx?WeblogPostID=10019753</wfw:commentRss><comments>http://blogs.msdn.com/b/wpfsldesigner/archive/2010/06/04/layout-techniques-for-windows-forms-developers.aspx#comments</comments><description>&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/5367.movie1_5F00_1A2B9D09.gif"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; margin: 0px 10px 0px 0px; display: inline; border-top: 0px; border-right: 0px" title="movie1" border="0" alt="movie1" align="left" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/2211.movie1_5F00_thumb_5F00_5CDAC274.gif" width="19" height="19" /&gt;&lt;/a&gt; This article has a corresponding video that can be viewed &lt;a href="http://windowsclient.net/learn/video.aspx?v=324332" target="_blank"&gt;here&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;In a typical Windows Forms application control placement is set using the Location property, setting the X and Y sub property values. The Windows Forms designer provides a complete set of tools for aligning and sizing controls. &lt;/p&gt;  &lt;p&gt;The WPF and Silverlight platforms are different in both available tooling and layout options. &lt;/p&gt;  &lt;p&gt;This article will demonstrate some form layout techniques to help Windows Forms developer's make the transition to WPF or Silverlight. &lt;/p&gt;  &lt;p&gt;We'll first lay the form out using the same familiar techniques you're used to in Windows Forms; then we'll create the form using a typical WPF &amp;amp; Silverlight workflow. &lt;/p&gt;  &lt;div class="toc"&gt;   &lt;h4&gt;Table of Contents&lt;/h4&gt;    &lt;ol class="list"&gt;     &lt;li&gt;&lt;a href="#application"&gt;Application&lt;/a&gt; &lt;/li&gt;      &lt;li&gt;&lt;a href="#content"&gt;Content Based Layout &lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href="#review"&gt;Review &lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href="#comments"&gt;Comments &lt;/a&gt;&lt;/li&gt;   &lt;/ol&gt; &lt;/div&gt;  &lt;h2&gt;Requirements &lt;/h2&gt;  &lt;p&gt;Please read the &lt;a href="http://blogs.msdn.com/wpfsldesigner/archive/2010/01/14/wpf-silverlight-layout-controls.aspx" target="_blank"&gt;WPF &amp;amp; Silverlight Layout Controls&lt;/a&gt; topic. &lt;/p&gt;  &lt;h1&gt;Application&lt;a id="application" title="application" name="application"&gt;&amp;#160;&lt;/a&gt;&lt;/h1&gt;  &lt;p&gt;This simple Windows Forms dialog took about 90 seconds to layout. The Windows Forms designer provided excellent layout adorners to assist in aligning the controls. The Properties Window was utilized to set control anchoring and enter the Label and Button text. &lt;/p&gt;  &lt;p&gt;&lt;img src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/4401.060410_5F00_0016_5F00_LayoutTechn1.png" /&gt; &lt;/p&gt;  &lt;p&gt;This simple WPF dialog took about 90 seconds to layout. The designer provided excellent layout adorners to assist in aligning and set anchoring on the controls. The Properties Window was utilized to enter the Label and Button text. &lt;/p&gt;  &lt;p&gt;&lt;img src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/2656.060410_5F00_0016_5F00_LayoutTechn2.png" /&gt; &lt;/p&gt;  &lt;h2&gt;Let's Build This Dialog in WPF &lt;/h2&gt;  &lt;ul&gt;   &lt;li&gt;Add a new WPF Window to the project and name it Customer.xaml &lt;/li&gt;    &lt;li&gt;Click the design surface outside the boundary of the Window to select the Window object &lt;/li&gt;    &lt;li&gt;Using the lower left resize adorner, resize the Window to 350 x 300. Notice the resize adorner labels indicate the size as you resize the Window. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;img style="margin: 0px 0px 0px 20px" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/5315.060410_5F00_0016_5F00_LayoutTechn3.png" /&gt; &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Drag and drop a Label control from the ToolBox to the design surface inside the Window &lt;/li&gt;    &lt;li&gt;Notice the blue box adorner that gets displayed along with the inner area changing color to white when you drag the Label from the ToolBox. This is the Drop Target feature of the WPF and Silverlight Designer, providing you feedback where the object you are dragging can be dropped. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;img style="margin: 0px 0px 0px 20px" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/5808.060410_5F00_0016_5F00_LayoutTechn4.png" /&gt; &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;After dropping the Label, move it to the upper left corner. Notice edge snap line adorners providing assistance as you get near the top and left edges. &lt;/li&gt;    &lt;li&gt;The number in the top left corner indicates the distance to each edge. The top right and bottom left adorners indicate how far the control is from those edges. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;img style="margin: 0px 0px 0px 20px" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/0513.060410_5F00_0016_5F00_LayoutTechn5.png" /&gt; &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;With the new Label selected on the design surface, use the Properties Window to set the Label text to, First Name. In WPF and Silverlight this is accomplished by changing the Content property. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;img style="margin: 0px 0px 0px 20px" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/1777.060410_5F00_0016_5F00_LayoutTechn6.png" /&gt; &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Add a TextBox to the form &lt;/li&gt;    &lt;li&gt;To easily position the TextBox to line up with the Label, the text baseline adorner displays helping you line up the controls &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;img style="margin: 0px 0px 0px 20px" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/2656.060410_5F00_0016_5F00_LayoutTechn7.png" /&gt; &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;After moving the TextBox, the selected adorners will now display as pictured below &lt;/li&gt;    &lt;li&gt;The small square adorners at each corner are used to resize the TextBox &lt;/li&gt;    &lt;li&gt;The below TextBox is anchored left and top. This is indicated by the left and top triangles the red arrows point to. Since the left edge of the TextBox is great than a few pixels from the edge, the anchoring adorner line is displayed. &lt;/li&gt;    &lt;li&gt;To now anchor this TextBox to the right also, we just need to click the right circle the right red arrow points to &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;img style="margin: 0px 0px 0px 20px" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/6064.060410_5F00_0016_5F00_LayoutTechn8.png" /&gt; &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;After clicking the right circle, the right edge anchoring adorner is displayed &lt;/li&gt;    &lt;li&gt;     &lt;div&gt;Windows Forms terminology &lt;/div&gt;      &lt;ul&gt;       &lt;li&gt;TextBox is anchored left, top and right &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;     &lt;div&gt;WPF and Silverlight terminology &lt;/div&gt;      &lt;ul&gt;       &lt;li&gt;TextBox has HorizontalAlignment set to Stretch and VerticalAlignment set to Top &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;img style="margin: 0px 0px 0px 20px" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/5808.060410_5F00_0016_5F00_LayoutTechn9.png" /&gt; &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Now resize the TextBox. When resizing, notice the right edge snap line that appears down the length of the right edge. This indicates that the control is 12px from the edge. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;img style="margin: 0px 0px 0px 20px" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/1754.060410_5F00_0016_5F00_LayoutTechn10.png" /&gt; &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Marquee select the Label and TextBox control &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;img style="margin: 0px 0px 0px 20px" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/7853.060410_5F00_0016_5F00_LayoutTechn11.png" /&gt; &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Release the mouse and right click the selected TextBox, select Copy &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;img style="margin: 0px 0px 0px 20px" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/6472.060410_5F00_0016_5F00_LayoutTechn12.png" /&gt; &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Click the inner area of the Window, right click and select Paste &lt;/li&gt;    &lt;li&gt;The newly pasted controls will appear on top of the existing controls &lt;/li&gt;    &lt;li&gt;Notice the newly pasted controls are selected &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;img style="margin: 0px 0px 0px 20px" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/4403.060410_5F00_0016_5F00_LayoutTechn13.png" /&gt; &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Click and drag the TextBox down; the Label will move with the TextBox &lt;/li&gt;    &lt;li&gt;As you are dragging down, notice that the designer snaps at two increments, 6px and 14px. For this application, we are using 14px. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;img style="margin: 0px 0px 0px 20px" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/8228.060410_5F00_0016_5F00_LayoutTechn14.png" /&gt; &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Repeat the select, copy, paste and align action two more times &lt;/li&gt;    &lt;li&gt;Change the Label Content property as indicated below &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;img style="margin: 0px 0px 0px 20px" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/4722.060410_5F00_0016_5F00_LayoutTechn15.png" /&gt; &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Drag and drop a RadioButton below the bottom TextBox &lt;/li&gt;    &lt;li&gt;Move it into the position shown below &lt;/li&gt;    &lt;li&gt;Notice the left control edge snap line and the control distance adorner value of 14 &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;img style="margin: 0px 0px 0px 20px" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/5315.060410_5F00_0016_5F00_LayoutTechn16.png" /&gt; &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Drag and drop a new Label control below the Phone Label. Move it below the Phone Label as pictured below. &lt;/li&gt;    &lt;li&gt;Notice the left edge snap line provides an easy guide for the left edge &lt;/li&gt;    &lt;li&gt;As you drag the new Label control down use the text baseline snap line of the RadioButton to align the control &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;img style="margin: 0px 0px 0px 20px" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/2337.060410_5F00_0016_5F00_LayoutTechn17.png" /&gt; &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Change the new Label to read Gender and set the Content property on the RadioButton to Male &lt;/li&gt;    &lt;li&gt;Drag and drop a new RadioButton control to the design surface and move it into place as pictured below &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;img style="margin: 0px 0px 0px 20px" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/1373.060410_5F00_0016_5F00_LayoutTechn18.png" /&gt; &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Change the text of the new RadioButton to Female &lt;/li&gt;    &lt;li&gt;Add a new Button to the design surface and move it into position as shown below &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;img style="margin: 0px 0px 0px 20px" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/6866.060410_5F00_0016_5F00_LayoutTechn19.png" /&gt; &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;After releasing the mouse the selection adorners will appear as pictured below &lt;/li&gt;    &lt;li&gt;     &lt;div&gt;Now anchor this button right and bottom: &lt;/div&gt;      &lt;ul&gt;       &lt;li&gt;Click the left adorner, this will toggle anchor left to anchor right &lt;/li&gt;        &lt;li&gt;Click the top adorner, this will toggle anchor top to anchor bottom &lt;/li&gt;        &lt;li&gt;In WPF and Silverlight terminology the Button now has HorizontalAlignment set to Right, VerticalAlignment set to Bottom &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;img style="margin: 0px 0px 0px 20px" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/8130.060410_5F00_0016_5F00_LayoutTechn20.png" /&gt; &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Copy and paste the Button, then move into the position below. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;img style="margin: 0px 0px 0px 20px" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/3755.060410_5F00_0016_5F00_LayoutTechn21.png" /&gt; &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Change the Button's text as pictured below by using the Properties Window to change the Content property of each Button. &lt;/li&gt;    &lt;li&gt;You can test the layout by resizing the Window control. Notice that the Buttons stay anchored to the bottom right and the TextBoxes resize with the Window. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;img style="margin: 0px 0px 0px 20px" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/6153.060410_5F00_0016_5F00_LayoutTechn22.png" /&gt; &lt;/p&gt;  &lt;h2&gt;Easily Change to a Resizable Two Column Form &lt;/h2&gt;  &lt;p&gt;Now that we see creating a form in WPF or Silverlight is very similar to the Windows Forms experience, let's look at how WPF or Silverlight easily enables making the above form a two column form. The two column form we will create will resize when the Window is resized. &lt;/p&gt;  &lt;p&gt;Before proceeding, think about the steps you would follow using the Windows Forms platform to accomplish the task. &lt;/p&gt;  &lt;h3&gt;Under the Covers &lt;/h3&gt;  &lt;p&gt;The Windows Forms Designer persists changes to a hidden code-behind file. The WPF and Silverlight Designer persists changes to XAML. To view the created XAML you can click on the XAML View Button. The XAML View and Design View buttons are located at the bottom of the Visual Studio tab you have been working with. &lt;/p&gt;  &lt;p&gt;If your XAML is not currently visible, click the XAML View button. &lt;/p&gt;  &lt;p&gt;&lt;img src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/5700.060410_5F00_0016_5F00_LayoutTechn23.png" /&gt; &lt;/p&gt;  &lt;p&gt;Your XAML should look similar to the below image. &lt;/p&gt;  &lt;p&gt;What I want to point out is the second element in the XAML, the Grid. &lt;/p&gt;  &lt;p&gt;The entire time we have been adding controls to the form, we have actually been adding them as a child of the Grid control. The Grid is one of the available layout panels. &lt;/p&gt;  &lt;p&gt;When the Grid has no rows or columns defined, it's effectively a single cell grid, positioning its child controls using Margin, HorizontalAlignment and VerticalAlignment properties. In similar fashion, Windows Forms uses Location and Anchor properties. &lt;/p&gt;  &lt;p&gt;I've show the Grid control here because in the next step we will being working with it. &lt;/p&gt;  &lt;p&gt;&lt;img src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/6472.060410_5F00_0016_5F00_LayoutTechn24.png" /&gt; &lt;/p&gt;  &lt;p&gt;In WPF or Silverlight the simple steps to create a two column form are: &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Click on the Design View button to bring the designer back into view &lt;/li&gt;    &lt;li&gt;Right click on the Grid (the area inside the Window, not occupied by a child control), select Grid Column, Insert After &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;img style="margin: 0px 0px 0px 20px" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/4403.060410_5F00_0016_5F00_LayoutTechn25.png" /&gt; &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;     &lt;div&gt;The form should now look like the below image &lt;/div&gt;      &lt;ul&gt;       &lt;li&gt;The Grid Column, Insert After function adds a new column after the current column and sets its width to 126px. Notice the 126 in the right column rail adorner. &lt;/li&gt;        &lt;li&gt;The left column size is displayed also; 1*. Star sizing is proportional sizing and is fully explained in this article &lt;a href="http://blogs.msdn.com/wpfsldesigner/archive/2010/01/14/wpf-silverlight-layout-controls.aspx" target="_blank"&gt;WPF &amp;amp; Silverlight Layout Controls&lt;/a&gt;. &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;img style="margin: 0px 0px 0px 20px" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/8228.060410_5F00_0016_5F00_LayoutTechn26.png" /&gt; &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;With the Grid selected, locate the ColumnDefinitions property in the Properties Window, and click the Collection Editor elipsis button as indicated below &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;img style="margin: 0px 0px 0px 20px" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/1108.060410_5F00_0016_5F00_LayoutTechn27.png" /&gt; &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;     &lt;div&gt;When the Collection Editor opens: &lt;/div&gt;      &lt;ul&gt;       &lt;li&gt;Select the second ColumnDefinition in the ListBox on the left &lt;/li&gt;        &lt;li&gt;Click the Width property Property Marker &lt;/li&gt;        &lt;li&gt;         &lt;div&gt;From the Context Menu, select Reset Value &lt;/div&gt;          &lt;ul&gt;           &lt;li&gt;This will change the second column to its default value which is 1* &lt;/li&gt;         &lt;/ul&gt;       &lt;/li&gt;        &lt;li&gt;Click the OK button to commit the changes &lt;/li&gt;        &lt;li&gt;This will effectively split the form into two proportionally spaced columns that are of equal width &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;img style="margin: 0px 0px 0px 20px" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/2262.060410_5F00_0016_5F00_LayoutTechn28.png" width="780" height="359" /&gt; &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;The form now has two equal sized Star sized columns. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;img style="margin: 0px 0px 0px 20px" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/6560.060410_5F00_0016_5F00_LayoutTechn29.png" /&gt; &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Click the design surface outside the Window to select the Window. Notice the Grid's rail adorners are no longer visible and the Window resize adorners are now visible. &lt;/li&gt;    &lt;li&gt;Resize the Window to 600 x 300 as pictured below. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;img style="margin: 0px 0px 0px 20px" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/8032.060410_5F00_0016_5F00_LayoutTechn30.png" /&gt; &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Marquee select the first four Labels and TextBoxes and release the mouse button &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;img style="margin: 0px 0px 0px 20px" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/4810.060410_5F00_0016_5F00_LayoutTechn31.png" /&gt; &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Right click the selected controls and select Copy from the Context Menu &lt;/li&gt;    &lt;li&gt;Right click the selected controls and select Paste from the Content Menu &lt;/li&gt;    &lt;li&gt;The eight controls will remain selected; now drag them into position to the right colomn &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;img style="margin: 0px 0px 0px 20px" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/6560.060410_5F00_0016_5F00_LayoutTechn32.png" /&gt; &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Use the text baseline snap line to vertically align the controls as pictured below &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;img style="margin: 0px 0px 0px 20px" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/6866.060410_5F00_0016_5F00_LayoutTechn33.png" /&gt; &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Change the Content property on the Label controls on the right to the values below &lt;/li&gt;    &lt;li&gt;Marquee select the two Buttons, drag and drop them to the below location &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;img style="margin: 0px 0px 0px 20px" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/1682.060410_5F00_0016_5F00_LayoutTechn34.png" /&gt; &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Select the Window by clicking the design surface outside the Window boundary. Using the lower left corner resize adorner, resize the Window smaller and larger. Notice that the two columns stay the same size and the controls size to the column. &lt;/li&gt; &lt;/ul&gt;  &lt;h1&gt;Content Based Layout&lt;a id="content" title="content" name="content"&gt;&amp;#160;&lt;/a&gt;&lt;/h1&gt;  &lt;p&gt;The purpose of the article is to help Windows Forms developer's make the transition to WPF or Silverlight. In the above walk-through we guided you through creating a WPF or Silverlight form using familiar form design techniques you used in Windows Forms. &lt;/p&gt;  &lt;p&gt;Now that you have an understanding of control placement and some Grid concepts, let's walk-through building a content based layout form. This type of form is still very easy to build, it leverages more features of the Grid control and providing a layout that conforms to content as the size of that content changes at design or run-time; for example a globalized application when a different language is being used. &lt;/p&gt;  &lt;p&gt;Again, in this next section we'll demonstrate how to easily create a form that uses content base layout instead of absolute positioning while at the same time leveraging layout techniques that are familiar to you. &lt;/p&gt;  &lt;p&gt;The strategy of this technique is to quickly layout, name and set the text values for your controls. When dragging a control from the ToolBox we are only concerned with positioning the control near where you want it. From the below image you can see I've paid very little attention to size or positioning. &lt;/p&gt;  &lt;h2&gt;Step One – Quick Layout &lt;/h2&gt;  &lt;ul&gt;   &lt;li&gt;Increase the size of the Window; this will give you more room to drag and drop controls with less precision &lt;/li&gt;    &lt;li&gt;     &lt;div&gt;Drag and drop controls onto the design surface then set their Content property for Labels &lt;/div&gt;      &lt;ul&gt;       &lt;li&gt;Remember, you don't need to worry about exact positioning or sizing, now. Just lay the controls out very quickly &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;We will add the two RadioButtons and two Buttons later on &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;img style="margin: 0px 0px 0px 20px" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/1780.060410_5F00_0016_5F00_LayoutTechn35.png" /&gt; &lt;/p&gt;  &lt;h2&gt;Step Two – Create Rows &lt;/h2&gt;  &lt;ul&gt;   &lt;li&gt;Select the root Grid control by clicking inside its boundary &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;img style="margin: 0px 0px 0px 20px" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/1777.060410_5F00_0016_5F00_LayoutTechn36.png" /&gt; &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Create your first Grid row by clicking the left Grid Rail Adorner as pictured below &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;img style="margin: 0px 0px 0px 20px" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/4745.060410_5F00_0016_5F00_LayoutTechn37.png" /&gt; &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Repeat creating the Grid rows so that your form looks like the below image &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;img style="margin: 0px 0px 0px 20px" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/3833.060410_5F00_0016_5F00_LayoutTechn38.png" /&gt; &lt;/p&gt;  &lt;h2&gt;Step Three – Create Columns &lt;/h2&gt;  &lt;ul&gt;   &lt;li&gt;Create the columns by clicking the top Grid Rail Adorner as pictured below &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;img style="margin: 0px 0px 0px 20px" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/5086.060410_5F00_0016_5F00_LayoutTechn39.png" /&gt; &lt;/p&gt;  &lt;h2&gt;Step Four – Auto Size Controls &lt;/h2&gt;  &lt;ul&gt;   &lt;li&gt;With the root Grid selected, press CTRL+A to select all child controls of the Grid. Optionally, you can also marquee select controls. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;img style="margin: 0px 0px 0px 20px" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/2656.060410_5F00_0016_5F00_LayoutTechn40.png" /&gt; &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Right click on one of the selected controls, from the Context Menu select, Reset Layout, All &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;img style="margin: 0px 0px 0px 20px" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/5315.060410_5F00_0016_5F00_LayoutTechn41.png" /&gt; &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Your form should look similar to the below image &lt;/li&gt;    &lt;li&gt;     &lt;div&gt;What has happened to each control is: &lt;/div&gt;      &lt;ul&gt;       &lt;li&gt;Margin reset to default value, 0 &lt;/li&gt;        &lt;li&gt;VerticalAlignment reset to default, Stretch &lt;/li&gt;        &lt;li&gt;HorizontalAlignment reset to default, Stretch &lt;/li&gt;        &lt;li&gt;Size reset to default, Auto &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;Notice how each control consumes the full space allocated to it by its container cell. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;img style="margin: 0px 0px 0px 20px" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/8623.060410_5F00_0016_5F00_LayoutTechn42.png" /&gt; &lt;/p&gt;  &lt;h2&gt;Step Five – Auto Size Rows &lt;/h2&gt;  &lt;ul&gt;   &lt;li&gt;Hover the mouse over the left Grid Rail Adorner near the numbers, a Grid Row size selector will appear &lt;/li&gt;    &lt;li&gt;Click Auto &lt;/li&gt;    &lt;li&gt;Repeat for each row except the last row &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;img style="margin: 0px 0px 0px 20px" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/5086.060410_5F00_0016_5F00_LayoutTechn43.png" /&gt; &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;     &lt;div&gt;Your form should now look like the below image. You can now see why we didn't spend much time during the initial layout. &lt;/div&gt;      &lt;ul&gt;       &lt;li&gt;The bottom row is Star sized. In this form it will consume all the remaining vertical space. &lt;/li&gt;     &lt;/ul&gt;      &lt;p&gt;&lt;img src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/5327.060410_5F00_0016_5F00_LayoutTechn44.png" /&gt; &lt;/p&gt;   &lt;/li&gt; &lt;/ul&gt;  &lt;h2&gt;Step Six – Auto Size the First Column &lt;/h2&gt;  &lt;ul&gt;   &lt;li&gt;Hover the mouse over the top Grid Rail Adorner near the numbers, a Grid Column size selector will appear &lt;/li&gt;    &lt;li&gt;Click Auto &lt;/li&gt;    &lt;li&gt;     &lt;div&gt;By auto sizing the first column we are allowing the text of the Label controls to grow at run-time or design-time based on a font, font size or language change. &lt;/div&gt;      &lt;ul&gt;       &lt;li&gt;Another option is to provide a fixed width of reasonable value, replace the Label controls with TextBlocks and enable text wrapping. Since the rows are auto sized, if the text does wrap the row size will automatically be increased to accommodate the increase is height. &lt;/li&gt;     &lt;/ul&gt;      &lt;p&gt;&lt;img src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/0525.060410_5F00_0016_5F00_LayoutTechn45.png" /&gt; &lt;/p&gt;   &lt;/li&gt; &lt;/ul&gt;  &lt;h2&gt;Step Seven – Margins &lt;/h2&gt;  &lt;ul&gt;   &lt;li&gt;Select all child Grid controls using CTRL+A &lt;/li&gt;    &lt;li&gt;     &lt;div&gt;Notice the Properties Window &lt;/div&gt;      &lt;ul&gt;       &lt;li&gt;Top red arrow – multiple objects are now selected &lt;/li&gt;        &lt;li&gt;Middle red arrow – enter &amp;quot;mar&amp;quot; in the Search Box &lt;/li&gt;        &lt;li&gt;Bottom red arrow – enter &amp;quot;6&amp;quot; for the Margin &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;On the design surface, all of the controls all have a Margin of 6. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;img style="margin: 0px 0px 0px 20px" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/8623.060410_5F00_0016_5F00_LayoutTechn46.png" /&gt; &lt;/p&gt;  &lt;h2&gt;Step Eight – RadioButtons &lt;/h2&gt;  &lt;ul&gt;   &lt;li&gt;Click the StackPanel icon in the ToolBox, and then draw the StackPanel in the column next to the Gender Label. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;img style="margin: 0px 0px 0px 20px" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/5482.060410_5F00_0016_5F00_LayoutTechn47.png" /&gt; &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Use the Reset Layout feature for the StackPanel &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;img style="margin: 0px 0px 0px 20px" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/3264.060410_5F00_0016_5F00_LayoutTechn48.png" /&gt; &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Using the Properties Window, set the following properties:      &lt;ul&gt;       &lt;li&gt;Orientation to Horizontal &lt;/li&gt;        &lt;li&gt;Margin to 6 &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;img style="margin: 0px 0px 0px 20px" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/4010.060410_5F00_0016_5F00_LayoutTechn49.png" /&gt; &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;With the StackPanel selected double click on the RadioButton icon in the ToolBox to create the first RadioButton &lt;/li&gt;    &lt;li&gt;Repeat the double click action to create the second RadioButton. &lt;/li&gt;    &lt;li&gt;     &lt;div&gt;Using the Properties Window set the following RadioButton properties : &lt;/div&gt;      &lt;ul&gt;       &lt;li&gt;Content property for each RadioButton to the appropriate text (Male, Female) &lt;/li&gt;        &lt;li&gt;Reset Height property as pictured below &lt;/li&gt;     &lt;/ul&gt;      &lt;p style="margin-left: 18pt"&gt;&lt;img src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/0121.060410_5F00_0016_5F00_LayoutTechn50.png" /&gt; &lt;/p&gt;      &lt;ul&gt;       &lt;li&gt;VerticalAlignment to Center &lt;/li&gt;        &lt;li&gt;Female RadioButton, set the Margin property to 12,0,0,0 &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;Your form should now look like the below image &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;img style="margin: 0px 0px 0px 20px" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/4338.060410_5F00_0016_5F00_LayoutTechn51.png" /&gt; &lt;/p&gt;  &lt;h2&gt;Step Nine – Add the Buttons &lt;/h2&gt;  &lt;p&gt;We will now use the Grid SharedSizeScope feature you learned about in the &lt;a href="http://blogs.msdn.com/wpfsldesigner/archive/2010/01/14/wpf-silverlight-layout-controls.aspx" target="_blank"&gt;WPF &amp;amp; Silverlight Layout Controls article&lt;/a&gt;. &lt;/p&gt;  &lt;p&gt;This feature enables us to ensure that the Button controls will be the same size, even if the text of one button is shorter/longer than the other Button. &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Draw a new Grid in the row below the RadioButtons &lt;/li&gt;    &lt;li&gt;Add a column to that Grid near the middle of the Grid &lt;/li&gt;    &lt;li&gt;Add a Button control to each Grid cell as in the below picture &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;img style="margin: 0px 0px 0px 20px" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/7558.060410_5F00_0016_5F00_LayoutTechn52.png" /&gt; &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;With the new Grid selected on the design surface, switch to XAML view. Notice that the same Grid is selected in the XAML Editor for you. &lt;/li&gt;    &lt;li&gt;     &lt;div&gt;Add the attached property, Grid.IsSharedSizedScope and set its value to True. &lt;/div&gt;      &lt;ul&gt;       &lt;li&gt;This attached property is currently not available in the Properties Window so we need to use the XAML Editor. &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;img style="margin: 0px 0px 0px 20px" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/0537.060410_5F00_0016_5F00_LayoutTechn53.png" /&gt; &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Switch back to Design view and select the new Grid again. &lt;/li&gt;    &lt;li&gt;Using the Properties Window, locate the ColumnDefinitions property and click the ellipsis button to open the Collection Editor. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;img style="margin: 0px 0px 0px 20px" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/5822.060410_5F00_0016_5F00_LayoutTechn54.png" /&gt; &lt;/p&gt;  &lt;ul style="margin-left: 54pt"&gt;   &lt;li&gt;For both columns, set the Width to Auto and the SharedSizeGroup to buttons &lt;/li&gt;    &lt;li&gt;Click OK to close the dialog and commit the changes &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;img style="margin: 0px 0px 0px 20px" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/0537.060410_5F00_0016_5F00_LayoutTechn55.png" /&gt; &lt;/p&gt;  &lt;ul style="margin-left: 54pt"&gt;   &lt;li&gt;On the design surface, select both Button controls in the new Grid &lt;/li&gt;    &lt;li&gt;     &lt;div&gt;Using the Properties Window, set the six properties indicated by the red arrows &lt;/div&gt;      &lt;ul&gt;       &lt;li&gt;Setting the Button Padding property provides nice internal spacing between the Button's text and border. &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;Your form will now look like the below image &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;img style="margin: 0px 0px 0px 20px" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/7077.060410_5F00_0016_5F00_LayoutTechn56.png" width="780" height="250" /&gt; &lt;/p&gt;  &lt;div style="margin-left: 30pt"&gt;   &lt;table style="border-collapse: collapse" border="0"&gt;&lt;colgroup&gt;&lt;col style="width: 583px" /&gt;&lt;/colgroup&gt;&lt;tbody valign="top"&gt;       &lt;tr style="background: #4f81bd"&gt;         &lt;td style="border-bottom: #4f81bd 1pt solid; border-left: #4f81bd 1pt solid; padding-left: 7px; padding-right: 7px; border-top: #4f81bd 1pt solid; border-right: #4f81bd 1pt solid"&gt;           &lt;p&gt;&lt;span style="color: white"&gt;&lt;b&gt;Information&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td style="border-bottom: #4f81bd 1pt solid; border-left: #4f81bd 1pt solid; padding-left: 7px; padding-right: 7px; border-top-style: none; border-right: #4f81bd 1pt solid"&gt;           &lt;p&gt;&lt;span style="font-size: 9pt"&gt;What is the above degenerate area? &lt;/span&gt;&lt;/p&gt;            &lt;p&gt;&lt;span style="font-size: 9pt"&gt;The degenerate area (or degenerate zone) is an area of the Grid that remains after the last column or row. &lt;/span&gt;&lt;/p&gt;            &lt;p&gt;&lt;span style="font-size: 9pt"&gt;The above Grid is 300px wide, but its two columns are Auto sized only taking up about 110px total; the remaining 190px area is the degenerate area. &lt;/span&gt;&lt;/p&gt;            &lt;p&gt;&lt;span style="font-size: 9pt"&gt;Notice the top Grid Rail Adorner for the degenerate area does not have a number on it. This is because there really is no column there. The missing number on a Grid Rail Adorner for a row or column is a visual indicator that that row or column does not exists.&lt;/span&gt;&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;     &lt;/tbody&gt;&lt;/table&gt; &lt;/div&gt;  &lt;ul style="margin-left: 54pt"&gt;   &lt;li&gt;On the design surface, select the new Grid &lt;/li&gt;    &lt;li&gt;Using the Properties Window, set the five properties indicated by the red arrows &lt;/li&gt;    &lt;li&gt;Your form will now look like the below image &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;img style="margin: 0px 0px 0px 20px" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/1780.060410_5F00_0016_5F00_LayoutTechn57.png" width="768" height="249" /&gt; &lt;/p&gt;  &lt;div style="margin-left: 30pt"&gt;   &lt;table style="border-collapse: collapse" border="0"&gt;&lt;colgroup&gt;&lt;col style="width: 583px" /&gt;&lt;/colgroup&gt;&lt;tbody valign="top"&gt;       &lt;tr style="background: #4f81bd"&gt;         &lt;td style="border-bottom: #4f81bd 1pt solid; border-left: #4f81bd 1pt solid; padding-left: 7px; padding-right: 7px; border-top: #4f81bd 1pt solid; border-right: #4f81bd 1pt solid"&gt;           &lt;p&gt;&lt;span style="color: white"&gt;&lt;b&gt;Information&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td style="border-bottom: #4f81bd 1pt solid; border-left: #4f81bd 1pt solid; padding-left: 7px; padding-right: 7px; border-top-style: none; border-right: #4f81bd 1pt solid"&gt;           &lt;p&gt;&lt;span style="font-size: 9pt"&gt;The reason we right aligned the above Grid is to anchor the Grid (and the child buttons) to the right edge of the form. If the form is resized, the Grid will stay anchored to the right edge.&lt;/span&gt;&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;     &lt;/tbody&gt;&lt;/table&gt; &lt;/div&gt;  &lt;ul style="margin-left: 54pt"&gt;   &lt;li&gt;     &lt;div&gt;Using the Properties Window, selected each Button and set the Content property adoringly &lt;/div&gt;      &lt;ul&gt;       &lt;li&gt;Notice the buttons have the same width. This provides a nice clean look. &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;Resize form to desired size. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;img style="margin: 0px 0px 0px 20px" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/5415.060410_5F00_0016_5F00_LayoutTechn58.png" /&gt; &lt;/p&gt;  &lt;div style="margin-left: 30pt"&gt;   &lt;table style="border-collapse: collapse" border="0"&gt;&lt;colgroup&gt;&lt;col style="width: 583px" /&gt;&lt;/colgroup&gt;&lt;tbody valign="top"&gt;       &lt;tr style="background: #4f81bd"&gt;         &lt;td style="border-bottom: #4f81bd 1pt solid; border-left: #4f81bd 1pt solid; padding-left: 7px; padding-right: 7px; border-top: #4f81bd 1pt solid; border-right: #4f81bd 1pt solid"&gt;           &lt;p&gt;&lt;span style="color: white"&gt;&lt;b&gt;Tip&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td style="border-bottom: #4f81bd 1pt solid; border-left: #4f81bd 1pt solid; padding-left: 7px; padding-right: 7px; border-top-style: none; border-right: #4f81bd 1pt solid"&gt;           &lt;p&gt;&lt;span style="font-size: 9pt"&gt;This is an auto sized form. Notice when you resize the forms width, the TextBoxes resize with the form. &lt;/span&gt;&lt;/p&gt;            &lt;p&gt;&lt;span style="font-size: 9pt"&gt;At your option, you could set a fixed width for the TextBoxes. &lt;/span&gt;&lt;/p&gt;            &lt;p&gt;&lt;span style="font-size: 9pt"&gt;At your option you could also set the MinWidth property on the Window or TextBoxes to prevent the user from resizing the dialog too small.&lt;/span&gt;&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;     &lt;/tbody&gt;&lt;/table&gt; &lt;/div&gt;  &lt;h1&gt;Review&lt;a id="review" title="review" name="review"&gt;&amp;#160;&lt;/a&gt;&lt;/h1&gt;  &lt;p&gt;In this short article we have learned that: &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Form layout skills learned in Windows Forms transfer to WPF and Silverlight &lt;/li&gt;    &lt;li&gt;Absolute positioning can be used in WPF or Silverlight applications &lt;/li&gt;    &lt;li&gt;     &lt;div&gt;Adopting content based layout in WPF or Silverlight can easily be achieved by following a simple workflow: &lt;/div&gt;      &lt;ul&gt;       &lt;li&gt;Roughly layout the form &lt;/li&gt;        &lt;li&gt;Add Grid rows and columns &lt;/li&gt;        &lt;li&gt;Resize Grid child controls &lt;/li&gt;        &lt;li&gt;Set appropriate Margins for child controls &lt;/li&gt;        &lt;li&gt;Add additional controls, etc. &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt; &lt;/ul&gt;  &lt;h1&gt;Comments&lt;a id="comments" title="comments" name="comments"&gt;&amp;#160;&lt;/a&gt;&lt;/h1&gt;  &lt;p&gt;Microsoft values your opinion about our products and documentation. In addition to your general feedback it is very helpful to understand: &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;How the above features enable your workflow &lt;/li&gt;    &lt;li&gt;What is missing from the above features that would be helpful to you &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Thank you for your feedback and have a great day, &lt;/p&gt;  &lt;p&gt;Karl Shifflett    &lt;br /&gt;Expression Team &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10019753" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/wpfsldesigner/archive/tags/WPF/">WPF</category><category domain="http://blogs.msdn.com/b/wpfsldesigner/archive/tags/Silverlight/">Silverlight</category><category domain="http://blogs.msdn.com/b/wpfsldesigner/archive/tags/How+To/">How To</category><category domain="http://blogs.msdn.com/b/wpfsldesigner/archive/tags/Layout/">Layout</category></item><item><title>Creating and Consuming Resource Dictionaries in WPF and Silverlight</title><link>http://blogs.msdn.com/b/wpfsldesigner/archive/2010/06/03/creating-and-consuming-resource-dictionaries-in-wpf-and-silverlight.aspx</link><pubDate>Thu, 03 Jun 2010 23:42:26 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10019739</guid><dc:creator>karl140.6</dc:creator><slash:comments>9</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/wpfsldesigner/rsscomments.aspx?WeblogPostID=10019739</wfw:commentRss><comments>http://blogs.msdn.com/b/wpfsldesigner/archive/2010/06/03/creating-and-consuming-resource-dictionaries-in-wpf-and-silverlight.aspx#comments</comments><description>&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/1715.movie1_5F00_45E27342.gif"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; margin: 0px 10px 0px 0px; display: inline; border-top: 0px; border-right: 0px" title="movie1" border="0" alt="movie1" align="left" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/2055.movie1_5F00_thumb_5F00_1ADA5F70.gif" width="19" height="19" /&gt;&lt;/a&gt; This article has a corresponding video that can be viewed &lt;a href="http://windowsclient.net/learn/video.aspx?v=324328" target="_blank"&gt;here&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;Resource Dictionaries are a powerful feature in WPF and Silverlight that enable developers to organize and consume reusable resources. &lt;/p&gt;  &lt;p&gt;After completing this walk through you'll understand how to create and merge resource dictionaries in WPF and Silverlight; how to add, consume and modify resources in the dictionary using the tools provided by the WPF and Silverlight Designer in Visual Studio 2010. &lt;/p&gt;  &lt;div class="toc"&gt;   &lt;h4&gt;Table of Contents&lt;/h4&gt;    &lt;ol class="list"&gt;     &lt;li&gt;&lt;a href="#what"&gt;What is a Resource? &lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href="#where"&gt;Where Can I Locate Resources? &lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href="#how"&gt;How Do I Create Resources Similar To The Example? &lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href="#resources"&gt;Resources are Declared at Different Scopes &lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href="#show"&gt;Show me how a ResourceDictionary Used &lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href="#fromherewhere"&gt;Where to Go From Here &lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href="#links"&gt;Links &lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href="#comments"&gt;Comments &lt;/a&gt;&lt;/li&gt;   &lt;/ol&gt; &lt;/div&gt;  &lt;h1&gt;What is a Resource?&lt;a id="what" title="what" name="what"&gt;&amp;#160;&lt;/a&gt;&lt;/h1&gt;  &lt;p&gt;Before diving into resource dictionaries let's first understand what the term &amp;quot;resource&amp;quot; means when used in the context of a resource dictionary or in a resources section of an object in XAML. &lt;/p&gt;  &lt;p&gt;A resource is an object declared in XAML. In the below XAML we see examples of typical resources; my: is an alias for the System namespace in mscorlib.&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;UserControl.Resources&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;LinearGradientBrush &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Key&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;formBackground&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;EndPoint&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;0.5,1&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;StartPoint&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;0.5,0&amp;quot;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;GradientStop &lt;/span&gt;&lt;span style="color: red"&gt;Color&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Blue&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Offset&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;0&amp;quot; /&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;GradientStop &lt;/span&gt;&lt;span style="color: red"&gt;Color&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;#460000FF&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Offset&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; /&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;LinearGradientBrush&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;my&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;String &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Key&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;applicationTitle&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Resource Dictionary Demo&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;my&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;String&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;my&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Double &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Key&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;applicationTitleFontSize&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;18&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;my&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Double&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;SolidColorBrush &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Key&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;applicationTitleForeground&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Yellow&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;SolidColorBrush&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;UserControl.Resources&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;One reason to use resources in your applications is to promote object reuse across your application. Object reuse provides consistency across the application. Object reuse also makes it very easy to change the application; since you only need to change the resources and all consumers will pick up the change. &lt;/p&gt;

&lt;p&gt;The below XAML consumes the above resources. &lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;LayoutRoot&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Background&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;StaticResource &lt;/span&gt;&lt;span style="color: red"&gt;formBackground&lt;/span&gt;&lt;span style="color: blue"&gt;}&amp;quot;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock 
        &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;StaticResource &lt;/span&gt;&lt;span style="color: red"&gt;applicationTitle&lt;/span&gt;&lt;span style="color: blue"&gt;}&amp;quot; 
        &lt;/span&gt;&lt;span style="color: red"&gt;Foreground&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;StaticResource &lt;/span&gt;&lt;span style="color: red"&gt;applicationTitleForeground&lt;/span&gt;&lt;span style="color: blue"&gt;}&amp;quot; 
        &lt;/span&gt;&lt;span style="color: red"&gt;FontSize&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;StaticResource &lt;/span&gt;&lt;span style="color: red"&gt;applicationTitleFontSize&lt;/span&gt;&lt;span style="color: blue"&gt;}&amp;quot; 
        &lt;/span&gt;&lt;span style="color: red"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Top&amp;quot;/&amp;gt;
&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&lt;/span&gt;&lt;/pre&gt;

&lt;h1&gt;Where Can I Locate Resources?&lt;a id="where" title="where" name="where"&gt;&amp;#160;&lt;/a&gt;&lt;/h1&gt;

&lt;p&gt;Resources are located in resource dictionaries. &lt;/p&gt;

&lt;p&gt;What I have referred to as a resources section is actually the Resources property (&lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.frameworkelement.resources.aspx" target="_blank"&gt;WPF&lt;/a&gt; &lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.frameworkelement.resources(VS.95).aspx" target="_blank"&gt;Silverlight&lt;/a&gt;) which is of type ResourceDictionary. When you add resources to the Resources property, you are actually adding them to a ResourceDictionary exposed by the object. &lt;/p&gt;

&lt;p&gt;The Resources property is defined on FrameworkElement and is inherited from any object that has FrameworkElement in its inheritance hierarchy. This means that resources can be located on Windows, UserControls, Grids, Buttons, TextBoxes, ListBoxes, etc. &lt;/p&gt;

&lt;p&gt;In addition to an objects Resources property, resources can also be located in a ResourceDictionary XAML file. &lt;/p&gt;

&lt;h1&gt;How Do I Create Resources Similar To The Example?&lt;a id="how" title="how" name="how"&gt;&amp;#160;&lt;/a&gt;&lt;/h1&gt;

&lt;p&gt;Create a new WPF or Silverlight project and add the following XAML. &lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;LayoutRoot&amp;quot;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.Background&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;LinearGradientBrush &lt;/span&gt;&lt;span style="color: red"&gt;EndPoint&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;0.5,1&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;StartPoint&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;0.5,0&amp;quot;&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;GradientStop &lt;/span&gt;&lt;span style="color: red"&gt;Color&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Blue&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Offset&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;0&amp;quot; /&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;GradientStop &lt;/span&gt;&lt;span style="color: red"&gt;Color&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;#460000FF&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Offset&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; /&amp;gt;
        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;LinearGradientBrush&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.Background&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock 
        &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Resource Dictionary Demo&amp;quot; 
        &lt;/span&gt;&lt;span style="color: red"&gt;Foreground&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Yellow&amp;quot; 
        &lt;/span&gt;&lt;span style="color: red"&gt;FontSize&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;18&amp;quot; 
        &lt;/span&gt;&lt;span style="color: red"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Top&amp;quot;/&amp;gt;
&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&lt;/span&gt;&lt;/pre&gt;

&lt;h2&gt;Using the Brush Editor to Create the Background &lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;Select the Grid on the design surface &lt;/li&gt;

  &lt;li&gt;
    &lt;div&gt;Using the Properties Window: &lt;/div&gt;

    &lt;ul&gt;
      &lt;li&gt;
        &lt;div&gt;Step One: &lt;/div&gt;

        &lt;ul&gt;
          &lt;li&gt;Select the Background property &lt;/li&gt;

          &lt;li&gt;Click the Gradient Brush icon &lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;

      &lt;li&gt;
        &lt;div&gt;Step Two: &lt;/div&gt;

        &lt;ul&gt;
          &lt;li&gt;Select the left gradient stop and sets its color to Blue &lt;/li&gt;

          &lt;li&gt;Select the right gradient stop and sets its color to Blue &lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;

      &lt;li&gt;
        &lt;div&gt;Step Three: &lt;/div&gt;

        &lt;ul&gt;
          &lt;li&gt;Click the Horizontal Gradient Brush icon &lt;/li&gt;

          &lt;li&gt;Select the right gradient stop and set the Alpha channel 70 &lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img alt="" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/7506.060310_5F00_2342_5F00_Creatingand4.png" /&gt; &lt;/p&gt;

&lt;h2&gt;Extracting Background Property to a Resource &lt;/h2&gt;

&lt;p&gt;We will now use the &amp;quot;Extract Value to Resource…&amp;quot; feature of the Designer. To exact a property value to a resource, click on the Property Marker, this will open the below Context Menu. Now select, &amp;quot;Extract Value to Resource…&amp;quot; &lt;/p&gt;

&lt;p&gt;&lt;img alt="" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/1541.060310_5F00_2342_5F00_Creatingand5.png" /&gt; &lt;/p&gt;

&lt;p&gt;When the Create Resource dialog opens, change the Key to &amp;quot;formBackground,&amp;quot; leave the Destination value to whatever it defaulted to and click OK. &lt;/p&gt;

&lt;p&gt;Notice that I have chosen to name the resource by its role, as opposed to what it looks like. Adopting this Key naming convention allows a resource to be changed without causing a conflict with the Key name. For example, if the Key name was BlueGradient and I assigned it to each forms Background property, then later wanted to change it to a green gradient, the name would still be BlueGradient but the color was now green. By naming the Key formBackground, I've not associated any color or type of brush with the name. &lt;/p&gt;

&lt;p&gt;&lt;img alt="" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/2605.060310_5F00_2342_5F00_Creatingand6.png" /&gt; &lt;/p&gt;

&lt;p&gt;In the below image we can see what the Designer tool did for us. &lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Created a Resources section in XAML for the Demo UserControl &lt;/li&gt;

  &lt;li&gt;Moved the LinearGradientBrush to the Resources section &lt;/li&gt;

  &lt;li&gt;Added the Key to the resource &lt;/li&gt;

  &lt;li&gt;Set the Grid Background property to the newly created resource &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img alt="" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/0640.060310_5F00_2342_5F00_Creatingand7.png" /&gt; &lt;/p&gt;

&lt;h2&gt;Extracting the TextBlock Properties to a Resource &lt;/h2&gt;

&lt;p&gt;To help us quickly locate the TextBlock properties that have been set, we will now use a very cool feature of the Designer's Properties Window, &amp;quot;Sort by property source.&amp;quot; &lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Select the TextBlock on the design surface &lt;/li&gt;

  &lt;li&gt;
    &lt;div&gt;Using the Properties Window, click the &amp;quot;Sort by property source&amp;quot; Button (top red arrow) &lt;/div&gt;

    &lt;ul&gt;
      &lt;li&gt;This groups all properties together that have been changed from their default value by setting them locally, using a binding or a resource &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;

  &lt;li&gt;
    &lt;div&gt;Using the Extract to Resource feature, extract the properties indicated by the red arrows &lt;/div&gt;

    &lt;ul&gt;
      &lt;li&gt;Text – applicationName &lt;/li&gt;

      &lt;li&gt;FontSize – applicationNameFontSize &lt;/li&gt;

      &lt;li&gt;Foreground - applicationNameForeground &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img alt="" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/6318.060310_5F00_2342_5F00_Creatingand8.png" /&gt; &lt;/p&gt;

&lt;p&gt;After extracting the above properties to resources, your XAML will look like the below image. &lt;/p&gt;

&lt;p&gt;The required root Grid and application title TextBlock properties are now set for reuse. &lt;/p&gt;

&lt;p&gt;Notice the yellow highlighted line of XAML. This alias was added by the Designer tool. When the Designer tool adds an alias, it names the first one, &amp;quot;my&amp;quot; the next alias, &amp;quot;my1&amp;quot;, etc. For very small forms with a single alias this may be acceptable. However for most projects you'll want to use meaningful names for your aliases. &lt;/p&gt;

&lt;p&gt;You have several options open to you to change these. First, if you define the alias in the XAML file before extracting to a resource, the Designer tool will reuse the alias when referencing the same namespace and assembly. You could also edit the XAML after the Designer tool creates it. After you have worked with WPF or Silverlight for a short time, you'll get an understanding of the aliases you use and can just add them to your new XAML files before you start adding other content to the XAML file. &lt;/p&gt;

&lt;p&gt;&lt;img alt="" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/2605.060310_5F00_2342_5F00_Creatingand9.png" width="700" height="312" /&gt; &lt;/p&gt;

&lt;h1&gt;Resources are Declared at Different Scopes&lt;a id="resources" title="resources" name="resources"&gt;&amp;#160;&lt;/a&gt;&lt;/h1&gt;

&lt;p&gt;The below image is the anatomy of a simple WPF or Silverlight application that is composed of hierarchy of objects nested within each other. &lt;/p&gt;

&lt;div style="margin-left: 7pt"&gt;
  &lt;table style="border-collapse: collapse" border="0"&gt;&lt;colgroup&gt;&lt;col style="width: 583px" /&gt;&lt;/colgroup&gt;&lt;tbody valign="top"&gt;
      &lt;tr style="background: #4f81bd"&gt;
        &lt;td style="border-bottom: #4f81bd 1pt solid; border-left: #4f81bd 1pt solid; padding-left: 7px; padding-right: 7px; border-top: #4f81bd 1pt solid; border-right: #4f81bd 1pt solid"&gt;
          &lt;p&gt;&lt;span style="color: white"&gt;&lt;strong&gt;Note&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
        &lt;/td&gt;
      &lt;/tr&gt;

      &lt;tr&gt;
        &lt;td style="border-bottom: #4f81bd 1pt solid; border-left: #4f81bd 1pt solid; padding-left: 7px; padding-right: 7px; border-top-style: none; border-right: #4f81bd 1pt solid"&gt;
          &lt;p&gt;Silverlight does not have system scoped resources like WPF does.&lt;/p&gt;
        &lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;

&lt;p&gt;When we say resources are scoped, we mean that resources can be defined at various levels of the application hierarchy. Resources defined at a certain scope are available to all elements in or below that scope. &lt;/p&gt;

&lt;p&gt;For example, we previously extracted property values to the UserControl scope and the child Grid and TextBlock could access those resources. &lt;/p&gt;

&lt;p&gt;Now, what if we wanted to consume those same resources we extracted earlier in another UserControl; how could we accomplish this? &lt;/p&gt;

&lt;p&gt;To make the resources available, to other UserControls or Windows in the application, we need to move the resources to the Application scope. &lt;/p&gt;

&lt;p&gt;&lt;img alt="" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/2625.060310_5F00_2342_5F00_Creatingand10.png" /&gt; &lt;/p&gt;

&lt;p&gt;When moving resources to Application scope, you have several options available to you: &lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Add the resources to the Application.xaml (VB), or App.xaml (C#) file &lt;/li&gt;

  &lt;li&gt;Add the resources to a ResourceDictionary, then merge that ResourceDictionary at the Application scope &lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;Moving Resources to Application Scope &lt;/h2&gt;

&lt;p&gt;For purposes of demonstration, I've cut the UserControl Resources and pasted them into the Application Resources section. Noticed I also cut and pasted the alias &amp;quot;my:&amp;quot; too. &lt;/p&gt;

&lt;p&gt;You can also remove the UserControl.Resource from the UserControl's XAML as I have done the Demo.xaml image below. &lt;/p&gt;

&lt;p&gt;You'll need to rebuild the application to remove the squiggles from your UserControl's XAML. The UserControl looks exactly as it did, but is now resolving its resources from the Application scope instead of the UserControl scope. We have just enabled reuse of these resources throughout the application. You can also see how Demo.xaml is smaller in size and looks cleaner now that we have moved the resources out of the local XAML file. &lt;/p&gt;

&lt;h3&gt;Application.xaml &lt;/h3&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Application 
    &lt;/span&gt;&lt;span style="color: red"&gt;xmlns&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&amp;quot;
    &lt;/span&gt;&lt;span style="color: red"&gt;xmlns&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml&amp;quot; 
    &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Class&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;ResourceDictionaryDemo.App&amp;quot;
    &lt;/span&gt;&lt;span style="color: red"&gt;xmlns&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;my&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;clr-namespace:System;assembly=mscorlib&amp;quot;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Application.Resources&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;LinearGradientBrush &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Key&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;formBackground&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;EndPoint&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;0.5,1&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;StartPoint&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;0.5,0&amp;quot;&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;GradientStop &lt;/span&gt;&lt;span style="color: red"&gt;Color&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Blue&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Offset&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;0&amp;quot; /&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;GradientStop &lt;/span&gt;&lt;span style="color: red"&gt;Color&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;#460000FF&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Offset&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; /&amp;gt;
        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;LinearGradientBrush&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;my&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;String &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Key&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;applicationTitle&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Resource Dictionary Demo&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;my&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;String&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;my&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Double &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Key&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;applicationTitleFontSize&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;18&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;my&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Double&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;SolidColorBrush &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Key&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;applicationTitleForeground&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Yellow&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;SolidColorBrush&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Application.Resources&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Application&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&lt;/span&gt;&lt;/pre&gt;

&lt;h3&gt;Demo.xaml &lt;/h3&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;UserControl 
    &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Class&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;ResourceDictionaryDemo.MainPage&amp;quot;
    &lt;/span&gt;&lt;span style="color: red"&gt;xmlns&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&amp;quot;
    &lt;/span&gt;&lt;span style="color: red"&gt;xmlns&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml&amp;quot;
    &lt;/span&gt;&lt;span style="color: red"&gt;xmlns&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;d&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;http://schemas.microsoft.com/expression/blend/2008&amp;quot;
    &lt;/span&gt;&lt;span style="color: red"&gt;xmlns&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;mc&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;http://schemas.openxmlformats.org/markup-compatibility/2006&amp;quot;
    &lt;/span&gt;&lt;span style="color: red"&gt;mc&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Ignorable&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;d&amp;quot;
    &lt;/span&gt;&lt;span style="color: red"&gt;d&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;DesignHeight&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;300&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;d&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;DesignWidth&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;400&amp;quot;
    &lt;/span&gt;&lt;span style="color: red"&gt;xmlns&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;my&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;clr-namespace:System;assembly=mscorlib&amp;quot;&amp;gt;

    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;LayoutRoot&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Background&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;StaticResource &lt;/span&gt;&lt;span style="color: red"&gt;formBackground&lt;/span&gt;&lt;span style="color: blue"&gt;}&amp;quot;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock 
            &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;StaticResource &lt;/span&gt;&lt;span style="color: red"&gt;applicationTitle&lt;/span&gt;&lt;span style="color: blue"&gt;}&amp;quot; 
            &lt;/span&gt;&lt;span style="color: red"&gt;Foreground&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;StaticResource &lt;/span&gt;&lt;span style="color: red"&gt;applicationTitleForeground&lt;/span&gt;&lt;span style="color: blue"&gt;}&amp;quot; 
            &lt;/span&gt;&lt;span style="color: red"&gt;FontSize&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;StaticResource &lt;/span&gt;&lt;span style="color: red"&gt;applicationTitleFontSize&lt;/span&gt;&lt;span style="color: blue"&gt;}&amp;quot; 
            &lt;/span&gt;&lt;span style="color: red"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Top&amp;quot;/&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;UserControl&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&lt;/span&gt;&lt;/pre&gt;

&lt;h1&gt;Show me how a ResourceDictionary Used&lt;a id="show" title="show" name="show"&gt;&amp;#160;&lt;/a&gt;&lt;/h1&gt;

&lt;p&gt;If your application only requires a few resources, locating them in the Application.xaml or App.xaml would be fine. &lt;/p&gt;

&lt;p&gt;However, in most applications the number of resources grows quickly and must be managed early in the application lifecycle. &lt;/p&gt;

&lt;p&gt;Resource dictionaries are used to group related resources, then those resource dictionaries are then merged at the Application or other required scope. &lt;/p&gt;

&lt;p&gt;What we will do now is: &lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Create a new Silverlight application &lt;/li&gt;

  &lt;li&gt;Add a ResourceDictionary &lt;/li&gt;

  &lt;li&gt;Merge the ResourceDictionary at Application scope &lt;/li&gt;

  &lt;li&gt;Create the same UI as before &lt;/li&gt;

  &lt;li&gt;Use the Designer tool to extract the resources to the ResourceDictionary instead of the UserControl or Application Resources section &lt;/li&gt;

  &lt;li&gt;Last, we'll add another UserControl and then consume the resources in the ResourceDictionary. &lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;Create a New Silverlight Application &lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;Create a new Silverlight application named, UsingResourceDictionaries &lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;Add a ResourceDictionary &lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;Add a folder named Assets &lt;/li&gt;

  &lt;li&gt;To the Assets folder, add a Silverlight Resource Dictionary named FormDictionary.xaml &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img alt="" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/0068.060310_5F00_2342_5F00_Creatingand13.png" /&gt; &lt;/p&gt;

&lt;h2&gt;Merge the ResourceDictionary at Application Scope &lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;div&gt;Open App.xaml &lt;/div&gt;

    &lt;ul&gt;
      &lt;li&gt;Edit the XAML or copy and paste this XAML &lt;/li&gt;

      &lt;li&gt;You have just merged the FormDictionary ResourceDictionary at Application scope &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Application 
    &lt;/span&gt;&lt;span style="color: red"&gt;xmlns&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&amp;quot;
    &lt;/span&gt;&lt;span style="color: red"&gt;xmlns&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml&amp;quot; 
    &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Class&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;UsingResourceDictionaries.App&amp;quot;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Application.Resources&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ResourceDictionary&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ResourceDictionary.MergedDictionaries&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ResourceDictionary &lt;/span&gt;&lt;span style="color: red"&gt;Source&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Assets/FormDictionary.xaml&amp;quot; /&amp;gt;
            &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;ResourceDictionary.MergedDictionaries&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;ResourceDictionary&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Application.Resources&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Application&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&lt;/span&gt;&lt;/pre&gt;

&lt;h2&gt;Create the Same UI &lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;Open MainPage.xaml &lt;/li&gt;

  &lt;li&gt;
    &lt;div&gt;Select the root Grid &lt;/div&gt;

    &lt;ul&gt;
      &lt;li&gt;Using the Properties Window, set the Background as before &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;

  &lt;li&gt;
    &lt;div&gt;Add a TextBlock to the Grid &lt;/div&gt;

    &lt;ul&gt;
      &lt;li&gt;Right click on the TextBlock, select Reset Layout, All &lt;/li&gt;

      &lt;li&gt;Using the Properties Window, set the four properties on the right &lt;/li&gt;
    &lt;/ul&gt;

    &lt;p&gt;&lt;img alt="" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/1638.060310_5F00_2342_5F00_Creatingand15.png" /&gt; &lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;Extract Property Values to the Merged Resource Dictionary &lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;Select the root Grid &lt;/li&gt;

  &lt;li&gt;
    &lt;div&gt;Using the Properties Window: &lt;/div&gt;

    &lt;ul&gt;
      &lt;li&gt;Click the Background property Property Marker &lt;/li&gt;

      &lt;li&gt;Select Extract Value to Resource… &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img alt="" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/6332.060310_5F00_2342_5F00_Creatingand16.png" /&gt; &lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;div&gt;Using the Create Resource dialog: &lt;/div&gt;

    &lt;ul&gt;
      &lt;li&gt;Change the Key name to formBackground &lt;/li&gt;

      &lt;li&gt;
        &lt;div&gt;From the Destination Combobox, select FormDictionary.xaml &lt;/div&gt;

        &lt;ul&gt;
          &lt;li&gt;Notice how the ComboBox items are nested at each scope &lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;

      &lt;li&gt;Click OK to close the dialog &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img alt="" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/3201.060310_5F00_2342_5F00_Creatingand17.png" /&gt; &lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Open FormDictionary.xaml &lt;/li&gt;

  &lt;li&gt;You can see the formBackground LinearGradientBrush &lt;/li&gt;
&lt;/ul&gt;

&lt;div style="margin-left: 18pt"&gt;
  &lt;table style="border-collapse: collapse" border="0"&gt;&lt;colgroup&gt;&lt;col style="width: 583px" /&gt;&lt;/colgroup&gt;&lt;tbody valign="top"&gt;
      &lt;tr style="background: #4f81bd"&gt;
        &lt;td style="border-bottom: #4f81bd 1pt solid; border-left: #4f81bd 1pt solid; padding-left: 7px; padding-right: 7px; border-top: #4f81bd 1pt solid; border-right: #4f81bd 1pt solid"&gt;
          &lt;p&gt;&lt;span style="color: white"&gt;&lt;strong&gt;Tip&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
        &lt;/td&gt;
      &lt;/tr&gt;

      &lt;tr&gt;
        &lt;td style="border-bottom: #4f81bd 1pt solid; border-left: #4f81bd 1pt solid; padding-left: 7px; padding-right: 7px; border-top-style: none; border-right: #4f81bd 1pt solid"&gt;
          &lt;p&gt;In the next step we will be extracting Double and String values to a resource. The Designer tool will add the &amp;quot;my&amp;quot; alias for the System namespace in mscorlib if an alias has not been added. &lt;/p&gt;

          &lt;p&gt;To make your applications more readable and easier to maintain over time, you can proactively add meaningful aliases before they needed by the Designer as I have done in the yellow highlighted XAML below. &lt;/p&gt;
        &lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;

&lt;p&gt;&amp;#160;&lt;img alt="" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/1145.060310_5F00_2342_5F00_Creatingand18.png" /&gt; &lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Switch back to MainPage.xaml &lt;/li&gt;

  &lt;li&gt;Select the TextBlock &lt;/li&gt;

  &lt;li&gt;
    &lt;div&gt;Using the Properties Window, extract the below three properties using the names indicated &lt;/div&gt;

    &lt;ul&gt;
      &lt;li&gt;Remember to select the Destination after changing the Key name. &lt;/li&gt;
    &lt;/ul&gt;

    &lt;p&gt;&lt;img alt="" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/7024.060310_5F00_2342_5F00_Creatingand19.png" /&gt; &lt;/p&gt;
  &lt;/li&gt;

  &lt;li&gt;
    &lt;div&gt;Your FormDictionary.xaml file should now look like the below image &lt;/div&gt;

    &lt;p&gt;&lt;img alt="" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/6332.060310_5F00_2342_5F00_Creatingand20.png" /&gt; &lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;Consume Resources in another UserControl &lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;Add a new Silverlight UserControl to the project and name it, Consumer.xaml &lt;/li&gt;

  &lt;li&gt;Select the root Grid &lt;/li&gt;

  &lt;li&gt;
    &lt;div&gt;Using the Properties Window: &lt;/div&gt;

    &lt;ul&gt;
      &lt;li&gt;Click the Background property, Property Marker &lt;/li&gt;

      &lt;li&gt;Select Apply Resource… &lt;/li&gt;
    &lt;/ul&gt;

    &lt;p&gt;&lt;img alt="" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/2627.060310_5F00_2342_5F00_Creatingand21.png" /&gt; &lt;/p&gt;
  &lt;/li&gt;

  &lt;li&gt;When the Apply Resource Popup opens, select the formBackground resource &lt;/li&gt;

  &lt;li&gt;
    &lt;div&gt;Notice: &lt;/div&gt;

    &lt;ul&gt;
      &lt;li&gt;Brush resources provide a preview &lt;/li&gt;

      &lt;li&gt;The selected Key is displayed at the bottom &lt;/li&gt;

      &lt;li&gt;You can search for resources by entering search text in the Search Box &lt;/li&gt;

      &lt;li&gt;
        &lt;div&gt;Only resources with the matching type of the property that are in scope are displayed &lt;/div&gt;

        &lt;ul&gt;
          &lt;li&gt;If you don't see a resource you think should be here, ensure that the ResourceDictionary has been merged in correctly. &lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;

      &lt;li&gt;The Silverlight Apply Resource Popup does not list system values; this is only done in WPF. &lt;/li&gt;
    &lt;/ul&gt;

    &lt;p&gt;&lt;img alt="" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/8507.060310_5F00_2342_5F00_Creatingand22.png" /&gt; &lt;/p&gt;
  &lt;/li&gt;

  &lt;li&gt;
    &lt;div&gt;Add a TextBlock to the Grid &lt;/div&gt;

    &lt;ul&gt;
      &lt;li&gt;Right click on the TextBlock, select Reset Layout, All &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;

  &lt;li&gt;Using the Properties Window, set the VerticalAlignment property to Top &lt;/li&gt;

  &lt;li&gt;
    &lt;div&gt;Using the Properties Window, set the appropriate resource for the following properties &lt;/div&gt;

    &lt;ul&gt;
      &lt;li&gt;Text &lt;/li&gt;

      &lt;li&gt;Foreground &lt;/li&gt;

      &lt;li&gt;FontSize &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;

  &lt;li&gt;The TextBlock's properties should not be set like the below image &lt;/li&gt;

  &lt;li&gt;
    &lt;div&gt;Take notice of how easy it was to have both application title TextBlock's consume the resources &lt;/div&gt;

    &lt;p&gt;&lt;img alt="" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/3704.060310_5F00_2342_5F00_Creatingand23.png" /&gt; &lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;Where to Go From Here&lt;a id="fromherewhere" title="fromherewhere" name="fromherewhere"&gt;&amp;#160;&lt;/a&gt;&lt;/h1&gt;

&lt;p&gt;The next logical step from here is to learn how to combine individual resources values into a Style and then apply a single Style to a control. &lt;/p&gt;

&lt;p&gt;This &lt;a href="http://msdn.microsoft.com/en-us/library/ms745683.aspx" target="_blank"&gt;MSDN topic, WPF Styling and Templating&lt;/a&gt; provides a good starting point for understanding Styles. &lt;/p&gt;

&lt;h1&gt;Links&lt;a id="links" title="links" name="links"&gt;&amp;#160;&lt;/a&gt;&lt;/h1&gt;

&lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ms750613.aspx" target="_blank"&gt;MSDN topic WPF Resources Overview&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/cc903952(VS.95).aspx" target="_blank"&gt;MSDN topic Silverlight Resource Dictionaries&lt;/a&gt; &lt;/p&gt;

&lt;h1&gt;Comments&lt;a id="comments" title="comments" name="comments"&gt;&amp;#160;&lt;/a&gt;&lt;/h1&gt;

&lt;p&gt;Microsoft values your opinion about our products and documentation. In addition to your general feedback it is very helpful to understand: &lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;How the above features enable your workflow &lt;/li&gt;

  &lt;li&gt;What is missing from the above features that would be helpful to you &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Thank you for your feedback and have a great day, &lt;/p&gt;

&lt;p&gt;Karl Shifflett 
  &lt;br /&gt;Expression Team&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10019739" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/wpfsldesigner/archive/tags/WPF/">WPF</category><category domain="http://blogs.msdn.com/b/wpfsldesigner/archive/tags/Silverlight/">Silverlight</category><category domain="http://blogs.msdn.com/b/wpfsldesigner/archive/tags/How+To/">How To</category></item><item><title>Create Silverlight Master – Detail UI Using Data Sources Window Object DataSource</title><link>http://blogs.msdn.com/b/wpfsldesigner/archive/2010/06/03/create-silverlight-master-detail-ui-using-data-sources-window-object-datasource.aspx</link><pubDate>Thu, 03 Jun 2010 23:29:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10019733</guid><dc:creator>karl140.6</dc:creator><slash:comments>8</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/wpfsldesigner/rsscomments.aspx?WeblogPostID=10019733</wfw:commentRss><comments>http://blogs.msdn.com/b/wpfsldesigner/archive/2010/06/03/create-silverlight-master-detail-ui-using-data-sources-window-object-datasource.aspx#comments</comments><description>&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/2262.movie1_5F00_73D13CC6.gif"&gt;&lt;img style="border-right-width: 0px; margin: 0px 10px 0px 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="movie1" border="0" alt="movie1" align="left" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-04-metablogapi/5482.movie1_5F00_thumb_5F00_16655575.gif" width="19" height="19" /&gt;&lt;/a&gt; This article has a corresponding video that can be viewed &lt;a href="http://www.silverlight.net/learn/videos/all/create-silverlight-master-detail-ui/" target="_blank"&gt;here&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;Master – Detail layouts are the bread and butter of Line of Business (LOB) applications. This walkthrough will show you how to drag &amp;amp; drop from the Data Sources Window to create the UI that is sourced from an Object DataSource. &lt;/p&gt;  &lt;p&gt;This article has a single download that contains C# and VB.NET completed solutions and starter solutions. The starter solution includes the data entity classes and a static (Shared) data source class. &lt;/p&gt;  &lt;p&gt;This walk through assumes that you'll be starting with the starter solution. &lt;/p&gt;  &lt;div class="toc"&gt;   &lt;h4&gt;Table of Contents&lt;/h4&gt;    &lt;ol class="list"&gt;     &lt;li&gt;&lt;a href="#completed"&gt;Completed Application &lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href="#starter"&gt;Starter Solution &lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href="#addingtitle"&gt;Adding a Title to the Form &lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href="#addingcombobox"&gt;Adding the ComboBox Used for Record Selection &lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href="#addingdetailsform"&gt;Adding the Details Form &lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href="#addingdatagrid"&gt;Adding the DataGrid &lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href="#howdoesitwork"&gt;How does it Work? &lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href="#links"&gt;Links &lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href="#comments"&gt;Comments&lt;/a&gt; &lt;/li&gt;   &lt;/ol&gt; &lt;/div&gt;  &lt;h1&gt;Completed Application&lt;a id="completed" title="completed" name="completed"&gt;&amp;#160;&lt;/a&gt;&lt;/h1&gt;  &lt;p&gt;&lt;img src="http://blogs.msdn.com/blogfiles/wpfsldesigner/052210_1753_CreateSilve1.png" /&gt; &lt;/p&gt;  &lt;p&gt;&lt;span style="color: #4f81bd; font-size: 9pt"&gt;&lt;strong&gt;Figure 1 Completed Application &lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;  &lt;h1&gt;Starter Solution&lt;a id="starter" title="starter" name="starter"&gt;&amp;#160;&lt;/a&gt;&lt;/h1&gt;  &lt;p&gt;Open the accompanying (C# or VB.NET) starter solution. &lt;/p&gt;  &lt;p&gt;&lt;img src="http://blogs.msdn.com/blogfiles/wpfsldesigner/052210_1753_CreateSilve2.png" /&gt; &lt;/p&gt;  &lt;p&gt;&lt;span style="color: #4f81bd; font-size: 9pt"&gt;&lt;strong&gt;Figure 2 Starter Solution &lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;The Data class provides two static (Shared) properties that expose an ObserveableCollection that are the application data sources. The Data class takes the place of a data layer that would be used to populate CLR classes from a database. &lt;/p&gt;  &lt;p&gt;&lt;img src="http://blogs.msdn.com/blogfiles/wpfsldesigner/052210_1753_CreateSilve3.png" /&gt; &lt;/p&gt;  &lt;p&gt;&lt;span style="color: #4f81bd; font-size: 9pt"&gt;&lt;strong&gt;Figure 3 Data Class Diagram &lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;The Customer class can contain one or more Addresses. Each Address has an associated AddressType. &lt;/p&gt;  &lt;p&gt;&lt;img src="http://blogs.msdn.com/blogfiles/wpfsldesigner/052210_1753_CreateSilve4.png" /&gt; &lt;/p&gt;  &lt;p&gt;&lt;span style="color: #4f81bd; font-size: 9pt"&gt;&lt;strong&gt;Figure 4 Entity Class Diagram &lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;  &lt;h1&gt;Adding a Title to the Form&lt;a id="addingtitle" title="addingtitle" name="addingtitle"&gt;&amp;#160;&lt;/a&gt;&lt;/h1&gt;  &lt;h2&gt;Step One &lt;/h2&gt;  &lt;p&gt;&lt;img src="http://blogs.msdn.com/blogfiles/wpfsldesigner/052210_1753_CreateSilve5.png" /&gt; &lt;/p&gt;  &lt;p&gt;&lt;span style="color: #4f81bd; font-size: 9pt"&gt;&lt;strong&gt;Figure 5 Draw Top Border &lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Open MainPage.xaml &lt;/li&gt;    &lt;li&gt;Select the root Grid by clicking inside the Window &lt;/li&gt;    &lt;li&gt;     &lt;div&gt;Create a new Grid Row that takes up about 25% of the Window &lt;/div&gt;      &lt;ul&gt;       &lt;li&gt;Click the Grid rail on the left to create a new row &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;     &lt;div&gt;Draw a Border control inside the new row &lt;/div&gt;      &lt;ul&gt;       &lt;li&gt;Select the Border control in the Toolbox then draw the Border as pictured in Figure 5 above. &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt; &lt;/ul&gt;  &lt;h2&gt;Step Two &lt;/h2&gt;  &lt;ul&gt;   &lt;li&gt;Draw a TextBlock control inside the Border &lt;/li&gt;    &lt;li&gt;Using the Document Outline, multi-select the TextBlock and Border controls. &lt;/li&gt;    &lt;li&gt;     &lt;div&gt;Reset the Layout Properties (see Figure 6 below) &lt;/div&gt;      &lt;ul&gt;       &lt;li&gt;Right click on the selected controls, select Reset Layout, All. &lt;/li&gt;     &lt;/ul&gt;      &lt;p style="margin-left: 18pt"&gt;&lt;img src="http://blogs.msdn.com/blogfiles/wpfsldesigner/052210_1753_CreateSilve6.png" /&gt; &lt;/p&gt;      &lt;p style="margin-left: 18pt"&gt;&lt;span style="color: #4f81bd; font-size: 9pt"&gt;&lt;strong&gt;Figure 6 Resetting Values &lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/li&gt;    &lt;li&gt;After the properties are reset the layout should look like Figure 7 below: &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;img style="margin: 0px 0px 0px 15px" src="http://blogs.msdn.com/blogfiles/wpfsldesigner/052210_1753_CreateSilve7.png" /&gt; &lt;/p&gt;  &lt;p style="margin-left: 18pt"&gt;&lt;span style="color: #4f81bd; font-size: 9pt"&gt;&lt;strong&gt;Figure 7 Title Step Two &lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;  &lt;h2&gt;Step Three &lt;/h2&gt;  &lt;ul&gt;   &lt;li&gt;Using the Document Outline, select the Border control &lt;/li&gt;    &lt;li&gt;     &lt;div&gt;Using the Properties Window, set the following properties: &lt;/div&gt;      &lt;ul&gt;       &lt;li&gt;CornerRadius to 30 &lt;/li&gt;        &lt;li&gt;Margin to 11 &lt;/li&gt;        &lt;li&gt;Padding to 7 &lt;/li&gt;        &lt;li&gt;BorderThickness to 2 &lt;/li&gt;        &lt;li&gt;         &lt;div&gt;Background to formTitleBackgroundBrush &lt;/div&gt;          &lt;ul&gt;           &lt;li&gt;Use Resource Picker, see Figure 8 below &lt;/li&gt;         &lt;/ul&gt;       &lt;/li&gt;        &lt;li&gt;         &lt;div&gt;BorderBrush to formTitleBorderBrush &lt;/div&gt;          &lt;ul&gt;           &lt;li&gt;Use Resource Picker, see Figure 8 below &lt;/li&gt;         &lt;/ul&gt;       &lt;/li&gt;     &lt;/ul&gt;      &lt;p style="margin-left: 18pt"&gt;&lt;img src="http://blogs.msdn.com/blogfiles/wpfsldesigner/052210_1753_CreateSilve8.png" /&gt; &lt;/p&gt;      &lt;p style="margin-left: 18pt"&gt;&lt;span style="color: #4f81bd; font-size: 9pt"&gt;&lt;strong&gt;Figure 8 Applying Resource &lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/li&gt;    &lt;li&gt;Using the Document Outline, select the TextBlock &lt;/li&gt;    &lt;li&gt;     &lt;div&gt;Using the properties Window set the following properties &lt;/div&gt;      &lt;ul&gt;       &lt;li&gt;Text to Customer &lt;/li&gt;        &lt;li&gt;VerticalAlignment to Center &lt;/li&gt;        &lt;li&gt;FontSize to 18 &lt;/li&gt;        &lt;li&gt;FontWeight to Bold &lt;/li&gt;        &lt;li&gt;         &lt;div&gt;Foreground to formTitleForegroundBrush &lt;/div&gt;          &lt;ul&gt;           &lt;li&gt;Use Resource Picker &lt;/li&gt;         &lt;/ul&gt;       &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;Using the Document Outline, select the Grid &lt;/li&gt;    &lt;li&gt;Hover cursor over the left Grid rail for the top row. Set top row to Auto sizing as in Figure 9 below. &lt;/li&gt;    &lt;li&gt;The bottom image in Figure 9 shows the completed form title. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;img src="http://blogs.msdn.com/blogfiles/wpfsldesigner/052210_1753_CreateSilve9.png" /&gt; &lt;/p&gt;  &lt;p style="margin-left: 18pt"&gt;&lt;span style="color: #4f81bd; font-size: 9pt"&gt;&lt;strong&gt;Figure 9 Auto Sizing Row &lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;  &lt;h1&gt;Adding the ComboBox Used for Record Selection&lt;a id="addingcombobox" title="addingcombobox" name="addingcombobox"&gt;&amp;#160;&lt;/a&gt; &lt;/h1&gt;  &lt;h2&gt;Step One &lt;/h2&gt;  &lt;ul&gt;   &lt;li&gt;Select the root Grid by clicking inside the Window &lt;/li&gt;    &lt;li&gt;     &lt;div&gt;Create a new Grid Row that takes up about 25% of the Window &lt;/div&gt;      &lt;ul&gt;       &lt;li&gt;Click the Grid rail on the left to create a new row &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;Draw a StackPanel inside the new row &lt;/li&gt;    &lt;li&gt;Add a TextBlock to the StackPanel by double clicking the TextBlock icon in the Toolbox &lt;/li&gt;    &lt;li&gt;Add a ComboBox to the StackPanel by double clicking the ComboBox icon in the Toolbox &lt;/li&gt;    &lt;li&gt;Form should now look like Figure 10 below &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;img src="http://blogs.msdn.com/blogfiles/wpfsldesigner/052210_1753_CreateSilve10.png" /&gt; &lt;/p&gt;  &lt;p style="margin-left: 18pt"&gt;&lt;span style="color: #4f81bd; font-size: 9pt"&gt;&lt;strong&gt;Figure 10 Record Selector Step One &lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;  &lt;h2&gt;Step Two &lt;/h2&gt;  &lt;ul&gt;   &lt;li&gt;Select the StackPanel &lt;/li&gt;    &lt;li&gt;     &lt;div&gt;Reset the Layout Properties for the StackPanel &lt;/div&gt;      &lt;ul&gt;       &lt;li&gt;Right click on the StackPanel, select Reset Layout, All &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;     &lt;div&gt;Using the Properties Window, set the following properties: &lt;/div&gt;      &lt;ul&gt;       &lt;li&gt;Margin to 11 &lt;/li&gt;        &lt;li&gt;Orientation to Horizontal &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;     &lt;div&gt;Using the Document Outline, multi-select the TextBlock and ComboBox &lt;/div&gt;      &lt;ul&gt;       &lt;li&gt;Right click on the selected controls, select Reset Layout, All &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;     &lt;div&gt;Using the Properties Window, set the following property: &lt;/div&gt;      &lt;ul&gt;       &lt;li&gt;VerticalAlignment to Center &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;     &lt;div&gt;Form should now look like Figure 11 below &lt;/div&gt;      &lt;p&gt;&lt;img src="http://blogs.msdn.com/blogfiles/wpfsldesigner/052210_1753_CreateSilve11.png" /&gt; &lt;/p&gt;      &lt;p&gt;&lt;span style="color: #4f81bd; font-size: 9pt"&gt;&lt;strong&gt;Figure 11 Record Selector Step Two &lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/li&gt; &lt;/ul&gt;  &lt;h2&gt;Step Three &lt;/h2&gt;  &lt;ul&gt;   &lt;li&gt;Using the Document Outline, select the TextBlock &lt;/li&gt;    &lt;li&gt;Using the Properties Window, change the Text property to Select Customer &lt;/li&gt;    &lt;li&gt;Using the Document Outline, select the ComboBox &lt;/li&gt;    &lt;li&gt;     &lt;div&gt;Using the Properties Window, set the following properties: &lt;/div&gt;      &lt;ul&gt;       &lt;li&gt;Margin to 7, 0 &lt;/li&gt;        &lt;li&gt;Width to 175 &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;Change the Grid Row size that the StackPanel is a child of to Auto. &lt;/li&gt;    &lt;li&gt;     &lt;div&gt;Form should now look like Figure 12 below &lt;/div&gt;      &lt;p&gt;&lt;img src="http://blogs.msdn.com/blogfiles/wpfsldesigner/052210_1753_CreateSilve12.png" /&gt; &lt;/p&gt;      &lt;p&gt;&lt;span style="color: #4f81bd; font-size: 9pt"&gt;&lt;strong&gt;Figure 12 Record Selector Completed &lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/li&gt; &lt;/ul&gt;  &lt;h2&gt;Step Four &lt;/h2&gt;  &lt;p&gt;From the Data menu, select Show Data Sources. &lt;/p&gt;  &lt;p&gt;&lt;img src="http://blogs.msdn.com/blogfiles/wpfsldesigner/052210_1753_CreateSilve13.png" /&gt; &lt;/p&gt;  &lt;p&gt;&lt;span style="color: #4f81bd; font-size: 9pt"&gt;&lt;strong&gt;Figure 13 Data Menu &lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;img src="http://blogs.msdn.com/blogfiles/wpfsldesigner/052210_1753_CreateSilve14.png" /&gt; &lt;/p&gt;  &lt;p&gt;&lt;span style="color: #4f81bd; font-size: 9pt"&gt;&lt;strong&gt;Figure 14 Data Sources Window &lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Add a new Data Source by clicking on the &amp;quot;Add New Data Source…&amp;quot; link pictured in Figure 14 above. &lt;/li&gt;    &lt;li&gt;When the Data Source Configuration Wizard is displayed select the Object icon and click the Next button. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;img style="margin: 0px 0px 0px 20px" src="http://blogs.msdn.com/blogfiles/wpfsldesigner/052210_1753_CreateSilve15.png" /&gt; &lt;/p&gt;  &lt;p style="margin-left: 18pt"&gt;&lt;span style="color: #4f81bd; font-size: 9pt"&gt;&lt;strong&gt;Figure 15 Select Data Objects &lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Drill down to the Customer object and select it, then press the Finish button. &lt;/li&gt;    &lt;li&gt;Figure 16 below shows the newly created Object Data Source &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;img style="margin: 0px 0px 0px 20px" src="http://blogs.msdn.com/blogfiles/wpfsldesigner/052210_1753_CreateSilve16.png" /&gt; &lt;/p&gt;  &lt;p style="margin-left: 18pt"&gt;&lt;span style="color: #4f81bd; font-size: 9pt"&gt;&lt;strong&gt;Figure 16 New Data Source &lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;  &lt;h2&gt;Step Five &lt;/h2&gt;  &lt;p&gt;The ComboBox will provide Customer record selection. To wire up the ComboBox drag the Customer object and drop it on the ComboBox as pictured in Figure 17. &lt;/p&gt;  &lt;p&gt;&lt;img src="http://blogs.msdn.com/blogfiles/wpfsldesigner/052210_1753_CreateSilve17.png" /&gt; &lt;/p&gt;  &lt;p&gt;&lt;span style="color: #4f81bd; font-size: 9pt"&gt;&lt;strong&gt;Figure 17 Binding ComboBox &lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Select the ComboBox &lt;/li&gt;    &lt;li&gt;Using the Properties Window, set the DisplayMemberPath to Name &lt;/li&gt; &lt;/ul&gt;  &lt;h3&gt;Providing Run-Time Data to the CollectionViewSource &lt;/h3&gt;  &lt;ul&gt;   &lt;li&gt;When the Customer object was dragged onto the ComboBox, a CollectionViewSource was added to the XAML, the StackPanel that holds the ComboBox had its DataContext set to that same CollectionViewSource. &lt;/li&gt;    &lt;li&gt;At this point, we need to write a very small amount of code to provide data to the CollectionViewSource. &lt;/li&gt;    &lt;li&gt;Open the MainPage.xaml.vb or MainPage.xaml.cs file and edit the code that was added to the Loaded event handler when the Customer object was dragged onto the ComboBox.&amp;#160; When your editing is completed, your source code will look like the examples below.&amp;#160; &lt;/li&gt; &lt;/ul&gt;  &lt;p style="margin-left: 18pt"&gt;&lt;strong&gt;VB.NET&lt;/strong&gt;&lt;/p&gt;  &lt;div style="margin-left: 18pt"&gt;   &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;Imports &lt;/span&gt;System.Windows.Data
&lt;span style="color: blue"&gt;Imports &lt;/span&gt;System.ComponentModel

&lt;span style="color: blue"&gt;Partial Public Class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;MainPage
    &lt;/span&gt;&lt;span style="color: blue"&gt;Inherits &lt;/span&gt;&lt;span style="color: #2b91af"&gt;UserControl

    &lt;/span&gt;&lt;span style="color: blue"&gt;Public Sub New&lt;/span&gt;()
        InitializeComponent()
    &lt;span style="color: blue"&gt;End Sub

    Private Sub &lt;/span&gt;UserControl_Loaded(
                &lt;span style="color: blue"&gt;ByVal &lt;/span&gt;sender &lt;span style="color: blue"&gt;As &lt;/span&gt;System.&lt;span style="color: #2b91af"&gt;Object&lt;/span&gt;,
                &lt;span style="color: blue"&gt;ByVal &lt;/span&gt;e &lt;span style="color: blue"&gt;As &lt;/span&gt;System.Windows.&lt;span style="color: #2b91af"&gt;RoutedEventArgs&lt;/span&gt;) &lt;span style="color: blue"&gt;Handles MyBase&lt;/span&gt;.Loaded

        &lt;span style="color: blue"&gt;If Not &lt;/span&gt;(&lt;span style="color: #2b91af"&gt;DesignerProperties&lt;/span&gt;.GetIsInDesignMode(&lt;span style="color: blue"&gt;Me&lt;/span&gt;)) &lt;span style="color: blue"&gt;Then

            Dim &lt;/span&gt;cvs &lt;span style="color: blue"&gt;As &lt;/span&gt;&lt;span style="color: #2b91af"&gt;CollectionViewSource &lt;/span&gt;=
                &lt;span style="color: blue"&gt;CType&lt;/span&gt;(&lt;span style="color: blue"&gt;Me&lt;/span&gt;.Resources(&lt;span style="color: #a31515"&gt;&amp;quot;CustomerViewSource&amp;quot;&lt;/span&gt;), &lt;span style="color: #2b91af"&gt;CollectionViewSource&lt;/span&gt;)

            cvs.Source = &lt;span style="color: #2b91af"&gt;Data&lt;/span&gt;.Customers

        &lt;span style="color: blue"&gt;End If
    End Sub

End Class
&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p style="margin-left: 18pt"&gt;&lt;strong&gt;C#&lt;/strong&gt;&lt;/p&gt;

&lt;div style="margin-left: 18pt"&gt;
  &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;using &lt;/span&gt;System.ComponentModel;
&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Windows;
&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Windows.Controls;
&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Windows.Data;

&lt;span style="color: blue"&gt;namespace &lt;/span&gt;MasterDetailDataSourcesWindowDemo {

  &lt;span style="color: blue"&gt;public partial class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;MainPage &lt;/span&gt;: &lt;span style="color: #2b91af"&gt;UserControl &lt;/span&gt;{
    &lt;span style="color: blue"&gt;public &lt;/span&gt;MainPage() {
      InitializeComponent();
      Loaded += &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;RoutedEventHandler&lt;/span&gt;(MainPage_Loaded);
    }

    &lt;span style="color: blue"&gt;void &lt;/span&gt;MainPage_Loaded(&lt;span style="color: blue"&gt;object &lt;/span&gt;sender, &lt;span style="color: #2b91af"&gt;RoutedEventArgs &lt;/span&gt;e) {
      &lt;span style="color: blue"&gt;if &lt;/span&gt;(!&lt;span style="color: #2b91af"&gt;DesignerProperties&lt;/span&gt;.GetIsInDesignMode(&lt;span style="color: blue"&gt;this&lt;/span&gt;)) {
        &lt;span style="color: #2b91af"&gt;CollectionViewSource &lt;/span&gt;cvs = (&lt;span style="color: #2b91af"&gt;CollectionViewSource&lt;/span&gt;)&lt;span style="color: blue"&gt;this&lt;/span&gt;.Resources[&lt;span style="color: #a31515"&gt;&amp;quot;CustomerViewSource&amp;quot;&lt;/span&gt;];

        cvs.Source = &lt;span style="color: #2b91af"&gt;Data&lt;/span&gt;.Customers;
      }
    }
  }
}&lt;/pre&gt;
&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;In the above code we are getting a reference to the CustomerViewSource CollectionViewSource and assigning Data.Customers collection to the Source property. &lt;/li&gt;

  &lt;li&gt;In an application that loads data from a database or web service when the form is loaded, you would not want the data to load at design time.&amp;#160; The call to &lt;a href="http://msdn.microsoft.com/en-us/library/system.componentmodel.designerproperties.getisindesignmode(VS.95).aspx" target="_blank"&gt;GetIsInDesignMode&lt;/a&gt; provides this check to allow you to prevent loading data at design time. &lt;/li&gt;

  &lt;li&gt;Run application. You should be able to view data as pictured in Figure 19 below. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img style="margin: 0px 0px 0px 20px" src="http://blogs.msdn.com/blogfiles/wpfsldesigner/052210_1753_CreateSilve18.png" /&gt; &lt;/p&gt;

&lt;p style="margin-left: 18pt"&gt;&lt;span style="color: #4f81bd; font-size: 9pt"&gt;&lt;strong&gt;Figure 18 Run Application &lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;

&lt;h1&gt;Adding the Details Form&lt;a id="addingdetailsform" title="addingdetailsform" name="addingdetailsform"&gt;&amp;#160;&lt;/a&gt; &lt;/h1&gt;

&lt;p&gt;The details form in this application plays the role of the Master in our Master-Details application. &lt;/p&gt;

&lt;h2&gt;Step One &lt;/h2&gt;

&lt;p&gt;Customize the Customer object output. &lt;/p&gt;

&lt;p&gt;&lt;img src="http://blogs.msdn.com/blogfiles/wpfsldesigner/052210_1753_CreateSilve19.png" /&gt; &lt;/p&gt;

&lt;p&gt;&lt;span style="color: #4f81bd; font-size: 9pt"&gt;&lt;strong&gt;Figure 19 Change Customer Layout Type &lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Change the Customer object layout to Details as pictured in Figure 19 above &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img style="margin: 0px 0px 0px 20px" src="http://blogs.msdn.com/blogfiles/wpfsldesigner/052210_1753_CreateSilve20.png" /&gt;&lt;/p&gt;

&lt;h3&gt;&lt;/h3&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p style="margin-left: 18pt"&gt;&lt;span style="color: #4f81bd; font-size: 9pt"&gt;&lt;strong&gt;Figure 20 Change CustomerID Layout Control &lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Change the CustomerID property to use the TextBlock control when rendered as pictured in Figure 20 above &lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;Step Two &lt;/h2&gt;

&lt;p&gt;&lt;img src="http://blogs.msdn.com/blogfiles/wpfsldesigner/052210_1753_CreateSilve21.png" /&gt; &lt;/p&gt;

&lt;p&gt;&lt;span style="color: #4f81bd; font-size: 9pt"&gt;&lt;strong&gt;Figure 21 Adding New Row &lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Select the Grid and add a new row as pictured in Figure 21 above &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img style="margin: 0px 0px 0px 20px" src="http://blogs.msdn.com/blogfiles/wpfsldesigner/052210_1753_CreateSilve22.png" /&gt; &lt;/p&gt;

&lt;p style="margin-left: 18pt"&gt;&lt;span style="color: #4f81bd; font-size: 9pt"&gt;&lt;strong&gt;Figure 22 Details Form Generation &lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Drag and drop the Customer object to the Grid Row below the ComboBox &lt;/li&gt;

  &lt;li&gt;With the Details Grid selected, right click, select Reset Layout, All &lt;/li&gt;

  &lt;li&gt;
    &lt;div&gt;Using the Properties Window, set the following properties: &lt;/div&gt;

    &lt;ul&gt;
      &lt;li&gt;VerticalAlignment to Top &lt;/li&gt;

      &lt;li&gt;Margin to 11 &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;

  &lt;li&gt;Select the outer Grid and change the Details Form row to use Auto sizing &lt;/li&gt;

  &lt;li&gt;Using the Document Outline, select the TextBlock for the CustomerID &lt;/li&gt;

  &lt;li&gt;
    &lt;div&gt;Using the Properties Window, set the following properties: &lt;/div&gt;

    &lt;ul&gt;
      &lt;li&gt;VerticalAlignment to Center &lt;/li&gt;

      &lt;li&gt;HorizontalAlignment to Stretch &lt;/li&gt;

      &lt;li&gt;Height – use property marker to reset &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;

  &lt;li&gt;The application should now look like Figure 23 below &lt;/li&gt;

  &lt;li&gt;Run the application and select different Customers &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img style="margin: 0px 0px 0px 20px" src="http://blogs.msdn.com/blogfiles/wpfsldesigner/052210_1753_CreateSilve23.png" /&gt; &lt;/p&gt;

&lt;p style="margin-left: 18pt"&gt;&lt;span style="color: #4f81bd; font-size: 9pt"&gt;&lt;strong&gt;Figure 23 Details Form Completed &lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;

&lt;h1&gt;Adding the DataGrid&lt;a id="addingdatagrid" title="addingdatagrid" name="addingdatagrid"&gt;&amp;#160;&lt;/a&gt; &lt;/h1&gt;

&lt;h2&gt;Step One &lt;/h2&gt;

&lt;p&gt;Customize the Addresses object output &lt;/p&gt;

&lt;p&gt;&lt;img src="http://blogs.msdn.com/blogfiles/wpfsldesigner/052210_1753_CreateSilve24.png" /&gt; &lt;/p&gt;

&lt;p&gt;&lt;span style="color: #4f81bd; font-size: 9pt"&gt;&lt;strong&gt;Figure 24 Configure CustomerID Layout Control &lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Set the CustomerID field control to None. When the Addresses object is dragged to the design surface, no control will be emitted for the CustomerID property. &lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;Step Two &lt;/h2&gt;

&lt;p&gt;&lt;img src="http://blogs.msdn.com/blogfiles/wpfsldesigner/052210_1753_CreateSilve25.png" /&gt; &lt;/p&gt;

&lt;p&gt;&lt;span style="color: #4f81bd; font-size: 9pt"&gt;&lt;strong&gt;Figure 25 Add Grid to Bottom Row &lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Add a Grid control to the bottom row &lt;/li&gt;

  &lt;li&gt;With Grid selected, right click and select Reset Layout, All &lt;/li&gt;

  &lt;li&gt;
    &lt;div&gt;Using the Properties Window, set the following property: &lt;/div&gt;

    &lt;ul&gt;
      &lt;li&gt;Margin to 11 &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;div style="margin-left: 18pt" sizset="0" sizcache="1"&gt;
  &lt;table style="width: 696px; border-collapse: collapse" border="0"&gt;&lt;colgroup&gt;&lt;col style="width: 583px" /&gt;&lt;/colgroup&gt;&lt;tbody valign="top"&gt;
      &lt;tr style="background: #4f81bd"&gt;
        &lt;td style="border-bottom: #4f81bd 1pt solid; border-left: #4f81bd 1pt solid; padding-left: 7px; padding-right: 7px; border-top: #4f81bd 1pt solid; border-right: #4f81bd 1pt solid" width="694"&gt;&lt;span style="color: white"&gt;&lt;strong&gt;Information&lt;/strong&gt;&lt;/span&gt; &lt;/td&gt;
      &lt;/tr&gt;

      &lt;tr&gt;
        &lt;td style="border-bottom: #4f81bd 1pt solid; border-left: #4f81bd 1pt solid; padding-left: 7px; padding-right: 7px; border-top-style: none; border-right: #4f81bd 1pt solid" width="694"&gt;
          &lt;p&gt;The reason we have added the Grid is to provide a surrounding container for the DataGrid we will add in the next step. &lt;/p&gt;

          &lt;p&gt;The Grid container will have its DataContext property set in the next step when we drag and drop the Addresses DataGrid onto the design surface. &lt;/p&gt;

          &lt;p&gt;If we didn't add this Grid container, the Data Sources Window would look up the tree of elements trying to locate a container to set the DataContext on. In the case of this application, the DataContext would be set on the top level Grid control. While this would work, it would make the XAML harder to read and understand where the DataGrid's DataContext was set. &lt;/p&gt;

          &lt;p&gt;By placing the DataGrid inside its own surrounding Grid control, it's very easy to understand where the DataGrid's DataContext is when reading the XAML.&lt;/p&gt;
        &lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;

&lt;h2&gt;Step Three &lt;/h2&gt;

&lt;p&gt;&lt;img src="http://blogs.msdn.com/blogfiles/wpfsldesigner/052210_1753_CreateSilve26.png" /&gt; &lt;/p&gt;

&lt;p&gt;&lt;span style="color: #4f81bd; font-size: 9pt"&gt;&lt;strong&gt;Figure 26 Drag and Drop Addresses DataGrid &lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Drag and drop the Addresses object from the Data Sources Window to the Grid control added in Step Two above &lt;/li&gt;

  &lt;li&gt;With DataGrid selected, right click and select Reset Layout, All &lt;/li&gt;

  &lt;li&gt;The DataGrid should now look like Figure 27 below &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img style="margin: 0px 0px 0px 20px" src="http://blogs.msdn.com/blogfiles/wpfsldesigner/052210_1753_CreateSilve27.png" /&gt;&lt;/p&gt;

&lt;h2&gt;&lt;/h2&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p style="margin-left: 18pt"&gt;&lt;span style="color: #4f81bd; font-size: 9pt"&gt;&lt;strong&gt;Figure 27 Data Grid Resized &lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;

&lt;h2&gt;Step Four &lt;/h2&gt;

&lt;p&gt;We now need to add an AddressType ComboBox column and wire it up to data source. &lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Change MainPage.xmal to XAML view &lt;/li&gt;

  &lt;li&gt;
    &lt;div&gt;Near the top of the file, add the following to the UserControl.Resources section: &lt;/div&gt;

    &lt;p&gt;&lt;span style="font-family: consolas; color: blue; font-size: 8pt"&gt;&amp;lt;&lt;span style="color: #a31515"&gt;local&lt;span style="color: blue"&gt;:&lt;span style="color: #a31515"&gt;Data&lt;span style="color: red"&gt; x&lt;span style="color: blue"&gt;:&lt;span style="color: red"&gt;Key&lt;span style="color: blue"&gt;=&amp;quot;data&amp;quot; /&amp;gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

    &lt;ul&gt;
      &lt;li&gt;Adding the Data class as a resource allows elements within scope to data bind to properties exposed by the Data class. &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;

  &lt;li&gt;
    &lt;div&gt;Near the bottom of the file, nested inside the DataGrid locate the follow XAML: &lt;/div&gt;

    &lt;p style="margin-left: 18pt"&gt;&lt;span style="font-family: consolas; color: blue; font-size: 8pt"&gt;&amp;lt;&lt;span style="color: #a31515"&gt;sdk&lt;span style="color: blue"&gt;:&lt;span style="color: #a31515"&gt;DataGrid.Columns&lt;span style="color: blue"&gt;&amp;gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
  &lt;/li&gt;

  &lt;li&gt;Copy and Paste the below XAML just below the above Columns tag XAML. This will make the Address Type, the DataGrid's first column. &lt;/li&gt;
&lt;/ul&gt;

&lt;div style="margin-left: 18pt" sizset="1" sizcache="1"&gt;
  &lt;table style="width: 696px; border-collapse: collapse" border="0"&gt;&lt;colgroup&gt;&lt;col style="width: 583px" /&gt;&lt;/colgroup&gt;&lt;tbody valign="top"&gt;
      &lt;tr style="background: #4f81bd"&gt;
        &lt;td style="border-bottom: #4f81bd 1pt solid; border-left: #4f81bd 1pt solid; padding-left: 7px; padding-right: 7px; border-top: #4f81bd 1pt solid; border-right: #4f81bd 1pt solid" width="694"&gt;&lt;span style="color: white"&gt;Information&lt;/span&gt; &lt;/td&gt;
      &lt;/tr&gt;

      &lt;tr&gt;
        &lt;td style="border-bottom: #4f81bd 1pt solid; border-left: #4f81bd 1pt solid; padding-left: 7px; padding-right: 7px; border-top-style: none; border-right: #4f81bd 1pt solid" width="694"&gt;
          &lt;p&gt;The WPF &amp;amp; Silverlight Designer currently does not support the editing DataTemplates so you'll need to edit the XAML in the XAML Editor. &lt;/p&gt;

          &lt;p&gt;However, when editing in the XAML Editor, if you have loaded the Designer, you can use still use the Properties Window to set property values on the selected object.&lt;/p&gt;
        &lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;div style="margin-left: 18pt"&gt;
  &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;sdk&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataGridTemplateColumn 
    &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;AddressTypeColumn&amp;quot; 
    &lt;/span&gt;&lt;span style="color: red"&gt;Header&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Address Type&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;100&amp;quot;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;sdk&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataGridTemplateColumn.CellTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock 
                &lt;/span&gt;&lt;span style="color: red"&gt;Margin&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;3,0,0,0&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Center&amp;quot; 
                &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=AddressType.Name}&amp;quot; /&amp;gt;
        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;sdk&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataGridTemplateColumn.CellTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;sdk&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataGridTemplateColumn.CellEditingTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ComboBox 
                &lt;/span&gt;&lt;span style="color: red"&gt;DisplayMemberPath&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Name&amp;quot; 
                &lt;/span&gt;&lt;span style="color: red"&gt;ItemsSource&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=AddressTypes, &lt;/span&gt;&lt;span style="color: red"&gt;Source&lt;/span&gt;&lt;span style="color: blue"&gt;={&lt;/span&gt;&lt;span style="color: #a31515"&gt;StaticResource &lt;/span&gt;&lt;span style="color: red"&gt;data&lt;/span&gt;&lt;span style="color: blue"&gt;}}&amp;quot; 
                &lt;/span&gt;&lt;span style="color: red"&gt;SelectedItem&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=AddressType, &lt;/span&gt;&lt;span style="color: red"&gt;Mode&lt;/span&gt;&lt;span style="color: blue"&gt;=TwoWay}&amp;quot; /&amp;gt;
        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;sdk&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataGridTemplateColumn.CellEditingTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;sdk&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataGridTemplateColumn&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;Change MainPage.xmal to Design view, the DataGrid should now look like Figure 28 below &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img style="margin: 0px 0px 0px 20px" src="http://blogs.msdn.com/blogfiles/wpfsldesigner/052210_1753_CreateSilve28.png" /&gt; &lt;/p&gt;

&lt;p style="margin-left: 18pt"&gt;&lt;span style="color: #4f81bd; font-size: 9pt"&gt;&lt;strong&gt;Figure 28 After Pasting Address Type Column &lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Select the DataGrid &lt;/li&gt;

  &lt;li&gt;In the Properties Window, click the ellipsis button for the Columns property. This will open the Collection Editor for the DataGrid Columns. &lt;/li&gt;

  &lt;li&gt;Change the Collection Editor Properties to Alpha view &lt;/li&gt;

  &lt;li&gt;In the Properties Search Box enter: width &lt;/li&gt;

  &lt;li&gt;The Collection Editor should now look like Figure 29 below &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img style="margin: 0px 0px 0px 20px" src="http://blogs.msdn.com/blogfiles/wpfsldesigner/052210_1753_CreateSilve29.png" /&gt; &lt;/p&gt;

&lt;p style="margin-left: 18pt"&gt;&lt;span style="color: #4f81bd; font-size: 9pt"&gt;&lt;strong&gt;Figure 29 DataGrid Column Collection Editor &lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;

&lt;div sizset="2" sizcache="1"&gt;
  &lt;table style="width: 696px; border-collapse: collapse" border="0"&gt;&lt;colgroup&gt;&lt;col style="width: 583px" /&gt;&lt;/colgroup&gt;&lt;tbody valign="top"&gt;
      &lt;tr style="background: #4f81bd"&gt;
        &lt;td style="border-bottom: #4f81bd 1pt solid; border-left: #4f81bd 1pt solid; padding-left: 7px; padding-right: 7px; border-top: #4f81bd 1pt solid; border-right: #4f81bd 1pt solid" width="694"&gt;&lt;span style="color: white"&gt;&lt;strong&gt;Information&lt;/strong&gt;&lt;/span&gt; &lt;/td&gt;
      &lt;/tr&gt;

      &lt;tr&gt;
        &lt;td style="border-bottom: #4f81bd 1pt solid; border-left: #4f81bd 1pt solid; padding-left: 7px; padding-right: 7px; border-top-style: none; border-right: #4f81bd 1pt solid" width="694"&gt;
          &lt;p&gt;&lt;span style="font-size: 9pt"&gt;The DataGridColumn Width property is of type DataGridLength. Star sizing for the Silverlight DataGrid is a new feature in Silverlight 4. &lt;/span&gt;&lt;/p&gt;

          &lt;p&gt;&lt;span style="font-size: 9pt"&gt;You can read about the DataGridLength in this MSDN topic: &lt;/span&gt;&lt;/p&gt;

          &lt;p&gt;&lt;span style="font-size: 9pt"&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.controls.datagridlength(VS.95).aspx"&gt;http://msdn.microsoft.com/en-us/library/system.windows.controls.datagridlength(VS.95).aspx&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
        &lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;Set AddressTypeColumn width to 100, Pixel &lt;/li&gt;

  &lt;li&gt;Set CityColumn width to SizeToCells &lt;/li&gt;

  &lt;li&gt;Set StateColumn width to SizeToHeader &lt;/li&gt;

  &lt;li&gt;Set StreetColumn width to 1, Star &lt;/li&gt;

  &lt;li&gt;Set ZipColumn width to SizeToCells &lt;/li&gt;

  &lt;li&gt;Reorder the columns by moving the StreetColumn to come after the AddressTypeColumn as in Figure 30 below &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img style="margin: 0px 0px 0px 20px" src="http://blogs.msdn.com/blogfiles/wpfsldesigner/052210_1753_CreateSilve30.png" /&gt; &lt;/p&gt;

&lt;p style="margin-left: 36pt"&gt;&lt;span style="color: #4f81bd; font-size: 9pt"&gt;&lt;strong&gt;Figure 30 DataGrid Column Reordering &lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Close the Collection Editor by clicking the OK button &lt;/li&gt;

  &lt;li&gt;The DataGrid should now look like Figure 31 below &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img style="margin: 0px 0px 0px 20px" src="http://blogs.msdn.com/blogfiles/wpfsldesigner/052210_1753_CreateSilve31.png" /&gt; &lt;/p&gt;

&lt;p style="margin-left: 18pt"&gt;&lt;span style="color: #4f81bd; font-size: 9pt"&gt;&lt;strong&gt;Figure 31 DataGrid After Column Resizing &lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;div&gt;Run your application &lt;/div&gt;

    &lt;ul&gt;
      &lt;li&gt;You can edit rows in the DataGrid &lt;/li&gt;

      &lt;li&gt;Notice that the ComboBox in the DataGrid provides selection for the Address, AddressType. &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;How does it Work?&lt;a id="howdoesitwork" title="howdoesitwork" name="howdoesitwork"&gt;&amp;#160;&lt;/a&gt; &lt;/h1&gt;

&lt;p&gt;The CollectionViewSource is a powerful class that provides a wrapper around a data source, adding sorting, grouping and filtering functionality without changing the source data. &lt;/p&gt;

&lt;p&gt;The CollectionViewSource is a proxy class to the underlying CollectionView that provides navigation of collection items. &lt;/p&gt;

&lt;div sizset="3" sizcache="1"&gt;
  &lt;table style="width: 696px; border-collapse: collapse" border="0"&gt;&lt;colgroup&gt;&lt;col style="width: 583px" /&gt;&lt;/colgroup&gt;&lt;tbody valign="top"&gt;
      &lt;tr style="background: #4f81bd"&gt;
        &lt;td style="border-bottom: #4f81bd 1pt solid; border-left: #4f81bd 1pt solid; padding-left: 7px; padding-right: 7px; border-top: #4f81bd 1pt solid; border-right: #4f81bd 1pt solid" width="694"&gt;&lt;span style="color: white"&gt;&lt;strong&gt;Information&lt;/strong&gt;&lt;/span&gt; &lt;/td&gt;
      &lt;/tr&gt;

      &lt;tr&gt;
        &lt;td style="border-bottom: #4f81bd 1pt solid; border-left: #4f81bd 1pt solid; padding-left: 7px; padding-right: 7px; border-top-style: none; border-right: #4f81bd 1pt solid" width="694"&gt;
          &lt;p&gt;&lt;span style="font-size: 9pt"&gt;MSDN CollectionViewSource documentation can be viewed here: &lt;/span&gt;&lt;/p&gt;

          &lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.data.collectionviewsource(VS.95).aspx"&gt;&lt;span style="font-size: 9pt"&gt;http://msdn.microsoft.com/en-us/library/system.windows.data.collectionviewsource(VS.95).aspx&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
        &lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;

&lt;p&gt;&lt;img src="http://blogs.msdn.com/blogfiles/wpfsldesigner/052210_1753_CreateSilve32.png" /&gt; &lt;/p&gt;

&lt;p&gt;&lt;span style="color: #4f81bd; font-size: 9pt"&gt;&lt;strong&gt;Figure 32 Data Object Relationships &lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;The Data.Customers ObservableCollection is the source for the CustomerViewSource. This data is wired up in the MainPage.Loaded event. &lt;/li&gt;

  &lt;li&gt;When the ComboBox selection changes it sets the CurrentItem on the underlying CollectionView. &lt;/li&gt;

  &lt;li&gt;The Details Form is bound to the CurrentItem. When selection changes, the Details Form DataContext changes and the selected Customer is displayed. &lt;/li&gt;

  &lt;li&gt;The CustomerAddressesViewSource is bound to the CurrentItem (current Customer) Addresses property. &lt;/li&gt;

  &lt;li&gt;The DataGrid is bound to the CustomerAddressesViewSource and displays all items in this collection. &lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;DataGrid ComboBox &lt;/h2&gt;

&lt;p&gt;Silverlight does not ship with a DataGridComboBoxColumn class. Instead, it provides the flexible DataGridTemplateColumn class. This column exposes two template properties, CellTemplate and CellEditingTemplate that enable developers to author DataTemplates when the cell is in read or edit mode. &lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;sdk&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataGridTemplateColumn 
    &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;AddressTypeColumn&amp;quot; 
    &lt;/span&gt;&lt;span style="color: red"&gt;Header&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Address Type&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;100&amp;quot;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;sdk&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataGridTemplateColumn.CellTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock 
                &lt;/span&gt;&lt;span style="color: red"&gt;Margin&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;3,0,0,0&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Center&amp;quot; 
                &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=AddressType.Name}&amp;quot; /&amp;gt;
        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;sdk&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataGridTemplateColumn.CellTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;sdk&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataGridTemplateColumn.CellEditingTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ComboBox 
                &lt;/span&gt;&lt;span style="color: red"&gt;DisplayMemberPath&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Name&amp;quot; 
                &lt;/span&gt;&lt;span style="color: red"&gt;ItemsSource&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=AddressTypes, &lt;/span&gt;&lt;span style="color: red"&gt;Source&lt;/span&gt;&lt;span style="color: blue"&gt;={&lt;/span&gt;&lt;span style="color: #a31515"&gt;StaticResource &lt;/span&gt;&lt;span style="color: red"&gt;data&lt;/span&gt;&lt;span style="color: blue"&gt;}}&amp;quot; 
                &lt;/span&gt;&lt;span style="color: red"&gt;SelectedItem&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;=AddressType, &lt;/span&gt;&lt;span style="color: red"&gt;Mode&lt;/span&gt;&lt;span style="color: blue"&gt;=TwoWay}&amp;quot; /&amp;gt;
        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;sdk&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataGridTemplateColumn.CellEditingTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;sdk&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataGridTemplateColumn&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&lt;/span&gt;&lt;/pre&gt;

&lt;ul&gt;
  &lt;li&gt;AddressType.Name displays in the Address Type cell when not editing &lt;/li&gt;

  &lt;li&gt;When editing the Address Type, the cell displays a ComboBox that provides selection of an AddressType. &lt;/li&gt;

  &lt;li&gt;SelectedItem property gets and sets the AddressType for the Address in the row &lt;/li&gt;

  &lt;li&gt;ItemsSource is set to the static resource data, which exposes the Data class for data binding. Data.AddressTypes is a collection of AddressType which is what the ComboBox uses for its ItemsSource. &lt;/li&gt;

  &lt;li&gt;DisplayMemberPath is the Name property of the AddressType &lt;/li&gt;
&lt;/ul&gt;

&lt;div style="margin-left: 18pt" sizset="4" sizcache="1"&gt;
  &lt;table style="width: 696px; border-collapse: collapse" border="0"&gt;&lt;colgroup&gt;&lt;col style="width: 583px" /&gt;&lt;/colgroup&gt;&lt;tbody valign="top"&gt;
      &lt;tr style="background: #4f81bd"&gt;
        &lt;td style="border-bottom: #4f81bd 1pt solid; border-left: #4f81bd 1pt solid; padding-left: 7px; padding-right: 7px; border-top: #4f81bd 1pt solid; border-right: #4f81bd 1pt solid" width="694"&gt;&lt;span style="color: white"&gt;&lt;strong&gt;Information&lt;/strong&gt;&lt;/span&gt; &lt;/td&gt;
      &lt;/tr&gt;

      &lt;tr&gt;
        &lt;td style="border-bottom: #4f81bd 1pt solid; border-left: #4f81bd 1pt solid; padding-left: 7px; padding-right: 7px; border-top-style: none; border-right: #4f81bd 1pt solid" width="694"&gt;
          &lt;p&gt;&lt;span style="font-size: 9pt"&gt;MSDN DataGridTemplateColumn documentation can be viewed here:&lt;strong&gt; &lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;

          &lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.controls.datagridtemplatecolumn(VS.95).aspx"&gt;&lt;span style="font-size: 9pt"&gt;http://msdn.microsoft.com/en-us/library/system.windows.controls.datagridtemplatecolumn(VS.95).aspx&lt;/span&gt;&lt;/a&gt;&lt;span style="font-size: 9pt"&gt; &lt;/span&gt;&lt;/p&gt;
        &lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;

&lt;h1&gt;Links&lt;a id="links" title="links" name="links"&gt;&amp;#160;&lt;/a&gt; &lt;/h1&gt;

&lt;p&gt;Now that you have a built a simple Silverlight application can we suggest that you view Scott Morrison's MIX10 presentation, building Silverlight Business Applications. &lt;/p&gt;

&lt;p&gt;Presentation: &lt;a href="http://live.visitmix.com/MIX10/Sessions/CL08"&gt;http://live.visitmix.com/MIX10/Sessions/CL08&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Blog post with source code: &lt;a href="http://blogs.msdn.com/scmorris/archive/2010/03/17/mix-10-silverlight-4-business-applications.aspx"&gt;http://blogs.msdn.com/scmorris/archive/2010/03/17/mix-10-silverlight-4-business-applications.aspx&lt;/a&gt; &lt;/p&gt;

&lt;h1&gt;Comments&lt;a id="comments" title="comments" name="comments"&gt;&amp;#160;&lt;/a&gt;&lt;/h1&gt;

&lt;p&gt;Microsoft values your opinion about our products and documentation. In addition to your general feedback it is very helpful to understand: &lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;How the above features enable your workflow &lt;/li&gt;

  &lt;li&gt;What is missing from the above features that would be helpful to you &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Thank you for your feedback and have a great day, &lt;/p&gt;

&lt;p&gt;Karl Shifflett 
  &lt;br /&gt;Expression Team &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10019733" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-components-postattachments/00-10-01-97-33/SLMasterDetailDataSourcesWindowSouce.zip" length="80997" type="application/x-zip-compressed" /><category domain="http://blogs.msdn.com/b/wpfsldesigner/archive/tags/Silverlight/">Silverlight</category><category domain="http://blogs.msdn.com/b/wpfsldesigner/archive/tags/How+To/">How To</category></item></channel></rss>