Reset RadMessageBox to the default theme

1 Answer 38 Views
MessageBox Themes and Visual Style Builder
YF
Top achievements
Rank 1
Iron
YF asked on 18 Nov 2025, 12:14 AM

Our application doesn't explicitly set a default theme so it defaults to ControlDefault.
One screen uses the MaterialBlueGrey theme, so I wanted the related MessageBoxes to also use that theme.

Per the instructions I used the following code:

RadMessageBox.SetThemeName("MaterialBlueGrey");
RadMessageBox.Show("MESSAGE");
RadMessageBox.SetThemeName("ControlDefault");

The problem is that, although the overall look goes back to the default theme, some elements stay with the MaterialBlueGrey theme. For example: the button height & caption font.

I tried all these with the same result:

RadMessageBox.SetThemeName("");
RadMessageBox.ThemeName = "";
RadMessageBox.ThemeName = "ControlDefault";

1 Answer, 1 is accepted

Sort by
0
Accepted
Nadya | Tech Support Engineer
Telerik team
answered on 18 Nov 2025, 11:50 AM

Hello, Yossi,

Using the SetThemeName() is the correct way to apply a theme to RadMessageBox. SetThemeName() work fine on my side either when set MaterialBlueGrey theme or ControlDefault theme. Also, when I reset the theme to ControlDefault, RadMessageBox looks normal with this theme. I can not observe larger button height or caption font. Maybe there is something different on your side. 

Is it possible to provide a sample project that can replicate your existing setup and demonstrate the issue there. When I have the exact problem replicated, I could be able to investigate the case more precisely and assist you further.

Looking forward to your reply.

Regards,
Nadya | Tech Support Engineer
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

YF
Top achievements
Rank 1
Iron
commented on 12 Dec 2025, 02:44 PM

Project zip attached.

Step 1: click Default, the message box is fully in the default theme

Step 2: click Material, the message box is fully in the Material theme

Step 3: click Default again, the message box is mostly in the default theme, but caption font & button height use the Material theme

Nadya | Tech Support Engineer
Telerik team
commented on 12 Dec 2025, 06:45 PM

Hello, Yossi,

The provided project is greatly appreciated.

To prevent this behavior, you need to fully reset the RadMessageBoxForm. To do so, you can call Dispose() on the RadMessageBoxForm instance. Thus, you're forcing the RadMessageBox to release its current cached state, including any theme settings that were previously applied.

Please refer to the following code snippet:

private void radButton2_Click(object sender, EventArgs e)
{
    RadMessageBox.Instance.Dispose();
    RadMessageBox.Show("Message in default theme", "Caption");
}

I hope this helps. If you have any other questions, do not hesitate to contact me.

YF
Top achievements
Rank 1
Iron
commented on 15 Dec 2025, 03:07 PM

This works. Thanks a lot. If you post this as a separate answer, I can mark it as accepted.

 (For reference, I just found this was already answered before)

In my case, and I believe that would be the more common case, it makes more sense to call Dispose after using the theme that's not standard in my project. So instead of:

RadMessageBox.SetThemeName("MaterialBlueGrey");
RadMessageBox.Show("MESSAGE");
RadMessageBox.SetThemeName("ControlDefault");

I would do:

RadMessageBox.SetThemeName("MaterialBlueGrey"); RadMessageBox.Show("MESSAGE"); RadMessageBox.Instance.Dispose();

YF
Top achievements
Rank 1
Iron
commented on 15 Dec 2025, 03:10 PM

One question for you, Nadya: could this solution introduce bugs related to using a disposed object, especially when async is involved?

Nadya | Tech Support Engineer
Telerik team
commented on 16 Dec 2025, 02:26 PM

Hello,

RadMessageBox shows a static modal RadMessageBoxForm. This RadMessageBoxForm can be accessed at any time during the execution of the program. RadMessageBox works similarly to the standout MS MessageBox. You should be careful and not access RadMessageBoxForm if you have already disposed it. In the above-discussed case, you should not have issues working with RadMessageBow and changing themes.

Note that all UI controls are not thread-safe controls in the whole Windows Forms platform (not just Telerik controls, but all controls out there). Here is an article on MSDN, describing how to make a thread-safe Winforms UI application. This means that any control from the Telerik UI for WinForms suite is not thread-safe as well and cannot be used outside the main UI thread. You should use an Invoke to update the controls in the cross-threading scenario.

I hope this information helps.

Tags
MessageBox Themes and Visual Style Builder
Asked by
YF
Top achievements
Rank 1
Iron
Answers by
Nadya | Tech Support Engineer
Telerik team
Share this question
or