Override partial theme settings in one control?

2 posts, 0 answers
  1. Qwizdom
    Qwizdom avatar
    8 posts
    Member since:
    Mar 2010

    Posted 22 Jun 2010 Link to this post

    I have an application where we support switching between 'normal' and office2007Silver & office2007Black for
    the entire application (using ThemeResolutionService.ApplicationThemeName = "Office2007Silver"; etc). In one of our forms I have a problem where it looks great in the blank/ControlDefault Theme (blue) but once I switch to silver or black a few problems show up.

    I have a group box that holds several checkboxes with images (white background in the images). In the default blue theme (ControlDefault) the background of the groupbox is white so it naturally blends, but with the other themes the background becomes transparent ( where it shows silver or black respectively) so the images stick out like a sore thumb. Making them have a transparent background would look horrible as well, so I'm looking to possibly override the 'background' setting for the groupbox so that no matter what theme gets applied to the form it will always have a white background (the other changes are fine). Is this possible at all?
    Otherwise just having this one control not be themed besides the 'standard' theme would be a 'decent' alternative (Setting enable Theming to false makes it look just as bad as with the other themes and doesn't solve my issue)

    I tried looking at the properties in Visual Studio under StyleSheet->Style->PropertySettingsGroup with the PropertySettings & Selectors, hoping there'd be a setting in there to ignore any changes but I'm not quite following what's going on in there. I'd prefer not to have to make a custom theme since this is the only form/control I have this issue with.

     I tried adding a white panel in to the groupbox as a work-around but that would then overlay onto the groupbox label so that didn't work.

  2. Deyan
    Deyan avatar
    2026 posts

    Posted 28 Jun 2010 Link to this post

    Hi Stefan,

    Thank you for contacting us and for your question.

    In your case you could benefit from our Dependency Property System by overriding the property values of the RadGroupBox's FillPrimitive that come from the currently set theme. This will allow you to prevent any changes implied by the theme since the property values set programmatically by you will have higher priority. Take a look at the following code snippet where I am defining a white solid background by setting properties of the RadGroupBox's FillPrimitive:
    this.radGroupBox1.GroupBoxElement.Content.Fill.GradientStyle = GradientStyles.Solid;
    this.radGroupBox1.GroupBoxElement.Content.Fill.BackColor = Color.White;

    I hope this helps. Do not hesitate to write back anytime you have further questions or need assistance.

    Sincerely yours,
    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
  3. DevCraft banner
Back to Top