title: WPF - Binding to an ItemsSource AND SelectedIndex throws exception?
body: <p>This code gives me an “Argument out of range” exception. When I remove the binding to the <code>SelectedIndex</code>, the <code>ComboBox</code> is populated just fine and no exception is thrown. </p>
  
  <p>Any idea what I am doing wrong? Is this (for some reason) not possible?</p>
  
  <p>Code:</p>
  
  
  
  <pre><code>public class RuleMap&lt;T&gt; : INotifyPropertyChanged
  {
      public ObservableCollection&lt;string&gt; Options
      {
          get
          {
              return new ObservableCollection(){"A", "B", "C"};
          }
      }
  
      public int SelectedIndex
      {
          get
          {
              return 0;
          }
      }
  }
  
  public ObservableCollection&lt;RuleMap&gt; FilterItemSource;
  </code></pre>
  
  <p>XAML:</p>
  
  
  
  <pre><code>&lt;ItemsControl ItemsSource="{Binding FilterItemSource}"&gt;
      &lt;ItemsControl.ItemTemplate&gt;
          &lt;DataTemplate&gt;
              &lt;StackPanel Orientation="Horizontal"&gt;                                 &lt;ComboBox Width="150" SelectedIndex="{Binding SelectedIndex}"
                            ItemsSource="{Binding Options}"/&gt;
              &lt;/StackPanel&gt;
          &lt;/DataTemplate&gt;
      &lt;/ItemsControl.ItemTemplate&gt;
  &lt;/ItemsControl&gt;
  </code></pre>