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

How can I get the light green theme at design time?

7 Answers 238 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
IT-Support
Top achievements
Rank 2
IT-Support asked on 21 Apr 2016, 06:52 AM

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

Sort by
0
Evgenia
Telerik team
answered on 25 Apr 2016, 08:21 AM
Hello Thomas,

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
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
Stefan Bernbo
Top achievements
Rank 1
answered on 02 Jan 2017, 07:24 PM
I agree with Thomas. When will this be fixed? It is quite annoying and should be an easy fix for you.
0
Martin
Telerik team
answered on 03 Jan 2017, 12:33 PM
Hi,

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
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
Stefan Bernbo
Top achievements
Rank 1
answered on 04 Jan 2017, 12:51 PM

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

0
Martin
Telerik team
answered on 04 Jan 2017, 03:18 PM
Hi 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
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
Stefan Bernbo
Top achievements
Rank 1
answered on 04 Jan 2017, 04:44 PM

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

0
Martin
Telerik team
answered on 05 Jan 2017, 08:25 AM
Hi 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
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Mihaela
Top achievements
Rank 1
commented on 13 Jun 2023, 09:10 PM

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

Stenly
Telerik team
commented on 16 Jun 2023, 11:41 AM

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?

Tags
General Discussions
Asked by
IT-Support
Top achievements
Rank 2
Answers by
Evgenia
Telerik team
Stefan Bernbo
Top achievements
Rank 1
Martin
Telerik team
Share this question
or