Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make a DataGridCheckBoxColumn editable without requiring extra clicks?

WPF's DataGrid requires a double click to enter cell editing mode, and then the user can change the checkbox value.

How to make a cell editable without requiring the double click for entering the edit mode?

like image 316
Jader Dias Avatar asked Mar 01 '12 16:03

Jader Dias


1 Answers

Just think of using a CheckBox directly in your CellTemplate.

<DataGridTemplateColumn Header="Your boolean column">
  <DataGridTemplateColumn.CellTemplate>
      <DataTemplate>
          <CheckBox IsChecked="{Binding YourBooleanProperty, UpdateSourceTrigger=PropertyChanged}" />
      </DataTemplate>
  </DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
like image 79
Markus Avatar answered Nov 15 '22 23:11

Markus