0
我需要將單元格編輯器更改爲ComboBox。我想要一個特定的單元格更改gridControl1中的組合框?C#Devexpress:GridControl添加Combobox
Check the desired functionality - Image
我需要將單元格編輯器更改爲ComboBox。我想要一個特定的單元格更改gridControl1中的組合框?C#Devexpress:GridControl添加Combobox
Check the desired functionality - Image
我建議你去通過文件 - Assigning Editors to Individual Cells
在運行時,您可以通過處理 GridView.CustomRowCellEdit(或LayoutView.CustomRowCellEdit) 事件指派編輯單個單元格。該事件對每個可見單元格動態發生,並允許您根據單元格(其列和行)的位置 向單個單元格提供編輯器。
例如:
using DevExpress.XtraGrid.Views.Grid;
private void gridView1_CustomRowCellEdit(object sender, CustomRowCellEditEventArgs e) {
if (e.Column.FieldName != "ShipCity") return;
GridView gv = sender as GridView;
string fieldValue = gv.GetRowCellValue(e.RowHandle,gv.Columns["ShipCountry"]).ToString();
switch (fieldValue) {
case "France":
e.RepositoryItem = repositoryItemComboBox1;
break;
case "USA":
e.RepositoryItem = repositoryItemComboBox2;
break;
}
}