首页 > 解决方案 > 如何在 Devexpress 的 ComboBoxEdit 中选择项目

问题描述

在下面的代码中,我需要选择 Item in ComboBoxEditwith idFunc

我怎样才能做到这一点?

ComboBoxItemCollection coll = cbFunction.Properties.Items;
coll.BeginUpdate();

coll.Add("  ... select function ...  ");

foreach (var item in lstFuncCB)
{
    cbFunction.Properties.Items.Add(new ImageComboBoxItem(item.FuncName, item.idFunc));
}

coll.EndUpdate();

标签: winformsselectdevexpress

解决方案


您只需将 ComboBoxEdit 控件的 EditValue 属性设置为您希望选择的 item.idFunc 值。

cbFunction.EditValue = lstFuncCb[3].idFunc;

推荐阅读