devexpress textedit/mru 自动完成?

devexpress textedit/mru autocomplete?

是否可以设置 devexpress textedit 从数据库中获取数据并自动完成?或者 devexpress 中有什么工具可以做到这一点?

这是我的代码

string conn = ConfigurationManager.ConnectionStrings["SystemDatabase"].ConnectionString;                     
SqlConnection sqlconn = new SqlConnection(conn);                                               
SqlCommand mycommand = new SqlCommand("spProduct_Search", sqlconn);                  
mycommand.CommandType = CommandType.StoredProcedure;                                     
sqlconn.Open();                                                                             
 SqlDataReader sdr = mycommand.ExecuteReader();                                             
AutoCompleteStringCollection autotext = new AutoCompleteStringCollection();                        
while (sdr.Read())                                                                                     
{
    autotext.Add(sdr.GetString(0));
}                            
txtProductSearch.AutoCompleteMode = AutoCompleteMode.Suggest;**Textbox**
txtProductSearch.AutoCompleteSource = AutoCompleteSource.CustomSource;**Textbox**
txtProductSearch.AutoCompleteCustomSource = autotext;**Textbox**

如果可能,我想将 textbox 更改为 textedit 来自 devexpress 的工具,但我不知道如何制作 textedit 自动完成。

我相信您需要的是 LookUpEdit 控件,它是 AutoSuggest mode。根据文档,AutoSuggest 模式:

When a user types in text, the editor fires the AutoSuggest event (LookUpEdit.AutoSuggest \ GridLookUpEdit.AutoSuggest) that runs a custom asynchronous task (a System.Threading.Tasks.Task object). This task performs a search against the given data set, and returns the ICollection object with records that match the entered text. This collection is automatically assigned to the editor's DataSource and its entries appear in the editor drop-down menu.

在此异步事件期间,您可以执行数据库查询并使用结果集填充 ICollection。