Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I switch themes in Telerik WinForms?

How do I tell Telerik for WinForms which of its themes to use?

I created a new WinForms project and dropped a RadPageView on the form, but there's a 5-pixel margin of dead space all the way around, the tabs are almost twice as tall as they need to be, and everything is shiny and blue. Even apart from the wasted space, all this blue stuff would look horribly out of place in our app. I just want a standard Windows look, and I'm assuming that the way to accomplish that is to select a different, less-blue, less-shiny theme. (Or is there another way?)

Here's what I've tried:

  • I tried setting EnableTheming to False, but then the tabs have no borders at all, so there's absolutely no indication of where to click or which tab is active -- no good at all.
  • I can drop down the ThemeName property in the Property Grid, but the only options are "Reset" and "ControlDefault". Neither setting does anything (even with EnableTheming set back to True).
  • There are a bunch of Theme classes in the Toolbox (AquaTheme, BreezeTheme, etc.), but adding those to my form doesn't make any difference. I thought they might appear in the ThemeName dropdown, but they don't.
  • I tried dropping a RadThemeManager on my form, but it only has a LoadedThemes collection, which is empty. I can add things to it, but that just adds a ThemeSource, and setting one of those up seems to involve browsing to a file, and I don't have any theme files to browse to.
  • There's a ThemeClassName property on the RadPageView, but it's just a string (defaults to Telerik.WinControls.UI.RadPageView) and I have no idea what I might change it to, or how it even relates to themes.

This is ridiculous. All I want is a tab control that looks like a tab control! How can I do that?

like image 324
Joe White Avatar asked Dec 08 '10 22:12

Joe White


2 Answers

The best way to accomplish this application-wide would be to use the ThemeResolutionService. You'll need to drag out one of the themes from the toolbox first. For example, if you add the Windows7Theme component to your form, you'd apply the theme using the following.

private void Form1_Load(object sender, EventArgs e)
{
    ThemeResolutionService.ApplicationThemeName = "Windows7";
}

I recommend checking out this video related to themes as well: http://tv.telerik.com/watch/winforms/visualstylebuilder/changing-themes-at-run-time-with-radcontrols-winforms

like image 99
Shoerob Avatar answered Oct 16 '22 12:10

Shoerob


I'm currently working on a Winform/Telerik application. It's a MDI application.

First, I added in the References of my Project the Telerik.Wincontrols.Themes.Breeze dll, then in the constructor of my main form, here is what I did :

    private fMain()
    {
        InitializeComponent();

        ThemeResolutionService.ApplicationThemeName = "Breeze"; 
        RadGridLocalizationProvider.CurrentProvider = new FrenchRadGridLocalizationProvider();
    }

I also added the French RadGridLocalizationProvider.

And it works, all my RadDataGridViews are in French and have the Breeze theme.

Even if the Form used is not a Telerik one, which is my case, I don't use RadForm !

like image 42
LaGrandMere Avatar answered Oct 16 '22 14:10

LaGrandMere