Saving theme changes in code

2 posts, 0 answers
  1. Jason
    Jason avatar
    47 posts
    Member since:
    Jan 2013

    Posted 11 Nov 2014 Link to this post

    We are looking to alter one of the standard themes, changing some of the details as well as the colours. Once complete, it will be necessary to make other themes that are the same but based on different colours.

    I'm well aware of the usage of Visual Builder, so creating an initial theme is not a problem. I also have code that finds a theme in the currently loaded application, extracts all the images and alters the colours. I believe I can then create a clone of the theme and replace the images with the re-coloured versions, assuming the following code works

    foreach (Telerik.WinControls.StyleRepository repository in theme.Repositories)
        if (repository.ItemType == "Image")
            foreach (Telerik.WinControls.PropertySetting setting in repository.Settings)
                if (setting.Name == "Image")
                    Bitmap bmp = GetBitMap(repository.Key);
                    setting.Value = bmp

    What I'm stuck with, is how to save the altered theme back to a tssp file.

    Any help would be appreciated. 

  2. George
    George avatar
    500 posts

    Posted 14 Nov 2014 Link to this post

    Hi Jason,

    Thank you for writing.

    Themes are only meant to be saved with Visual Style Builder and the saving mechanism is strongly coupled with it. Currently, you cannot save a modified Theme object. What you can do is execute this code every time the theme is loaded.

    Let me know, should you have further questions.


    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

  3. DevCraft R3 2016 release webinar banner
Back to Top