I use a datagrid with a checkboxcolumn in c# 4.0. I right now I need 2 clicks to change the state of a checkbox if I enable row selection.
One click selects the row and the second changes the state of the checkbox. How can I enable row selection, but keep the 1 click for changing the state of the checkboxcolumn?
<DataGrid AutoGenerateColumns="False"
SelectionMode="Single" SelectionUnit="CellOrRowHeader"
ItemsSource="{Binding}"
Height="200" HorizontalAlignment="Left" Margin="28,43,0,0"
Name="gridPersons" VerticalAlignment="Top" Width="292" >
<DataGrid.Columns>
<DataGridTextColumn Header="Name" Width="SizeToCells" MinWidth="150"
Binding="{Binding Name}"
IsReadOnly="True"/>
<DataGridCheckBoxColumn Header="Selected" Width="SizeToCells" MinWidth="100"
Binding="{Binding IsSelected}"
IsReadOnly="false"/>
</DataGrid.Columns>
</DataGrid>