title: Why does ListBox AlternationIndex always return 0
body: <p>Ok, I know there are a couple of other similar questions to this but I am having a real issue with getting the AlternationIndex to work on ListBox or ListView.</p>
  
  <p>my xaml is such:</p>
  
  <pre><code>            &lt;ListBox BorderThickness="0" Name="RecentItemsListBox" HorizontalAlignment="Stretch"
                       ScrollViewer.HorizontalScrollBarVisibility="Disabled" 
                       ItemsSource="{Binding Path=RecentFilesList}" AlternationCount="100"&gt;
                  &lt;ListBox.ItemsPanel&gt;
  
                      &lt;ItemsPanelTemplate&gt;
                          &lt;WrapPanel /&gt;
                      &lt;/ItemsPanelTemplate&gt;
                  &lt;/ListBox.ItemsPanel&gt;
  
                  &lt;ListBox.ItemTemplate&gt;
                      &lt;DataTemplate&gt;
                          &lt;StackPanel Orientation="Horizontal"&gt;
                              &lt;TextBlock Text="{Binding Path=(ItemsControl.AlternationIndex), 
                                      RelativeSource={RelativeSource Mode=TemplatedParent}, Converter={StaticResource IncCnvrtr}}" 
                                         Foreground="DimGray" FontSize="20" FontWeight="Bold"  
                                         HorizontalAlignment="Left" Margin="5,5,15,5" /&gt;
                              &lt;StackPanel VerticalAlignment="Center"&gt;
                                  &lt;TextBlock Text="{Binding ClassName}" Foreground="Black" /&gt;
                                  &lt;TextBlock Text="{Binding DisplayName}" Foreground="Black" /&gt;
                              &lt;/StackPanel&gt;
                          &lt;/StackPanel&gt;
                      &lt;/DataTemplate&gt;
                  &lt;/ListBox.ItemTemplate&gt;
              &lt;/ListBox&gt;
  </code></pre>
  
  <p>the converter increments the value by 1. This works fine and I have debugged it to confirm the value being sent to the converter is ALWAYS 0.</p>
  
  <p>The crazy thing is this is only for ListBox or ListView</p>
  
  <p>as soon as I change it to an ItemsControl the indexing is correct but I don't want an items control, I want a list box with all the features that come with it.</p>
  
  <p>If you have any idea as to why this might be happening I'd be grateful for your help.</p>
  
  <p>Thanks</p>
  
  <p>Kieran</p>