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

Saving theme changes in code

1 Answer 135 Views
Themes and Visual Style Builder
This is a migrated thread and some comments may be shown as answers.
Jason
Top achievements
Rank 1
Jason asked on 11 Nov 2014, 03:04 PM
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. 

Thanks
Jason

1 Answer, 1 is accepted

Sort by
0
George
Telerik team
answered on 14 Nov 2014, 09:37 AM
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.

Regards,
George
Telerik
 

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.

 
Tags
Themes and Visual Style Builder
Asked by
Jason
Top achievements
Rank 1
Answers by
George
Telerik team
Share this question
or