This is a migrated thread and some comments may be shown as answers.

Adding background to Combobox

3 Answers 147 Views
ComboBox and ListBox (obsolete as of Q2 2010)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Erik
Top achievements
Rank 1
Erik asked on 14 Jul 2007, 04:45 PM
Hi,

I try to add background to combo box by setting the background image.
But I didnt get what i want. The background was showing. How to set the background image?

Secondly, is it possible to add item image to combo box bounded to database?


thanks

3 Answers, 1 is accepted

Sort by
0
Georgi
Telerik team
answered on 16 Jul 2007, 08:08 PM
Hi eriksurya,

Although the BackGroundImage property is accessible, it is unfortunately inherited from System.Windows.Forms.Control and does not apply to RadComboBox.

As to the your second question, if I understand correctly your goal is to add an image to every item that is shown in the drop-down window. Such case is demonstrated in the "Music Collection" example of the RadComboBox. In this example an image list control is used and the corresponding image index is retrieved from the data source. Then on the RadComboBox.ItemDataBound event the images are loaded in the items:
 
void cmbArtist_ItemDataBound(object sender, ItemDataBoundeventArgs e)          
{              
    RadComboBoxItem item = e.DataBoundItem as RadComboBoxItem;  
    item.TextImageRelation = TextImageRelation.ImageBeforeText;              
    PropertyDescriptor desc = TypeDescriptor.GetProperties(e.DataItem).Find("ImageIndex"false);              
    item.ImageIndex = (int)desc.GetValue(e.DataItem);          

I hope this helps!
 

All the best,
Georgi
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Erik
Top achievements
Rank 1
answered on 17 Jul 2007, 04:18 AM
Hi,

thanks for the reply. Then how to set the background?
Thanks
0
Georgi
Telerik team
answered on 17 Jul 2007, 05:17 PM
Hello eriksurya,

Only the background color of the textbox part of the RadComboBox can be changed. This can be done in the theme using the Visual Style Builder, where you can set the RadTextBoxItem.BackColor property to the desired color.
 

All the best,
Georgi
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
ComboBox and ListBox (obsolete as of Q2 2010)
Asked by
Erik
Top achievements
Rank 1
Answers by
Georgi
Telerik team
Erik
Top achievements
Rank 1
Share this question
or