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

Assign Custom Theme to RadMessageBox

2 Answers 554 Views
Themes and Visual Style Builder
This is a migrated thread and some comments may be shown as answers.
Joseph
Top achievements
Rank 1
Joseph asked on 08 Aug 2016, 09:31 PM

I am working on a WinForms app using Telerik 2016 Q2. It contains several themes created with Visual Style Builder that are managed by a radThemeManager control accessing the XML files directly (not as a resource). The Visual Studio 2015 solution also contains a couple of Telerik-created themes (visualStudio2012LightTheme1 & office2013LightTheme1).

I would like to assign one of my custom themes to a radMessageBox control. Whatever I try, no theme is assigned. I first tried:

RadMessageBox.SetThemeName("customTheme");
RadMessageBox.Show(this, "messagebox text", "titleg", MessageBoxButtons.OK, RadMessageIcon.Info);

The I tried putting this in the load event of the form:

ThemeResolutionService.ApplicationThemeName = "customTheme";

Neither worked. I then tried:

RadMessageBox.SetThemeName("visualStudio2012LightTheme1"); //Telerik-supplied theme

This partially worked as expected. It did override the custom themes of my controls throughout the form, but the radMessageBox still did not receive the theme (it was still set to the default theme).

How can I apply a custom theme to a radMessageBox?

Thanks.

2 Answers, 1 is accepted

Sort by
0
Joseph
Top achievements
Rank 1
answered on 09 Aug 2016, 02:01 AM

Figured this out and am posting the solution here just in case this weirdness affects anyone in the future.

About five days before this issue arose I had a catastrophic failure of my Visual Studio 2015 solution. Completely corrupted. Would not open. So I generated a clone from my last good commit on GitHub and continued working on my code.

This evening I attempted to add a radAboutBox to my WinForms project. I got this message:

Your project uses GAC referenced assemblies. Please upgrade your project.

When I attempted to use the Telerik Upgrade Wizard, I got this error message:

An error occurred while running the wizard.
Error executing custom action Telerik.WinControls.VSX.Actions.MultiProjectUpdateReferencesAction: System.IO.FileNotFoundException: Could not load file or assembly 'Telerik.WinControls.dll' or one of its dependencies.

Sure enough, my \lib\RCWF\2016.2.608.40 subdirectory (which contains the XML and DLL files for the WinForms Telerik controls) was missing about 50 files (the GitHub clone only restored a subset omitting very important ones including Telerik.WinControls.dll). I restored the missing files from a local backup and my radMessageBox displayed with a custom theme as expected via this code:

RadMessageBox.SetThemeName("customTheme");
RadMessageBox.Show(this, "messagebox text", "title", MessageBoxButtons.OK, RadMessageIcon.Info);

 

0
Hristo
Telerik team
answered on 09 Aug 2016, 07:31 AM
Hi Joseph,

Thank you for writing.

I am glad that you have managed to resolve the issue.

Please let me know if you need further assistance.

Regards,
Hristo Merdjanov
Telerik by Progress
Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms. For more information check out this blog post and share your thoughts.
Tags
Themes and Visual Style Builder
Asked by
Joseph
Top achievements
Rank 1
Answers by
Joseph
Top achievements
Rank 1
Hristo
Telerik team
Share this question
or