Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This tutorial from MSDN was perfect: <a href="http://msdn.microsoft.com/en-us/library/ee823176.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/ee823176.aspx</a></p> <p>Basically:</p> <p>Create a file <code>DesignData/FooData/Foo.xaml</code> with content such as:</p> <pre><code>&lt;local:Foo xmlns:local="clr-namespace:YourProject" SomeProperty="Sample" AnotherProperty="Bar" /&gt; </code></pre> <p>Note that <code>Foo</code> must be a class that exists under the namespace <code>YourProject</code> with the properties you just used.</p> <p>Then select the file from the <em>Solution Explorer</em> and set the <em>Build Action</em> to <code>Design Data</code>.</p> <p>Add a namespace to your <code>MainWindow.xaml</code> code: </p> <pre><code>xmlns:d="http://schemas.microsoft.com/expression/blend/2008" </code></pre> <p>along with the other namespaces you have.</p> <p>Then add this to your top-level Grid for instance: </p> <pre><code>d:DataContext="{d:DesignData Source=./DesignData/FooData/Foo.xaml}" </code></pre> <p>Now elements below that Grid element (under the influence of DataContext) can have the property:</p> <pre><code>&lt;TabControl ItemsSource="{Binding Mode=OneWay}"&gt;... </code></pre> <p>In my case I used a tab control and my data context was a collection <code>DesignData/FooData/FooCollection.xaml</code>:</p> <pre><code>&lt;local:FooCollection xmlns:local="clr-namespace:YourProject"&gt; &lt;local:Foo Prop1="Sample" Prop2="test" /&gt; ... &lt;/local:FooCollection&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload