如果希望不存在时显示空,可以处理CellFormating事件
- this.gcMultiRow1.CellFormatting += GcMultiRow1_CellFormatting;
- private void GcMultiRow1_CellFormatting(object sender, CellFormattingEventArgs e)
- {
- if(e.CellName == "combo") // 注意把这个名字换成模板里,ComboBox的名字
- {
- var comboBox = this.gcMultiRow1[e.RowIndex, e.CellIndex] as ComboBoxCell;
- if(!comboBox.Items.Contains(e.Value))
- {
- e.Value = null;
- }
- }
- }
复制代码 |