【发布时间】:2016-03-02 11:44:02
【问题描述】:
我正在使用以下代码禁用 XtraGrid GridView 中的复选框列(按预期工作)。从这篇帖子https://www.devexpress.com/Support/Center/Question/Details/Q423605得到代码:
private void GridViewWeeklyPlan_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e)
{
if (e.Column.FieldName == "Ignore")
{
CheckEditViewInfo viewInfo = ((GridCellInfo)e.Cell).ViewInfo as CheckEditViewInfo;
viewInfo.CheckInfo.State = DevExpress.Utils.Drawing.ObjectState.Disabled;
}
}
问题
我想在某个列更改并具有值时再次启用该复选框。这是我卡住的地方,我认为我可以在 GridView 的 CellValueChanged 事件中更改它,但我不知道如何引用该行的单元格/列:
private void GridViewWeeklyPlan_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
{
if (e.Column.FieldName != "Reason") return;
if (String.IsNullOrEmpty(e.Value.ToString()))
{
//Make sure the checkbox is disabled again
}
else
{
//Enable the checkbox to allow user to select it
}
}
【问题讨论】:
标签: devexpress devexpress-windows-ui