下面的示例演示了如何在视图中创建一个列,并为它指派一个特定的编辑器。

C#CopyCode image复制代码
    using DevExpress.XtraGrid.Views.BandedGrid;
    using DevExpress.XtraEditors.Repository;
    //...
    BandedGridColumn col = advBandedGridView1.Columns.Add("Country") as BandedGridColumn;
    advBandedGridView1.Bands[0].Columns.Add(col);
    col.Visible = true;
    RepositoryItemLookUpEdit columnEditor = new RepositoryItemLookUpEdit();
    //customizing the column editor
    //...
    gridControl1.RepositoryItems.Add(columnEditor);
    col.ColumnEdit = columnEditor;

Visual BasicCopyCode image复制代码
    Imports DevExpress.XtraGrid.Views.BandedGrid
    Imports DevExpress.XtraEditors.Repository
    '...
    Dim col As BandedGridColumn = CType(AdvBandedGridView1.Columns.Add("Country"), _
      BandedGridColumn)
    AdvBandedGridView1.Bands(0).Columns().Add(col)
    col.Visible = True
    Dim columnEditor As RepositoryItemLookUpEdit = New RepositoryItemLookUpEdit
    'customizing the column editor
    '...
    GridControl1.RepositoryItems.Add(columnEditor)
    col.ColumnEdit = columnEditor