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

Default backcolor of RadControls

4 Answers 121 Views
Buttons, RadioButton, CheckBox, etc
This is a migrated thread and some comments may be shown as answers.
Alcide Burato
Top achievements
Rank 1
Alcide Burato asked on 11 Apr 2011, 08:22 AM
Hi,
I have created a radiobutton control that inherits from RadRadioButton.
The problem I have is when I drop the control in a standard System.Windows.Forms.TabPage, the control doesn't keep the same background color of the TabPage. The operating system theme I'm using is Windows XP.
I attach an image that show the problem.
In the pic the part with white background is the TabPage, while the part with grey backcolor is the standard form.

It seems telerik RadControls doesn't care if the property TabPage.UseVisualStyleBackColor is true.
 
Thanks for any help

Alcide

4 Answers, 1 is accepted

Sort by
0
Alcide Burato
Top achievements
Rank 1
answered on 11 Apr 2011, 11:14 AM
Hi all,
I temporarily solved the problem in this way:
1) Drop a Panel inside the TabPage
2) Drop the RadControl inside the Panel.

In this way the RadControl is able to keep the Panel background that is the same of TabPage having UseVisualStyleBackColor set to true.

But I'm waiting to know if exists a property that manages UseVisualStyleBackColor in RadCheckBoxes and RadRadioButtons.

Thanks,
Alcide
0
Stefan
Telerik team
answered on 12 Apr 2011, 05:19 PM
Hello Alcide,

Thank you for writing.

The observed behavior is the default behavior for the standard Windows Forms controls. When you have a control and you set its BackColor to Transparent, when the control is placed on the form it will take the form color instead of taking the color of the parent control (TabControl in your case). However, I will add this case into our PITS system, and we will review it and research possible solutions in a future release.

Meanwhile, to work around this behavior, explicitly set the control BackColor to Transparent:
 
class MyRadioButton : RadRadioButton
{
    public override string ThemeClassName
    {
        get
        {
            return typeof(RadRadioButton).FullName;
        }
    }
 
    protected override void CreateChildItems(Telerik.WinControls.RadElement parent)
    {
        base.CreateChildItems(parent);
        this.BackColor = Color.Transparent;
    }
}

Thank you for bringing this into our attention. Should you have any other questions, do not hesitate to write back.

Greetings,
Stefan
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Alcide Burato
Top achievements
Rank 1
answered on 13 Apr 2011, 09:24 AM
Hello Stefan
Thanks for the clear answer and the suggestion.

I have tried the overriding methods you have suggested, and it works. Actually I'm using only the "CreateChildItems" override, because overriding the "ThemeClassName" disables the customized theme I have created using VisualStyleBuilder.

Best regards,
Alcide
0
Stefan
Telerik team
answered on 18 Apr 2011, 02:45 PM
Hello Alcide Burato,

Thank you for writing back.

In this case you should override the ThemeEffectiveType property, as explained in this KnowledgeBase article.

Should you have any other questions, do not hesitate to contact us.
 
Kind regards,
Stefan
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Buttons, RadioButton, CheckBox, etc
Asked by
Alcide Burato
Top achievements
Rank 1
Answers by
Alcide Burato
Top achievements
Rank 1
Stefan
Telerik team
Share this question
or