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

ThemeResolutionService.ApplicationThemeName not apply to all controls

3 Answers 417 Views
Tabstrip (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.
Jaroslav Bucek
Top achievements
Rank 1
Jaroslav Bucek asked on 26 Sep 2008, 10:48 AM
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

3 Answers, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 26 Sep 2008, 04:44 PM
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.
0
Jaroslav Bucek
Top achievements
Rank 1
answered on 30 Sep 2008, 08:56 AM
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
0
Nikolay
Telerik team
answered on 03 Oct 2008, 10:25 AM

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.
Tags
Tabstrip (obsolete as of Q2 2010)
Asked by
Jaroslav Bucek
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
Jaroslav Bucek
Top achievements
Rank 1
Share this question
or