title: How to show Collection data in VS WPF Design panel?
body: <p><strong>How do I get VS to populate my <code>ListView</code> with sample data in the Design panel?</strong></p>
  
  <p>I'm stumped. I've done a fair bit of reading and googling and can't find a solid answer. Showing fake data in the VS Design panel would greatly speed up theming as I wouldn't have to debug it every few changes. </p>
  
  <p>Here is my code:  </p>
  
  <p><strong>XAML:</strong> </p>
  
  <pre><code>&lt;ListView DataContext="{Binding}"
            Name="PeopleListView"&gt;
      &lt;ListView.ItemTemplate&gt;
          &lt;DataTemplate DataType="Person"&gt;
                  &lt;WrapPanel&gt;
                      &lt;TextBlock Text="{Binding Path=FirstNameView}"/&gt;
                      &lt;TextBlock Text="{Binding Path=LastNameView}" /&gt;
                  &lt;/WrapPanel&gt;
          &lt;/DataTemplate&gt;
      &lt;/ListView.ItemTemplate&gt;
  &lt;/ListView&gt;
  </code></pre>
  
  <p><strong>COLLECTION:</strong> </p>
  
  <pre><code>public class People : ObservableCollection&lt;Person&gt;
  {
      public People()
      {
          this.Add(new Person() { FirstName = "John", LastName = "Doe" });
          this.Add(new Person() { FirstName = "John", LastName = "Doe" });
          this.Add(new Person() { FirstName = "John", LastName = "Doe" });
      }
  }
  </code></pre>
  
  <p><strong>MAIN:</strong> </p>
  
  <pre><code>private People PList;
  
  public MainWindow()
  {
      this.PList = new People();
      PeopleListView.ItemsSource = this.PList;
  }
  </code></pre>
  
  <p><strong>EDIT &amp; PROGRESS:</strong>  </p>
  
  <p>I read through the tutorials found in the link provided by <em>Matt West</em>. They were very helpful. I almost got this figured out. </p>
  
  <p>I ran into a problem when the Designer tries to display the Sample Data. I get this error on my sample properties: <code>Writable property or collection expected</code>. I understand the error, I just don't know how to fix it without giving each property a <code>set</code> statement. </p>
  
  <p>Here is my code: </p>
  
  <p><strong>Person Class:</strong>  </p>
  
  <pre><code>public class Person : INotifyPropertyChanged
  {
      private string _FirstName;
      private string _LastName;
  
      public string FirstName
      {
          get { return this._email; }
          set
          {
              this._FirstName = value;
              OnPropertyChanged("FirstName");
              OnPropertyChanged("FirstNameView");
          }
      }
      public string LastName
      {
          get { return this._password; }
          set
          {
              this._LastName = value;
              OnPropertyChanged("LastName");
              OnPropertyChanged("FirstNameView");
          }
      }
      public string FirstNameView
      {
          get { return this.FirstName; }
      }
      public string LastNameView
      {
          get { return this.LastName; }
      }
  
      public event PropertyChangedEventHandler PropertyChanged;
      private void OnPropertyChanged(string propertyName) { /*...*/ }
  }
  </code></pre>
  
  <p><strong>PeopleViewSampleData.xaml:</strong>  </p>
  
  <pre><code>&lt;sample:People xmlns:sample="clr-namespace:MyProgram"&gt;
      &lt;sample:Person FirstNameView="John" LastNameView="Doe" /&gt;
  &lt;/sample:People&gt;  
  </code></pre>
  
  <p><strong>EDIT, SOLUTION:</strong><br>
  Having <code>ItemSource</code>, <code>DataContext</code>, and <code>:DataContext</code> setup as follows made it work. If any of that was missing,  nothing would show. </p>
  
  <pre><code>&lt;ListView ItemsSource="{Binding}"
            DataContext="{Binding}"
            d:DataContext="{d:DesignData Source=/SampleData/PeopleListViewSampleData.xaml}"/&gt;
  </code></pre>