We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

comboBoxAdv: images when using data-binding

Thread ID:

Created:

Updated:

Platform:

Replies:

109566 Jun 20,2013 05:24 AM UTC Jun 26,2013 06:26 AM UTC WinForms 3
loading
Tags: Tools
Philipp Gruber
Asked On June 20, 2013 05:24 AM UTC

Hello,

I use a comboBoxAdv and fill it with data via data-binding:

BindingSource source = GetMySource();
comboBoxAdv1.DataSource = source;

This works fine but I like to show a image/icon in front of each element.
In the designer I set the "ImageList" property of the comboBox to an imageList with the images. I also set the "ShowImageInTextBox" and "ShowImagesInComboListBox" properties to true.

When I set the "ImageIndexes" of the comboBox items

comboBoxAdv1.ImageIndexes[index] = 0;

the image isn't shown. 
What do I have to do to show the images?

I found this post
where the answer to my question is a link to a sample. But unfortunately this is a dead link.

Thanks,
Phil


Paul Anderson S [Syncfusion]
Replied On June 24, 2013 05:45 AM UTC

Hi Phil,

Thanks for your interest in syncfusion products.

We have created a sample to achieve your requirement which is available in the below link.

Sample:http://www.syncfusion.com/downloads/Support/DirectTrac/107192/WindowsFormsApplication421406103487.zip


Please have the sample and let us know if you have any concerns.

Regards,
Paul Anderson S

Philipp Gruber
Replied On June 24, 2013 12:13 PM UTC

Hi Paul,

Thanks for your reply.

I had a look at the sample code but unfortunately it does not work 100% for me.

I use the comboBoxAdv control in a master-slave scenario where the combo box is the slave and gets filled dynamically (the bound data-source changes) depending on the selection in the master control.
The code-sample sets the images during the Load event handling, so it is set only one time before the form is displayed and when my data-source changes the icons are not displayed any longer. 
When I try to use the init code:
((System.ComponentModel.ISupportInitialize)(m_SourceComboBox)).BeginInit();
comboBoxAdv1.ItemsImageIndexes.Add(new ComboBoxAdv.ImageIndexItem(comboBoxAdv1"XYZ", 1));
((System.ComponentModel.ISupportInitialize)(m_SourceComboBox)).EndInit();
 in a corresponding event-handler (e.g masterControl.SelectedItemChanged) that the icons are updated each time the source of the comboBoxAdv changes it doesn't work.
Is there any change to set the images in a way that it fits into my scenario?

Thanks,
Phil

Paul Anderson S [Syncfusion]
Replied On June 26, 2013 06:26 AM UTC

Hi Phil,

Thanks for the update.

When you insert a row and update the datasource it is needed to reinitialize the images to the corresponding rows. Please have the sample according to your requirement from the below link.

Sample:http://www.syncfusion.com/downloads/Support/DirectTrac/108937/WindowsFormsApplication42-2101533815.zip

If we misunderstood your query please provide some additional information along with a sample so we can provide a better solution.
Please let us know if you have any concerns.

Regards,
Paul Anderson S

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;