title: Newbie error: XamlParseException occured in WPF application
body: <p>I'm trying to build a WPF application using the example <a href="http://msdn.microsoft.com/en-us/library/ms752299%28VS.100%29.aspx" rel="nofollow">here: Windows sample WPF application</a>
  . However I'm getting the following error as I work through it</p>
  
  <blockquote>
    <p>'Provide value on 'System.Windows.StaticResourceExtension' threw an exception.' Line number '36' and line position '55'.</p>
  </blockquote>
  
  <p>And its thrown on the following line</p>
  
  <pre><code> &lt;ListBox Name="peopleListBox" Grid.Column="1" Grid.Row="2" 
           ItemsSource="{Binding Source={StaticResource ExpenseDataSource}, XPath=Person}"
           ItemTemplate="{StaticResource nameItemTemplate}"&gt;
          &lt;/ListBox&gt;
  </code></pre>
  
  <p>The inner exception provides the following details</p>
  
  <blockquote>
    <p>{"Cannot find resource named 'nameItemTemplate'. Resource names are case sensitive."}</p>
  </blockquote>
  
  <p>Here's the problematic xaml. </p>
  
  <pre><code>&lt;Page x:Class="ExpenseIt.ExpenseItHome"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
        mc:Ignorable="d" 
        d:DesignHeight="300" d:DesignWidth="300"
      Title="ExpenseIt-Home"&gt;
  
      &lt;Grid Margin="10,0,10,10"&gt;
          &lt;Grid.Background&gt;
              &lt;ImageBrush ImageSource="2012-12-20 13.27.57.jpg"  /&gt;
          &lt;/Grid.Background&gt;
  
          &lt;Grid.ColumnDefinitions&gt;
              &lt;ColumnDefinition Width="230" /&gt;
              &lt;ColumnDefinition /&gt;
          &lt;/Grid.ColumnDefinitions&gt;
  
          &lt;Grid.RowDefinitions&gt;
              &lt;RowDefinition/&gt;
              &lt;RowDefinition Height="Auto"/&gt;
              &lt;RowDefinition /&gt;
              &lt;RowDefinition Height="Auto"/&gt;
          &lt;/Grid.RowDefinitions&gt;
  
          &lt;!-- People list --&gt;
  
          &lt;Label Grid.Column="1" Style="{StaticResource headerTextStyle}" &gt;
              View Expense Report
          &lt;/Label&gt;
  
          &lt;Border Grid.Column="1" Grid.Row="1" Style="{StaticResource listHeaderStyle}"&gt;
              &lt;Label Style="{StaticResource listHeaderTextStyle}"&gt;Names&lt;/Label&gt;
          &lt;/Border&gt;
          &lt;ListBox Name="peopleListBox" Grid.Column="1" Grid.Row="2" 
           ItemsSource="{Binding Source={StaticResource ExpenseDataSource}, XPath=Person}"
           ItemTemplate="{StaticResource nameItemTemplate}"&gt;
          &lt;/ListBox&gt;
  
  
  
          &lt;!-- View report button --&gt;
          &lt;Button Grid.Column="1" Grid.Row="3" Click="Button_Click" Style="{StaticResource buttonStyle}"&gt;View&lt;/Button&gt;
          &lt;Grid.Resources&gt;
  
              &lt;!-- Expense Report Data --&gt;
              &lt;XmlDataProvider x:Key="ExpenseDataSource" XPath="Expenses"&gt;
                  &lt;x:XData&gt;
                      &lt;Expenses xmlns=""&gt;
                          &lt;Person Name="Mike" Department="Legal"&gt;
                              &lt;Expense ExpenseType="Lunch" ExpenseAmount="50" /&gt;
                              &lt;Expense ExpenseType="Transportation" ExpenseAmount="50" /&gt;
                          &lt;/Person&gt;
                          &lt;Person Name="Lisa" Department="Marketing"&gt;
                              &lt;Expense ExpenseType="Document printing"
        ExpenseAmount="50"/&gt;
                              &lt;Expense ExpenseType="Gift" ExpenseAmount="125" /&gt;
                          &lt;/Person&gt;
                          &lt;Person Name="John" Department="Engineering"&gt;
                              &lt;Expense ExpenseType="Magazine subscription" 
       ExpenseAmount="50"/&gt;
                              &lt;Expense ExpenseType="New machine" ExpenseAmount="600" /&gt;
                              &lt;Expense ExpenseType="Software" ExpenseAmount="500" /&gt;
                          &lt;/Person&gt;
                          &lt;Person Name="Mary" Department="Finance"&gt;
                              &lt;Expense ExpenseType="Dinner" ExpenseAmount="100" /&gt;
                          &lt;/Person&gt;
                      &lt;/Expenses&gt;
                  &lt;/x:XData&gt;
              &lt;/XmlDataProvider&gt;
  
  
              &lt;!-- Name item template --&gt;
              &lt;DataTemplate x:Key="nameItemTemplate"&gt;
                  &lt;Label Content="{Binding XPath=@Name}"/&gt;// isnt this enough?
              &lt;/DataTemplate&gt; 
          &lt;/Grid.Resources&gt;
      &lt;/Grid&gt;
  &lt;/Page&gt;
  </code></pre>
  
  <p>Any help on what Im doing wrong and how I could correct it, would be greatly appreciated! Thanks!</p>