So my selectionChanged
event isn't firing when a user changes it but fires if I change it in code.
I'm using the selectionchanged
to get a selection from a combobox to fill another combobox.
<!--1st list -->
<ComboBox ItemsSource="{Binding djurKatList}" SelectedItem="{Binding SelectedDjurKat}" SelectionChanged="listKat_SelectionChanged" x:Name="listKat" HorizontalAlignment="Left" Margin="98,118,0,0" VerticalAlignment="Top" Width="120"/>
<!--2nd list that's filled after something is selected in 1st list-->
<ComboBox ItemsSource="{Binding djurArtList}" SelectedItem="{Binding SelectedDjurArt}" x:Name="listDjur" HorizontalAlignment="Left" Margin="98,154,0,0" VerticalAlignment="Top" Width="120"/>
In code behind this fills the 2nd combobox and isn't executing when I change the 1st combobox:
private void listKat_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
fyllDjurArtLista(hanterare, typeof(Daggdjur));
}
When I change the selection in code, selectionChanged
fires, here below I change my selected comboboxitem
, the event is fired and 2nd combobox gets filled.
var listItem = new ComboBoxItem { Content = "Välj kategori" };
SelectedDjurKat = listItem;