Adding background to Combobox

4 posts, 0 answers
  1. Erik
    Erik avatar
    80 posts
    Member since:
    Jul 2007

    Posted 14 Jul 2007 Link to this post

    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
  2. Georgi
    Admin
    Georgi avatar
    212 posts

    Posted 16 Jul 2007 Link to this post

    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
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Erik
    Erik avatar
    80 posts
    Member since:
    Jul 2007

    Posted 16 Jul 2007 Link to this post

    Hi,

    thanks for the reply. Then how to set the background?
    Thanks
  5. Georgi
    Admin
    Georgi avatar
    212 posts

    Posted 17 Jul 2007 Link to this post

    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
Back to Top