title: WPF/C# - ListBox example whats the ItemsSource
body: <p>I want to understand the example from msdn
  (<a href="http://msdn.microsoft.com/en-us/library/ms742521.aspx#defining_simple_datatemplate" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/ms742521.aspx#defining_simple_datatemplate</a>).</p>
  
  <p>XAML Code:</p>
  
  <pre><code>&lt;ListBox Width="400" Margin="10" ItemsSource="{Binding Source={StaticResource MyTodoList}}"&gt;
     &lt;ListBox.ItemTemplate&gt;
       &lt;DataTemplate&gt;
         &lt;StackPanel&gt;
           &lt;TextBlock Text="{Binding Path=TaskName}" /&gt;
           &lt;TextBlock Text="{Binding Path=Description}"/&gt;
           &lt;TextBlock Text="{Binding Path=Priority}"/&gt;
         &lt;/StackPanel&gt;
       &lt;/DataTemplate&gt;
     &lt;/ListBox.ItemTemplate&gt;
   &lt;/ListBox&gt;
  </code></pre>
  
  <p>The Data in the Text Blocks are Properties from an Object, is this right?
  The Object is in the List (?) myTodoList in the code behind file?</p>
  
  <pre><code>protected ObservableCollection&lt;TODO&gt; _myTodoList= new ObservableCollection&lt;TODO&gt;();
  public ObservableCollection&lt;TODO&gt; MyTodoList
  {
      get { return _myTodoList; }
  }
  </code></pre>
  
  <p>Add TODO's</p>
  
  <pre><code>TODO t1 = new TODO();
  t1.TaskName = "TaskName1";
  t1.Description = "Description1";
  t1.Priority = "Priority1";
  _myTodoList.Add(t1);
  
  TODO t2 = new TODO();
  t2.TaskName = "TaskName2";
  t2.Description = "Description2";
  t2.Priority = "Priority2";
  _myTodoList.Add(t2);
  </code></pre>
  
  <p>My Test TODO Class:</p>
  
  <pre><code>public class TODO
  {
      public string TaskName { get; set; }
      public string Description { get; set; }
      public string Priority { get; set; }
  }
  </code></pre>
  
  <p>But the code throws an exception... 
  <img src="https://i.stack.imgur.com/bcDSK.png" alt="enter image description here"></p>
  
  <p>whats wrong?</p>