devexpress GridLookUpEdit 进入 RepositoryItemGridLookUpEdit,或 GridLookUpEdit 进入列单元格
devexpress GridLookUpEdit into RepositoryItemGridLookUpEdit, or GridLookUpEdit into column cell
我知道我可以设置
//RepositoryItemGridLookUpEdit riglue
eePozycje.gvView.Columns[KolNazwa].ColumnEdit = riglue;
但我只有 GridLookUpEdit。
如何将 GridLookUpEdit 设置为列 cel,或将 GridLookUpEdit 转换为 RepositoryItemGridLookUpEdit?
//完成
我在 GridLookUpEdit.Properties.
中找到了它
The RepositoryItemLookUpEdit class contains settings specific to the
GridLookUpEdit control. You can access these settings via the editor's
GridLookUpEdit.Properties object. See the GridLookUpEdit topic for
details on the control.
You need to create repository items as standalone objects only to
specify inplace editors for container controls (such as the XtraGrid,
XtraTreeList, etc)
我认为你How to Assign Editors for In-Place Editing. Now If you want to set editors in particular cell then you have to handle the GridView.CustomRowCellEdit。该事件针对每个可见单元格动态发生,并允许您根据单元格的位置(其列和行)为各个单元格提供编辑器。
参考这个- Assigning Editors to Individual Cells
示例:
using DevExpress.XtraGrid.Views.Grid;
private void gridView1_CustomRowCellEdit(object sender, CustomRowCellEditEventArgs e) {
if (e.Column.FieldName == "FieldName") return;
GridView gv = sender as GridView;
string fieldName = gv.GetRowCellValue(e.RowHandle, gv.Columns["FieldName"]).ToString();
switch (fieldName) {
case "Population":
e.RepositoryItem = repositoryItemSpinEdit1;
break;
case "Country":
e.RepositoryItem = repositoryItemComboBox1;
break;
case "Capital":
e.RepositoryItem = repositoryItemCheckEdit1;
break;
}
}
希望对您有所帮助。
我知道我可以设置
//RepositoryItemGridLookUpEdit riglue
eePozycje.gvView.Columns[KolNazwa].ColumnEdit = riglue;
但我只有 GridLookUpEdit。 如何将 GridLookUpEdit 设置为列 cel,或将 GridLookUpEdit 转换为 RepositoryItemGridLookUpEdit?
//完成 我在 GridLookUpEdit.Properties.
中找到了它The RepositoryItemLookUpEdit class contains settings specific to the GridLookUpEdit control. You can access these settings via the editor's GridLookUpEdit.Properties object. See the GridLookUpEdit topic for details on the control.
You need to create repository items as standalone objects only to specify inplace editors for container controls (such as the XtraGrid, XtraTreeList, etc)
我认为你How to Assign Editors for In-Place Editing. Now If you want to set editors in particular cell then you have to handle the GridView.CustomRowCellEdit。该事件针对每个可见单元格动态发生,并允许您根据单元格的位置(其列和行)为各个单元格提供编辑器。
参考这个- Assigning Editors to Individual Cells
示例:
using DevExpress.XtraGrid.Views.Grid;
private void gridView1_CustomRowCellEdit(object sender, CustomRowCellEditEventArgs e) {
if (e.Column.FieldName == "FieldName") return;
GridView gv = sender as GridView;
string fieldName = gv.GetRowCellValue(e.RowHandle, gv.Columns["FieldName"]).ToString();
switch (fieldName) {
case "Population":
e.RepositoryItem = repositoryItemSpinEdit1;
break;
case "Country":
e.RepositoryItem = repositoryItemComboBox1;
break;
case "Capital":
e.RepositoryItem = repositoryItemCheckEdit1;
break;
}
}
希望对您有所帮助。