Alternating background color?

2 posts, 0 answers
  1. Gary
    Gary avatar
    4 posts
    Member since:
    Nov 2008

    Posted 24 Nov 2008 Link to this post

    Hello,

    I need to have the background of the drop down portion of my combobox have alternating colors. I can accomplish this with an event handler for the ItemDataBound event and a simple counter like this:

    private void radComboBox1_ItemDataBound(object sender, Telerik.WinControls.UI.ItemDataBoundEventArgs e) 
    i++; 
     
    FillPrimitive fpOneDropDownItem = (e.DataBoundItem.Children[0] as FillPrimitive); 
    fpOneDropDownItem.BackColor = (i % 2 == 0) ? ColorTranslator.FromHtml("#000000") : ColorTranslator.FromHtml("#262626"); 
    fpOneDropDownItem.NumberOfColors = 1
     

    I would like to get this behavior using a theme. Is it possible? I see there is an IsOdd property on the grid, is there something similar for the combobox?

    Thanks,

    -Gary
  2. Nikolay
    Admin
    Nikolay avatar
    1804 posts

    Posted 27 Nov 2008 Link to this post

    Hi Gary,

    Thank you for the question.

    Currently, the IsOdd property is only available for the RadGridView's GridRowElement. RadComboBoxItem (RadListBoxItem) does not support this feature, and it is not possible to achieve the desired behavior either by code or by using a theme. I have logged this request in our ToDo list and we will try to include this functionality in one of the future releases.

    If you have additional questions, feel free to contact me.

    Kind regards,
    Nikolay
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top