解决
在这里我使用的是 GridControl 的 BandedGridView 视图, 所以在获取数据源的时候, 手动调用一下视图的 PostEditor() 即可.
- private void ButtonA_Click(object sender,EventArgs e)
- {
- bandedGridView1.PostEditor();
- if(gricControl1.DataSource is BindingList items)
- {
- var checkedItems = item.Where(x=>x.IsUpdate);
- }
- }
关于 PostEditor() 方法的解释:
posts the value to the associated data source but doesn't close the active in-place editor.
来源: https://www.2cto.com/kf/201905/809331.html