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

ListBox styling

4 Answers 175 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.
Alex Peachey
Top achievements
Rank 1
Alex Peachey asked on 08 Dec 2007, 08:05 PM
I have a ListBox that before without any styling it had an attractive background (I don't remember if it was white or a blue or what) and the selected item would have nice highlighting. After the Beta, the list has a gray background and the highlighted item looks the same as it used to.
It appears that a style was left out possibly? Or if it is meant to be a gray background, I'll just set it manually to something nicer. I have a feeling it was a mistake or oversight though.

4 Answers, 1 is accepted

Sort by
0
Alex Peachey
Top achievements
Rank 1
answered on 09 Dec 2007, 06:46 PM
Following up, this was isolated to one incident as I have used several others and notice that the list just picks up the background of anything below it. So the list in question is in a PanelBar. It is the PanelBar I believe that has changed.
0
Angel
Telerik team
answered on 10 Dec 2007, 02:15 PM
Hi Alex,

Indeed, the panelbar has been updated considerably, so it is possible that we have changed something that impacts theme usage.

Since we are not sure of your exact case and implementation, we would like to clarify the following:
  1. How do you set the theme of the listbox? Is it serialized in the designer file (Designer.cs or Designer.vb)? Do you set specific colors in design time (ForeColor, BackColor or something like this)? Do you use a customized theme?
  2. Is the problem appearing in design time only or in runtime as well?
  3. There are 2 ways to add a RadListBox to a PanelBarGroup:
    a) To add RadListBoxElement to the Items collection of the PanelBarGroup
    b) To use control mode and put a RadListBox as a control inside the group's panel.
    Which one of these two do you use?

Thanks in advance - we will do our best to track down the problem and fix it.

Kind regards,
Angel
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Alex Peachey
Top achievements
Rank 1
answered on 10 Dec 2007, 05:30 PM
Steps to reproduce:
1. Create a new user control and extend from DockPanel.
2. Drag a RadPanelBar from the toolbox and set to Fill.
3. Add 3 items to the RadPanelBar, set each one to use control mode.
4. In each Panel Item, drag a RadListBox from the toolbox and set to Fill.

You should notice in the designer, each Panel Item starts with a gray background but when you change to use control mode it turns white. When you put a ListBox on it is white.

When you dock the control to a DockingManager and run the application you will see that the background of the list/panel/etc is now gray. In Q2 SP1 it was white in designer and white when run.

0
Angel
Telerik team
answered on 11 Dec 2007, 01:52 PM
Thank you for the additional details, Alex.

What you have observed (background color inheritance) is a WinForms feature. The change of the background color is caused by the change of the base class of the user control - you modify it from UserControl to DockPanel. But DockPanel has its own default background color which is different than the Control color.

In order to avoid the background inheritance set the BackgroundColor property of the user control to "Control" color. Please, do that from the designer of the user control, not from the designer of the Form where the user control is added.

After that when you drag-and-drop new controls inside the user control they will be with their default background colors instead of the background color of DockPanel.

It is possible that there is serialized code for BackgroundColor for the already added controls in the user control so remove that code before setting BackgroundColor for the user control.

The observed behavior of RadPanelBar and RadListBox is the default one - you can confirm it by using Microsoft buttons inside the user control. If the user control inherits DockPanel the button will be with dark gray background just like RadPanelBar and the RadListBoxes inside it.

This behavior should be the same for the older version as well. Let me know if this information helps.

 
Kind regards,
Angel
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
ComboBox and ListBox (obsolete as of Q2 2010)
Asked by
Alex Peachey
Top achievements
Rank 1
Answers by
Alex Peachey
Top achievements
Rank 1
Angel
Telerik team
Share this question
or