也许是这样的:
List<MyClass> mylist = new List<MyClass>();
mylist.Add(new MyClass() { TheName = "Kirk", TheAge = 56 });
mylist.Add(new MyClass() { TheName = "Spock", TheAge = 403 });
mygrid.DataSource = mylist;
mygrid.MainView.PopulateColumns();
List<OtherClass> all_names = new List<OtherClass>();
在此处添加现有名称:
foreach (var item in mylist)
all_names.Add( new OtherClass() { OtherName = item.TheName } );
继续使用其他名称:
all_names.Add(new OtherClass() { OtherName = "Watson" });
all_names.Add(new OtherClass() { OtherName = "Sherlock" });
通过设计器创建 repositoryItemLookUpEdit1
repositoryItemLookUpEdit1.DataSource = all_names;
repositoryItemLookUpEdit1.DisplayMember = "OtherName";
repositoryItemLookUpEdit1.ValueMember = "OtherName";
((DevExpress.XtraGrid.Views.Base.ColumnView)mygrid.MainView).Columns[0].ColumnEdit = repositoryItemLookUpEdit1;
你的数据应该没问题