【C#】【DevExpress】获取当前单元格类型
1 private void gridView1_ShownEditor(object sender, System.EventArgs e) { 2 GridView gridView = sender as GridView; 3 if (gridView != null && gridView.ActiveEditor != null) { 4 object activeEditor = gridView.ActiveEditor; 5 if (activeEditor is TextEditEditor) { 6 // 文本编辑器 7 } else if (activeEditor is DateEditEditor) { 8 // 日期编辑器 9 } else if (activeEditor is RepositoryItemComboBox) { 10 // 下拉列表编辑器 11 RepositoryItemComboBox comboBox = activeEditor as RepositoryItemComboBox; 12 Type itemType = comboBox.Items[comboBox.SelectedIndex].GetType(); 13 // 获取下拉列表选中项的类型 14 } 15 // 更多类型检查... PictureEdit 图片类型 16 } 17 }
有志者,事竟成,破釜沉舟,百二秦关终属楚; 苦心人,天不负,卧薪尝胆,三千越甲可吞吴。