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

Form themes

1 Answer 53 Views
Form
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 21 Mar 2014, 07:49 PM
I know this is posted somewhere here, so my search phrases must me horrible..

New to api, looking at how a can assign a form a theme during it's creation.   Want to be able to switch themes based on how a form is called.

I created a form which implements RadForm

on form_load I set ThemeNameClass and ThemeName, then Initialize is called.  c#, 2013, latest version for DevCraft.

Thanks
Mike

1 Answer, 1 is accepted

Sort by
0
Accepted
Dimitar
Telerik team
answered on 26 Mar 2014, 11:50 AM
Hello Michael,

Thank you for writing.

In order to be able to set a specific theme you should first create an instance of the theme class. Then you can use the ApplyThemeToControlTree method to apply the theme to all controls including the form itself. For example you can use the following constructor to create a forms with different themes: 
public Form2(string ThemeName)
{
    InitializeComponent();
 
    switch (ThemeName)
    {
        case "Office2013Light":
            new Telerik.WinControls.Themes.Office2013LightTheme(); 
            break;
        case "Office2013Dark":
            new Telerik.WinControls.Themes.Office2013DarkTheme();
            break;
    }
    
    ThemeResolutionService.ApplyThemeToControlTree(this, ThemeName);
}

I hope this will be useful. Should you have further questions, I would be glad to help.

Regards,
Dimitar
Telerik
 

Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.

 
Tags
Form
Asked by
Michael
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Share this question
or