Hi telerik experts,
I want to use the light green theme for my application, which fits perfectly at runtime.I switch to light palette when the application starts up: GreenPalette.LoadPreset(GreenPalette.ColorVariation.Light); and everything is fine.
The only problem is, that the designer (VS and Blend) always shows the dark green theme. This makes the design of the views a little bit hard. Is there a way that the light green theme is used in the designer?
Best regards,
Thomas
7 Answers, 1 is accepted
Unfortunately I should admit that switching color variations doesn't affect the design time of our controls. This is a known issue that can be reproduced both in VisualStudio designer and ExpressionBlend. Our developers are known of this limitation and we will further investigate the reasons. At this moment I can't provide a workaround.
We are sorry for any inconvenience this may have caused.
Regards,
Evgenia
Telerik
The way the theme variations work, and the design time evaluation of the styles and the theme resources, do not provide a design time variation change in the conventional method.
What we could suggest as a workaround to apply the variation change in the static constructor of the MainWindow in order to see it in the designer and Blend as well. Since the static constructor is executed
static
MainWindow()
{
GreenPalette.LoadPreset(GreenPalette.ColorVariation.Light);
}
Regards,
Martin
Telerik by Progress
Hi Martin,
I tried that now, but it doesn't seem to work. I'm using Visual Studio 2013 only.
Did you get that to work with Studio?
Best / Stefan
I used it in VisualStudio 2013 exactly and it does work in the Designer. Try closing the MainWindow, then the Studio and rebuilding the project before you reopen the designer.
If you are referring to the VisualStudio2013 theme - works with it as well.
I am attaching a sample project of the implementation just in case.
Regards,
Martin
Telerik by Progress
Thanks for the sample project. I noticed that your project works, but mine is still not working.
I guess that is because my MainWindow is a RadWindow, not a Window. Have you tried with that?
Best / Stefan
Same approach works fine with RadWindow as well - when it is instead of the MainWindow, as well as when is is used as a user control. Note that you might need to merge a style for the RadWindows in App.xaml.
I have modified the previous project to include RadWindows with static constructors again. Note that in order to use it as a MainWindow, besides all shown in our SDK about it, the thing that is missed most often is that the StartupUri needs to be removed from App.xaml.
Regards,
Martin
Telerik by Progress
Dear Telerik,
I have one issue related to the above discussion: applying the same workaround (the variation change in the static constructor of the MainWindow) for Fluent Theme Dark Variation, I cannot see in VisualStudio Designer Window the proper variation, even at run time everything is ok.
So, it;s possible or not to view in Designer the dark variation of Fluent Theme?
Thanks,
Michaela
Hello Mihaela,
Could you check the following article about changing the color variation of our controls in the Visual Studio's Designer?
View Theme Variation in the Visual Studio Designer - Telerik UI for WPF
Generally, the color variation for a custom control should be set in its static constructor as suggested in my colleague's replies. For a UserControl, it should be set before calling the InitializeComponent. After that, clean, rebuild, and run the project before reloading the designer for the changes to take effect.
If this does not help, could you share a sample project, which reproduces the unwanted behavior?