DataGridView with CheckBox cell problem

后端 未结 2 1241
野趣味
野趣味 2020-12-18 01:14

I have a DataGridView with a DataGridViewCheckBoxColumn column, which is databound to a list. The problem is that the databound boolean property for this checkbox is updated

相关标签:
2条回答
  • 2020-12-18 01:46

    take a look at Binding.UpdateSourceTrigger Property

    http://msdn.microsoft.com/en-us/library/system.windows.data.binding.updatesourcetrigger(VS.95).aspx

    0 讨论(0)
  • 2020-12-18 02:10

    You can listen for the CurrentCellDirtyStateChanged event and force Commit the change:

    void dataGridView1_CurrentCellDirtyStateChanged(object sender,
        EventArgs e)
    {
        if (dataGridView1.IsCurrentCellDirty)
        {
            dataGridView1.CommitEdit(DataGridViewDataErrorContexts.Commit);
        }
    }
    
    0 讨论(0)
提交回复
热议问题