Default backcolor of RadControls

5 posts, 0 answers
  1. Alcide Burato
    Alcide Burato avatar
    14 posts
    Member since:
    Mar 2011

    Posted 11 Apr 2011 Link to this post

    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
  2. Alcide Burato
    Alcide Burato avatar
    14 posts
    Member since:
    Mar 2011

    Posted 11 Apr 2011 Link to this post

    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
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 12 Apr 2011 Link to this post

    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
  5. Alcide Burato
    Alcide Burato avatar
    14 posts
    Member since:
    Mar 2011

    Posted 13 Apr 2011 Link to this post

    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
  6. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 18 Apr 2011 Link to this post

    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
Back to Top
UI for WinForms is Visual Studio 2017 Ready