2

我的网格看起来像这样。

Key Value
1    A
2    B
3    C

我的网格中有只读值列。“值”列的 columnedit 与 memoexedit 存储库相关联。现在我想做的是在某些情况下,比如当 key=2 时,我希望我的值单元格是可编辑的。

我尝试将整个列设为 ReadOnly = false。

然后处理 ShowingEditor 以取消对 Key=2 以外的所有内容的编辑,但这甚至阻止了打开编辑器以获取其他值。

我想要的是能够看到编辑器,但它应该是只读的 Others 和 Key=2,它应该是可编辑的。

请帮忙!

4

1 回答 1

3

尝试按如下方式处理 ShownEditor 事件(半伪代码):

var grid = sender as GridView;
if (grid.FocusedColumn.FieldName == "Value") {
    var row = grid.GetRow(grid.FocusedRowHandle) as // your model;
    // note that previous line should be different in case of for example a DataTable datasource
    grid.ActiveEditor.Properties.ReadOnly = // your condition based on the current row object
}

通过这种方式,您可以根据需要优化已经打开的编辑器。

于 2013-06-21T21:39:00.777 回答