vendredi 21 juillet 2017

Command attached to a CheckBox style column in a ListBox - does not work

I have a Command attached to a CheckBox style column in a ListBox. I would like the command to be fired whenever a Checkbox is checked or unchecked. Unfortunately nothing happens. Here is a part of the XAML:

<Grid>
    <ListBox ItemsSource="{Binding KeysWithCheckBoxes}" >
        <ListBox.ItemTemplate>
            <HierarchicalDataTemplate>
                <CheckBox Content="{Binding KeyName}" IsChecked="{Binding IsChecked, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" 
                          Command="{Binding CatchSelectedKeys, RelativeSource={RelativeSource Mode=Self}}"  />
            </HierarchicalDataTemplate>
        </ListBox.ItemTemplate>
    </ListBox>

</Grid>

What is wrong? How should it be?




Aucun commentaire:

Enregistrer un commentaire