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

Apply theme to just the current Dialog

3 Answers 126 Views
Themes and Visual Style Builder
This is a migrated thread and some comments may be shown as answers.
Denis Cilliers
Top achievements
Rank 1
Denis Cilliers asked on 18 Apr 2013, 12:06 PM
how can I change the theme for just the current form at runtime and not the whole application 

This is for a dialog form that opens in front of the main form that has a different theme

ThemeResolutionService.ApplicationThemeName = ThemeName
 This changes the theme for the whole application not just the open dialog and the following seems to not work at all 

Private Sub ApplyTheme()
 
       Dim mytheme As New Telerik.WinControls.Themes.Office2010BlackTheme
 
       Me.ThemeClassName = "Telerik.WinControls.UI.RadForm"
       Me.ThemeName = mytheme.ThemeName
 
   End Sub

3 Answers, 1 is accepted

Sort by
0
Anton
Telerik team
answered on 23 Apr 2013, 10:40 AM
Hi Denis,

Thank you for writing.

The theme that is set through ApplicationThemeName property of ThemeResolutionService is with higher priority than the locally set themes to controls. However, you can use the ApplyThemeToControlTree method of the ThemeResolutionService and apply the theme to the form. In this case the locally set themes will not be ignored. However, you should apply the main theme to all forms in your application.

Attached is the demo project that demonstrates how to use the ApplyThemeToControlTree method.

I hope this information helps. Should you have further questions, I would be glad to help.

Greetings,
Anton
the Telerik team
WinForms Q1 2013 boasts PivotGrid, PDF Viewer, Chart enhancements and more. Check out all of the latest highlights.
0
Denis Cilliers
Top achievements
Rank 1
answered on 23 Apr 2013, 03:02 PM
Hi Thanks Anton

I cant seem to get this implemented, will try it again, my forms are just stubborn I suppose

Also the code you supplied does not include the Office2010BlackTheme  Theme as you have targeted the newer build

Thus I cannot use your code as it currently stand 

Denis
0
Anton
Telerik team
answered on 26 Apr 2013, 12:48 PM
Hello Denis,

Thank you for writing back.

I created a new demo to demonstrate more clearly how to use the ApplyThemeToControlTree method to change the theme of the form at run time.

I hope this demo helps.

All the best,
Anton
the Telerik team
WinForms Q1 2013 boasts PivotGrid, PDF Viewer, Chart enhancements and more. Check out all of the latest highlights.
Tags
Themes and Visual Style Builder
Asked by
Denis Cilliers
Top achievements
Rank 1
Answers by
Anton
Telerik team
Denis Cilliers
Top achievements
Rank 1
Share this question
or