I had a problem when my combobox loses the value of SelectedIndex when closing UserControl. The ViewModel still has this, but the view continues to reset it to -1. I understand that there is a problem with the binding order of ItemSource and SelectedIndex, but I am not binding directly to ItemSource. Basically, I'm trying to figure out the correct syntax for the binding below.
</ComboBox.ItemTemplate> <ComboBox.ItemsSource> <CompositeCollection> <ComboBoxItem IsEnabled="False">Select a database connection...</ComboBoxItem> <CollectionContainer Collection="{Binding Source={StaticResource ConnectionsBridge}}" /> <ComboBoxItem><New...></ComboBoxItem> </CompositeCollection> </ComboBox.ItemsSource> **<ComboBox.SelectedIndex> <Binding Path="SelectedConnectionIndex"/> </ComboBox.SelectedIndex>** </ComboBox>
source share