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

How can I change background color?

11 Answers 388 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Happy
Top achievements
Rank 1
Happy asked on 26 Aug 2009, 05:42 PM
without messing with themes? And for every combobox I'll place in my app?

I'm currently using the OfficeBlack theme. I have data entry forms with MS textboxes and Telerik comboboxes and your editable comboboxes are rendering with a gray background.

I made my own ComboBox box class to inherit from yours and I'm handling the loaded event and changing the Background to white but it's having no effect.

11 Answers, 1 is accepted

Sort by
0
Valeri Hristov
Telerik team
answered on 27 Aug 2009, 03:38 PM
Hi Happy,

I am affraid that with the current version of RadComboBox this cannot be done without creating a custom theme, which is easier than it seems - you need to create just one style with a new control template. Please, let me know if you example and we will gladly provide one.

Best wishes,
Valeri Hristov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Happy
Top achievements
Rank 1
answered on 27 Aug 2009, 03:49 PM
The issue isn't about how easy it is to change a theme. The problem with changing a theme is that I now basically risk forward compatability with future versions and then I'll need to reapply my custom changes over and over again. If the only way to fix my problem is to apply a custom theme, then yes an example of the bare minimum to just change the background color to white would be appreciated.

I don't see a Telerik TextBox control so I use the MS one which has a white background. Is there a reason that Telerik thinks the combobox should have a different background color?
0
Valeri Hristov
Telerik team
answered on 28 Aug 2009, 12:26 PM
Hi Happy,

The RadComboBox background is white in Office_Black when IsEditable = true. It turns gray when IsReadOnly=true, the same way as the standard TextBox. Am I missing something?

I will check what we can do about the background - the problem is that RadComboBox is much more complex than a TextBox and it is not obvious which color should be affected by the Background property - the editable mode TextBox background, the items background when they are not selected or selected, in non-editable mode we should choose other element to set its background, because there is no TextBox, etc. I will be glad to hear your feedback about this problem.

Sincerely yours,
Valeri Hristov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Happy
Top achievements
Rank 1
answered on 28 Aug 2009, 12:45 PM
In my case, the IsReadOnly on my combobox is false. I can't type into it, but I can drop it down to choose another value. Also, I  have a form with some readonly textboxes and editable combboxes and the combobox gray is not the same as the textbox's readonly gray. The RadComboBox is rendering with a gradient gray background.

I just did a test and I forced my combobox to be readonly, but it still renders the same and I can dropdown it down to change values. IsReadOnly doesn't even seem to work for me.

Ultimately, what I would love to accomplish is have the combobox have a white background when editable and the same solid gray background when readonly as readonly textboxes AND also not even show the drop down arrow when readonly. I would like a readonly combobox to render EXACTLY like a readonly textbox.
0
Happy
Top achievements
Rank 1
answered on 28 Aug 2009, 12:57 PM
I see I missed one key difference, you said IsEditable.  Yes, I have this set to false, but that's the default! I set this to true and now it renders with a white background. But I can't have that. The user is choosing from a list of enums.

My opinion is that 

1)  IsReadonly=true should render just like a textbox and the user can't type and can't dropdown either
2) IsReadonly=false, should always have a white background regardless of whether they can type or not. If it's grayed out, the user may not even know they can type into it for auto complete.

0
Valeri Hristov
Telerik team
answered on 28 Aug 2009, 01:40 PM
I understand now. I suppose that the only solution in your case is a custom theme. Generally we try to keep the templates as backwards compatible as possible, we change them drastically only when a complete control rewrite was made. On the other hand, RadComboBox control template is simple enough and most probably your custom theme will be future proof, even if we change the control code.

Regarding the IsReadOnly property - we want to keep its behavior the same as the standard WPF ComboBox where it affects the control only when IsEditable = true and the only change is, that it makes the TextBox inside the combo read-only. The idea is that if you want to prevent the user from selection, you should set IsEnabled = false and this will render the control it "completely read-only".

Greetings,
Valeri Hristov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Happy
Top achievements
Rank 1
answered on 28 Aug 2009, 01:59 PM
I don't consider the ComboBox theme is simple enough. Looks like it shares with datepicker, etc. BTW, I don't see an Office_Black theme folder in the Q2 2009 directory. So I looked into OfficeSilver and the combox theme is quite long. Do I really need to copy all that just to change some colors?

Regarding IsReadOnly, IsEditable, IsEnabled, etc, my opinion is that the microsoft way has always been a mess. Not consistent. Every project, every client wants something consistent. Either a form is editable or it's not. In a winform app (NOT WPF), the combobox has a dropdown mode where they must choose a value in the list and it renders white. In the end, even if the textbox part of the combobox is readonly, ultimately, the comboxbox itself is NOT. IMO, there should be a seperate IsTextEditorReadOnly property to distinguish that part of the overall control.

The problem with using IsEnabled to essentially turn off the RadComboBox is that now the text is also grayed out making it harder to read. Also the user can no longer highlight the contents to copy into the clipboard. So using IsEnabled as a replacement for what IMO is a flawed IsReadOnly doesn't work. Clients want clean consistent readonly forms but that the user can still copy values out of. I don't see how to achieve that.

I think you should reconsider and improve upon what I consider to be a flawed MS WPF standard. Or at least add a feature to be able to achieve a true ReadOnly combobox that renders EXACTLY like a readonly textbox, but that also allows the user to copy it's contents to the clipboard.
0
Valeri Hristov
Telerik team
answered on 01 Sep 2009, 09:29 AM
I understand your concerns, but in our practice we always got slapped on our hands when we introduced a practice, that is very different or on the contrary than the standard, imposed by the MS controls. We want to be as close as possible to the standard, since the majority of the developers are familiar with the behavior and usually don't want to change their habits. I added your request in the RadComboBox backlog, we will consider it for development if there is demand for such feature.

I am not sure what exactly your scenario is, but if possible, I would recommend replacing the ComboBox when it is read-only/disabled with a real TextBox, that will look and behave as you need.

Greetings,
Valeri Hristov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Happy
Top achievements
Rank 1
answered on 01 Sep 2009, 12:13 PM
I decided to play around with the MS SL combobox.  Currently, the MS SL combox doesn't really support anything. IsEditable always returns false so one cannot type into the text area. And it doesn't even support IsReadOnly yet.  However, it is rendering the textarea with a white background even though I can't type into it.

I then created a WPF application and experimented with the MS ComboBox there. Same thing. Even though the text area is readonly, it still renders with a white background. Regardless of what IsEditable is set to, the combobox has a white background. However, even setting the control to IsReadOnly=true, still allows me to change by dropping down values. Just doesn't make sense. I found a workaround to that by setting IsHitTestVisible=false and IsTabStop=false. But then the control still renders white. What a mess. But at least I could change the background color easily by just changing the background property.

Given the above, I don't understand how you can say that you are following the MS controls standard in regard to your control showing with a gray background. Not to mention, your mix of different gray backgrounds.

At a minimum, is there a shortcut for me to fix the white background in the theme or do I need to copy that entire huge section of the theme so that I can fix this myself?

You could always add an IsCompletelyReadOnly property that affects the whole control and makes it look and act like a readonly textbox.
0
Valeri Hristov
Telerik team
answered on 01 Sep 2009, 01:06 PM
I think that we are talking about different things - API and design. We want to be as close as possible to the MS API, hence we create our API and behavior like theirs. That said, I am afraid that we cannot change the behavior of the IsReadOnly property - it is intended to make the inner TextBox in the combo read-only. We could add another property to change the control as you describe, though.

The background colors and the themes of the Telerik controls are another story. Some Telerik themes (e.g. Vista) are designed to copy an existing standard theme (Aero), but some themes like Office do not have exact standard counterpart and our designers decide how the controls should look. In other words, the different read-only background of RadComboBox in Vista can be considered as a bug in the theme, that we could fix with the upcoming internal build this friday. I personally would prefer Vista and Office to be virtually the same with just some color differences, so I guess we could change the Office backgrounds too. In other words, after the fix, a read-only editable combo with Vista theme would look like a text box with a black triangle on the right side, exactly like the WPF ComboBox with Aero theme. With the Office theme it would look as a text box with a button on the right side. Is this OK?

I appreciate your feedback on our themes. This week we will be reviewing all themes and most probably we will find other similar glitches and bugs, that will be fixed with the upcoming releases.

Greetings,
Valeri Hristov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Nisanth
Top achievements
Rank 1
answered on 25 Jul 2016, 06:55 AM

Hi,

     I have upgraded Telerik from Q2.2010 to Q2.2016 Recently. After upgrade the background color of the Disabled and ReadOnly combo box is changed. 

Previously the BG Color was White and now the Color is Transparent.

 

How will I change the BG Color of the Disabled and Readonly Combo Box.

Tags
ComboBox
Asked by
Happy
Top achievements
Rank 1
Answers by
Valeri Hristov
Telerik team
Happy
Top achievements
Rank 1
Nisanth
Top achievements
Rank 1
Share this question
or