【发布时间】:2017-01-28 00:08:47
【问题描述】:
处理时如何获取当前编辑的值:
public class GridEX // ...
{
// ...
public event ColumnActionEventHandler CellValueChanged;
// ...
};
尝试使用以下方法获取值:
GridEXCell valueChangedCell = _gridView.CurrentRow.Cells[<desired_column_index>];
object rawValue = valueChangedCell.Value;
// or even with
string rawValue = valueChangedCell.Text;
valueChangedCell 的值发生更改的唯一时刻是触发 CellUpdated 或 UpdatingCell 事件时。但是后两者仅在用户将键盘输入焦点更改到另一个单元格的情况下才会触发,这可能是为了应用已编辑单元格的新值。我要查找其值的单元格是一个仅包含一个复选框的单元格。我想在给定单元格的复选框切换后立即执行给定操作,而不是在用户更改焦点后立即执行,例如移动到表格中的另一个单元格。看到在事件的描述中提到了一些行缓冲区:
[Description("Occurs after changes in a cell are copied into the row's buffer.")]
public event ColumnActionEventHandler CellUpdated;
[Description("Occurs before updating the changes in a cell to the row's buffer")]
public event UpdatingCellEventHandler UpdatingCell;
我认为复选框的当前值可能保存在某个缓冲区中,并且在更改焦点后,新值将应用于单元格。
任何想法如何在处理 Janus 的GridEX.CellValueChanged 时获取复选框的当前设置值?
【问题讨论】: