ThemeResolutionService.ApplicationThemeName not apply to all controls

4 posts, 0 answers
  1. Jaroslav Bucek
    Jaroslav Bucek avatar
    9 posts
    Member since:
    Jul 2008

    Posted 26 Sep 2008 Link to this post

    Hi,

    I am using ThemeResolutionService.ApplicationThemeName to set some theme for all controls in the application. It works fine, but now I need to set different theme to only one control in that application. Is it somehow possible to set the control not to take ThemeName from ThemeResolutionService?

    Thanks in advance.
    Jaroslav
  2. Nikolay
    Admin
    Nikolay avatar
    1803 posts

    Posted 26 Sep 2008 Link to this post

    Hello Jaroslav Bucek,

    Thank you for the question.

    It is possible to set a theme to one control, when another theme is set by ApplicationThemeName. In order to do that, you should make an object of type StyleBuilder, and then call the BuildStyle method, passing the RootElement of the desired control. I have demonstrated the approach in the sample project attached.

    If you have additional questions, feel free to contact me.

    All the best,
    Nikolay
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Jaroslav Bucek
    Jaroslav Bucek avatar
    9 posts
    Member since:
    Jul 2008

    Posted 30 Sep 2008 Link to this post

    Hi Nikolay,

    you were right, thank you for your answer. Anyhow I have another question, regarding it:

    I need to change the theme of RadTabStrip control, but don't want to affect the theme of controls inside that RadTabStrip. Is that somehow possible?

    My case: I've got a RadTabStrip inside another RadTabStrip and I need my client could visually recognize both Tabs immeditelly. The problem comes, when I put some control into embedded TabStrip, it takes its theme setting from main owner, instead directly from its owner.

    Could you help me somehow, please?

    Thanks in advance
    Jaroslav
  5. Nikolay
    Admin
    Nikolay avatar
    1803 posts

    Posted 03 Oct 2008 Link to this post

    Hi Jaroslav Bucek,

    Thank you for getting back to me.

    I suppose you are regarding the ambient properties of WinForms controls. These properties, when not set for a particular control, take their values from the parent control. These properties are BackColor, ForeColor, Cursor and Font.

    For example, let's set the main RadTabStrip.ThemeName to Vista and the child RadTabStrip.ThemeName to Telerik. Next, let's put several buttons in the child RadTabStrip. Set the ThemeName of the first one to Telerik and the ThemeName of the others to Vista. Since the Font property is not set in the buttons' themes, they will inherit it from the parent which such property set. In this case, the parent that has such setting is the top RadTabStrip, because the Vista theme has Font's FontStyle set to Italic. As a result you will observe that the font of the buttons will be Italic as well.

    In order to set a non-italic FontStyle for the buttons, you need to traverse the controls collections in the child RadTabStrip in order to set the desired Font. I have demonstrated the approach in the sample project attached.

    Kind regards,

    Nikolay
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Back to Top