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

Alternating background color?

1 Answer 104 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.
Gary
Top achievements
Rank 1
Gary asked on 24 Nov 2008, 05:46 PM
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

1 Answer, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 27 Nov 2008, 10:57 AM
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.
Tags
ComboBox and ListBox (obsolete as of Q2 2010)
Asked by
Gary
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
Share this question
or