DevExpress ComboBoxEdit datasource

I am using DevExpress ComboBoxEdit and I need to bind list to its datasource. But as I can see there is no method to add datasource to control, so I added each item to control one by one like

foreach (var item in list) {
    comboBoxEdit1.Properties.Items.Add(item);
}

It worked for but it is slow if there is lot of data. Is there a way where I can bind list directly to control?

Answers


There is no way to bind the ComboBoxEdit directly to the datasource because the ComboBoxEdit is designed to be used when you need a simple predefined set of values. Use the LookUpEdit when you need to use a datasource. You can use the the ComboBoxItemCollection.BeginUpdate and ComboBoxItemCollection.EndUpdate methods to prevent excessive updates while changing the item collection:

ComboBoxItemCollection itemsCollection = comboBoxEdit1.Properties.Items;
itemsCollection.BeginUpdate();
try {
    foreach (var item in list) 
        itemsCollection.Add(item);
}
finally {
    itemsCollection.EndUpdate();
}

Need Your Help

Notepad++ Regular Expression Condition Replacement

regex conditional notepad++ replace

I have a set of SQL script that wants to change schema.

Custom Joomla component integration with Joomla com_user

integration joomla1.5 custom-component

I am creating a component where registered users will be able to use the features of my component.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.