我用处理我的复选框单击事件CurrentCellDirtyStateChanged。当我点击包含复选框的单元格时,即我单击单元格时,选中该复选框并调用DirtyStateChanged,我希望能够处理同一个事件。使用下面的代码并没有多大帮助,它甚至不会调用当前的CellDirtyStateChanged的。我已经用完了想法。单击单元格时检查Datagridview复选框
private void dataGridView_CellClick(object sender, DataGridViewCellEventArgs e)
{
if(dataGridView.Columns[e.ColumnIndex].ReadOnly != true)
{
//option 1
(dataGridView.CurrentRow.Cells[e.ColumnIndex] as DataGridViewCheckBoxCell).Value = true;
//option 2
DataGridViewCheckBoxCell cbc = (dataGridView.CurrentRow.Cells[e.ColumnIndex] as DataGridViewCheckBoxCell);
cbc.Value = true;
//option 3
dataGridView.CurrentCell.Value = true;
}
}
这是XAML吗?这将是一个比[单元]和[检查]更好的问题标签 – DLeh 2015-04-01 20:51:15
为什么这个问题会得到一个负面投票? – Jnr 2015-04-03 11:34:05