samedi 17 janvier 2015

Binding of a check box doesn't transport the values to the model

I've created a list of check boxes and bound them as shown below.



<ListBox ItemsSource="{Binding AllCarrierTypes}">
<ListBox.ItemTemplate>
<DataTemplate>
<CheckBox Content="{Binding Name}"
IsChecked="{Binding Active,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
Checked="ToggleButton_OnChecked"
Unchecked="ToggleButton_OnUnchecked"/>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>


However, when I breakpoint on the unchecked event and see the contents of AllCarrierTypes, using Where() to only get the actives, I see that the list stays the same, despite the fact that those small thingies in the GUI actually are on and off. What can I do to troubleshoot it? According to the things I've read and seen, it supposed to work, so it's likely something stupid I've forgotten...





Aucun commentaire:

Enregistrer un commentaire