This code give me an Argument out of Range exception. When I remove the binding to the SelectedIndex, the combobox is populated just fine and no exception is thrown.
Any Idea what I am doing wrong? Is this (for some reason) not possible?
public class RuleMap<T> : INotifyPropertyChanged
{
public ObservableCollection<string> Options
{
get{
return new ObservableCollection(){"A", "B", "C"};
}
}
public int SelectedIndex
{
get{
return 0;
}
}
}
public ObservableCollection<RuleMap> FilterItemSource;
<ItemsControl ItemsSource="{Binding FilterItemSource}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<ComboBox Width="150" SelectedIndex="{Binding SelectedIndex}" ItemsSource="{Binding Options}"/>
</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>