title: WPF ListBox bind to index of the item
body: <p>It's easy to bind something to the SelectedIndex of the ListBox,
  but I want every item in the ListBox be able to bind to it's index in the list.</p>
  
  <p>Might sound weird, so here's what I'm trying to do:</p>
  
  <pre><code>&lt;DataTemplate x:Key="ScenarioItemTemplate"&gt;
  &lt;Border
      Margin="8,2,8,2"
      Background="#FF3C3B3B"
      BorderBrush="#FF797878"
      BorderThickness="2"
      CornerRadius="5"&gt;
      &lt;DockPanel&gt;
          &lt;DockPanel DockPanel.Dock="Top" Margin="0,2,0,0"&gt;
              &lt;Label HorizontalAlignment="Left"
                     DockPanel.Dock="Left"
                     FontWeight="Heavy"
                     Foreground="White"
                     Content="{Binding Path=Position}"
                     MinWidth="50"/&gt;
  
              &lt;Label
                     Content="{Binding Path=Name}"
                     DockPanel.Dock="Left"
                     FontWeight="Heavy"
                     Foreground="white"/&gt;
              &lt;Label 
                     Content="{Binding Path=Header}"
                     Foreground="white"
                     DockPanel.Dock="Left"/&gt;
  
              &lt;TextBlock HorizontalAlignment="Right" 
                         Background="#FF3C3B3B" 
                         DockPanel.Dock="Left" Foreground="White" FontWeight="Heavy"&gt;
                  &lt;Hyperlink Click="CloseHyperlink_Click" Tag=""&gt;X&lt;/Hyperlink&gt;
              &lt;/TextBlock&gt;
  </code></pre>
  
  <p>I want to bind the TAG property of the hyperlink to the index of the item in question.
  So that when the user clicks the hyperlink, I can determine what item caused the event using the TAG property of that hyperlink.</p>
  
  <pre><code>var hyperlink = (Hyperlink)sender;
  var index = Convert.ToInt32(hyperlink.Tag);
  </code></pre>
  
  <p>Suggestions?</p>