lundi 23 octobre 2017

Select a checkbox in a ListView with one click

in my WPF program, I have a ListView with a column with a checkbox:

    <ListView>
      <ListView.View>
        <GridView>
          <GridViewColumn Header="Checkbox-Column">            
            <GridViewColumn.CellTemplate>
              <DataTemplate>
                <Border BorderThickness="2" BorderBrush="AntiqueWhite">
                  <CheckBox IsChecked="{Binding Status}" />
                </Border>
              </DataTemplate>
            </GridViewColumn.CellTemplate>
          </GridViewColumn>
        </GridView>
      </ListView.View>
   </ListView>

When the user clicks on a checkbox, it should change it's state immediately. But actually, the user needs two clicks. The first click selects the row (or puts it into "edit-mode", though I'm not sure about this), and the second click then changes the checkbox state.

What can I do to force the checkbox to change with the first click?

Thanks in advance,
Frank




Aucun commentaire:

Enregistrer un commentaire