devexpress GridLookUpEdit into RepositoryItemGridLookUpEdit, or GridLookUpEdit into column cell

随声附和 提交于 2019-12-12 02:59:38

问题


I know I can set

//RepositoryItemGridLookUpEdit riglue eePozycje.gvView.Columns[KolNazwa].ColumnEdit = riglue;

but all I have is GridLookUpEdit. How can I set GridLookUpEdit into column cel, or transform GridLookUpEdit into RepositoryItemGridLookUpEdit ?

//DONE I found it in GridLookUpEdit.Properties.


回答1:


Refer the documentation

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)

I think you that 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. The event occurs dynamically for each visible cell and allows you to supply an editor to individual cells, based on the position of the cell (its column and row).

Refer this - Assigning Editors to Individual Cells

example:

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;
   }           
}

Hope this help.



来源:https://stackoverflow.com/questions/35772512/devexpress-gridlookupedit-into-repositoryitemgridlookupedit-or-gridlookupedit-i

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!