|
I'm in the process of swapping out our System.Windows.Forms.ListBox controls with DevExpress.XtraEditors.ListBoxControl controls and I've ran into a snag with the databinding. From what I can tell there is no IdeaBlade data binder for the DevExpress ListBoxControl. I searched through the forums and couldn't find any information so I'm writing to ask for advice.
The form I'm working with has two list box controls on it with some buttons in between that allow the user to move items from one list box to the other. The simplified code for databinding looks like this:
private void doBinding() { DevExpress.XtraEditors.ListBoxControl availableFieldsListBox = new DevExpress.XtraEditors.ListBoxControl(); DevExpress.XtraEditors.ListBoxControl fieldsToClearListBox = new DevExpress.XtraEditors.ListBoxControl();
BindableList<SomeObject.SomeField>() arrLeft = new BindableList<SomeObject.SomeField>(); BindableList<SomeObject.SomeField>() arrRight = new BindableList<SomeObject.SomeField>(); BindableList<SomeObject.SomeField> fieldList = new BindableList<SomeObject.SomeField>();
ControlBindingManager ctrlBM = new ControlBindingManager(fieldList);
ctrlBM.Descriptors.Add(availableFieldsListBox, "Description", fieldListConverter(fieldList, arrLeft)); ctrlBM.Descriptors.Add(fieldsToClearListBox, "Description", fieldListConverter(fieldList, arrRight)); }
private ListConverter fieldListConverter(BindableList<SomeObject.SomeField> pDatasource, BindableList<SomeObject.SomeField> pArr) { ListConverter listConverter = new ListConverter(pDatasource, Editability.Optional, true, "Description", "Code"); listConverter.SetList(pArr); return listConverter; } |
The application compiles fine, but when I run it I get the following exception:
System.NotSupportedException: Could not locate a suitable binder for a ListBoxControl. Are you missing an assembly reference?
All of our other DevExpress controls bind without errors. So i'm wondering, what do I have to do to get this to work like it did with the Windows.Forms listbox, or is that possible?
Thanks,
Mark Harmon
|