Form themes

2 posts, 1 answers
  1. Michael
    Michael avatar
    3 posts
    Member since:
    Mar 2012

    Posted 21 Mar 2014 Link to this post

    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
  2. Answer
    Dimitar
    Admin
    Dimitar avatar
    1404 posts

    Posted 26 Mar 2014 Link to this post

    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.

     
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top