Can anyone explain开发者_如何学Python, how to simply put values from a DataTable in DevExpress comboBoxEdit Items? In WinForms it was simply like this:
dtCat = SqlHelper.GetTable("base_UserCategory_Select", new string[] {});
DataRow dr = dtCat.NewRow();
dr["UserCategoryID"] = 0;
dr["CategoryName"] = "< All >";
dr["IsSystem"] = "False";
dtCat.Rows.InsertAt(dr, 0);
comboBox1.DataSource = dtCat;
How to assign values to a DevExpress comboBoxEdit like this?
DataTable dtCat = SqlHelper.GetTable("base_UserCategory_Select", new string[] { });
DataRow dr = dtCat.NewRow();
dr["UserCategoryID"] = 0;
dr["CategoryName"] = "< All >";
dtCat.Rows.InsertAt(dr, 0);
comboBoxEdit1.ItemsSource = dtCat.DefaultView;
comboBoxEdit1.SelectedIndex = 1;
I would recommend using a LookupEdit control instead, in conjunction with the DataSource, DisplayMember and ValueMember properties. The ComboBoxEdit control does not have an ItemsSource property.
精彩评论