When trying to set a ComboBox SelectedIndex to 0 so I have the first value as default, doesn’t work, the combobox its empty by default. If I try setting it to any other number it works, I have the selected index as a default value.
Anyone have an idea why I can’t set it to 0 from xaml ?
<RSControls:SmoothScrollComboBox
Grid.Column="1"
x:Name="comboTypes"
Margin="7,0,0,0"
SelectedValue="{Binding Path=SelectedTypes}"
SelectedValuePath="Name"
SelectedIndex="0"
ItemsSource="{Binding Source={StaticResource GroupedTypes}}"
DisplayMemberPath="Display"
SelectionChanged="comboTypes_SelectionChanged"
IsSynchronizedWithCurrentItem="True">
PS: forgot to mention that I have 2 comboboxes, the other one works, implemented in the same way, only the Selectedvalue and ItemSource differs.
It’s probably because you are setting the selected item twice: once with
SelectedIndexand once withSelectedValueRemove the
SelectedValueproperty andSelectedIndexshould work