我目前正在测试DevExpress GridView组件的可能性。我已经创建了一个自定义数据映射,但是在更改行/单元格后似乎未触发e.IsSetData事件。
返回的对象总是像
DataRowModel {ID =“ SomeValue”,Properties = NULL};
非常感谢您的帮助。
请在下面找到网格逻辑和模型对象。
先谢谢了。 康斯坦丁
settings.CustomUnboundColumnData += (s, e) =>
{
var dynamicProperties = Model.DataRowModels[e.ListSourceRowIndex].Properties;
if (dynamicProperties != null)
{
var propertyIdString = e.Column.FieldName;
var currentValueColumn = dynamicProperties.SingleOrDefault(p => p.PropertyId.ToString().Equals(propertyIdString));
if (currentValueColumn != null)
{
if (e.IsGetData)
{
if (currentValueColumn == null)
{
return;
}
switch (currentValueColumn.RenderType)
{
case RenderType.String:
e.Value = currentValueColumn.StringValue;
break;
case RenderType.Integer:
e.Value = currentValueColumn.IntValue;
break;
case RenderType.Boolean:
e.Value = currentValueColumn.BooleanValue;
break;
case RenderType.DateTime:
e.Value = currentValueColumn.DateTimeValue;
break;
default:
e.Value = currentValueColumn.StringValue;
break;
}
}
if (e.IsSetData && e.Value != null)
{
currentValueColumn.StringValue = e.Value.ToString();
}
}
}
};
public class DataRowModel
{
public int Id{ get; set; } -----> The correct value
public List<DataProperty> Properties { get; set; } ------> This is always null
}