DataGridViewCheckBoxColumn: how to update bound DataSource on property changed instead of on validation

后端 未结 1 404
眼角桃花
眼角桃花 2020-12-20 19:02

I\'ve got a BindingList binded as the data source of a DataGridView; one of the TSource properties is binded to a DataGridViewCheckBoxColumn, but the data source is updated

相关标签:
1条回答
  • 2020-12-20 19:46

    You can do this by handling the CurrentCellDirtyStateChanged event of the DataGridView.

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