Hi,
I would like to style the combobox dropdown in different colors (like windows do):
a) white background, when the combo is a comboeditor (dropdown)
b) grey background, when the combo is a combobox (dropdownlist)
How can I achieve this? Didn't get it work with AppStylist.
Different style resources exist, how can I apply this at runtime?
Hello Michael,
Thank you for posting in our forum.
You are on the right way. As long as you have created different style resources in your style library you need only to tell to each drop down which resource to use. You can achieve this by using code like this:
foreach (ToolBase tool in this.ultraToolbarsManager1.Tools)
{
// get all ComboBoxTool
var comboTool = tool as ComboBoxTool;
if (comboTool != null)
// set the style library to be used
comboTool.ValueList.Appearance.StyleLibraryName = "MyStyleLib";
// check the DropDownStyle and set accordingly the style resource
if (comboTool.DropDownStyle == DropDownStyle.DropDown)
comboTool.ValueList.Appearance.StyleResourceName = "DropDown";
}
if (comboTool.DropDownStyle == DropDownStyle.DropDownList)
comboTool.ValueList.Appearance.StyleResourceName = "DropDownList";
In the attached sample project I have implement this approach. Please check my sample and let me know if you need any additional information.
Thank you for using Infragistics Controls.
Thanks for the quick answer and the example!
But I was looking for a way to change the StyleSet for the whole comboeditor control.
Like I do this for the normal comboeditor: The end result is an other background of the textarea of the comboeditor, not the valuelist.
I tried to find the right property, but it didn't work...
Here the code I use for the normal comboeditor
if (control is UltraComboEditor) {
if (editor.DropDownStyle == Infragistics.Win.DropDownStyle.DropDownList)
{ if (!editor.StyleSetName.Equals(_dropDownStyle, StringComparison.Ordinal)) { editor.StyleSetName = _dropDownStyle; } }
The whole bunch of appearance properties confuses me.