title: WPF Binding Collection with Index
body: <p>I'm trying to use a collection that is a property of another collection to bind to a listbox. The following works fine</p>
  
  <pre><code>&lt;ListBox ItemsSource="{Binding Path=Locations[0].Buildings}"&gt;
  </code></pre>
  
  <p>the problem is that I need a dynamic index and</p>
  
  <pre><code>&lt;ListBox ItemsSource="{Binding Path=Locations[index].Buildings}"&gt;
  </code></pre>
  
  <p>where index is an integer in my viewmodel, does not work. Does anyone know how I can associate the index in my xaml with the property in my viewmodel?</p>