I have a DataGrid with first column as text column and second column as CheckBox column. What I want is, if I click the check box. It should get checked.
But, it takes two click to get selected, for first click the cell is getting selected, for the second clicks the check box is getting checked. How to make the check box to get checked/unchecked with a single click.
I'm using WPF 4.0. Columns in the DataGrid are AutoGenerated.
For single click DataGrid checkbox you can just put regular checkbox control inside DataGridTemplateColumn
and set UpdateSourceTrigger=PropertyChanged
.
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<CheckBox IsChecked="{Binding Path=IsSelected, UpdateSourceTrigger=PropertyChanged}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>