title: binding a command inside a listbox item to a property on the viewmodel parent
body: <p>I've been working on this for about an hour and looked at all related SO questions.</p>
  
  <p>My problem is very simple:</p>
  
  <p>I have HomePageVieModel:</p>
  
  <pre><code>HomePageVieModel
  +IList&lt;NewsItem&gt; AllNewsItems
  +ICommand OpenNews
  </code></pre>
  
  <p>My markup:</p>
  
  <pre><code>&lt;Window DataContext="{Binding HomePageViewModel../&gt;
  &lt;ListBox ItemsSource="{Binding Path=AllNewsItems}"&gt;
   &lt;ListBox.ItemTemplate&gt;
     &lt;DataTemplate&gt;
         &lt;StackPanel&gt;
          &lt;TextBlock&gt;
             &lt;Hyperlink Command="{Binding Path=OpenNews}"&gt;
                 &lt;TextBlock Text="{Binding Path=NewsContent}" /&gt;
             &lt;/Hyperlink&gt;
          &lt;/TextBlock&gt;
        &lt;/StackPanel&gt;
      &lt;/DataTemplate&gt;
  &lt;/ListBox.ItemTemplate&gt;
  </code></pre>
  
  <p>The list shows fine with all the items, but for the life of me whatever I try for the Command won't work:</p>
  
  <pre><code>&lt;Hyperlink Command="{Binding Path=OpenNewsItem, RelativeSource={RelativeSource AncestorType=vm:HomePageViewModel, AncestorLevel=1}}"&gt;
  &lt;Hyperlink Command="{Binding Path=OpenNewsItem, RelativeSource={RelativeSource AncestorType=vm:HomePageViewModel,**Mode=FindAncestor}**}"&gt;
  &lt;Hyperlink Command="{Binding Path=OpenNewsItem, RelativeSource={RelativeSource AncestorType=vm:HomePageViewModel,**Mode=TemplatedParent}**}"&gt;
  </code></pre>
  
  <p>I just always get :</p>
  
  <blockquote>System.Windows.Data Error: 4 : Cannot find source for binding with reference .....</blockquote>
  
  <p><strong>Update</strong>
  I am setting my ViewModel like this? Didn't think this would matter:</p>
  
  <pre><code> &lt;Window.DataContext&gt;
          &lt;Binding Path="HomePage" Source="{StaticResource Locator}"/&gt;
      &lt;/Window.DataContext&gt;
  </code></pre>
  
  <p>I use the ViewModelLocator class from the MVVMLight toolkit which does the magic.</p>