DevExpress RepositoryItemComboBox无法显示组合框列表数据

时间:2016-12-16 06:42:31

标签: c# devexpress

我正在使用WCF服务中的gridControl.DataSource并将手动RepositoryItemComboBox添加到gridControl。但是RepositoryItemComboBox无法显示组合框列表数据。

这是我的代码:

gridControl8.DataSource = service.jadwalUmumStaff(data).Select(r => new
{
    hari = r.jadwal_umum.hari,
    shift = r.jadwal_umum.fk_jadwalUmum_Shift.id_shift,
    waktu = r.jadwal_umum.fk_jadwalUmum_Shift.waktu,
    mata_kuliah = r.jadwal_umum.fk_jadwalUmum_matakuliah.mata_kuliah,
    nama = r.staff.nama,
} ).ToList();

RepositoryItemComboBox nama = new RepositoryItemComboBox()
{
    TextEditStyle = TextEditStyles.DisableTextEditor,
    ShowDropDown = ShowDropDown.SingleClick
};

var a = service.getStaffID();
string[] _a = new string[a.Count()];
for (int i = 0; i < a.Count(); i++)
{
    _a[i] = a[i].id_staff;
}

nama.Items.AddRange(_a);
gridControl8.RepositoryItems.Add(nama);
gridView8.Columns[4].ColumnEdit = nama;
gridControl8.ForceInitialize();

1 个答案:

答案 0 :(得分:0)

您需要AllowDropDownWhenReadOnly并设置值true

遵循此代码:

RepositoryItemComboBox nama = new RepositoryItemComboBox()
{
    TextEditStyle = TextEditStyles.DisableTextEditor,
    AllowDropDownWhenReadOnly = DevExpress.Utils.DefaultBoolean.True
};