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

Sometimes properties need reset to be overridden by a theme

3 Answers 92 Views
Themes and Visual Style Builder
This is a migrated thread and some comments may be shown as answers.
Maria
Top achievements
Rank 1
Maria asked on 21 Mar 2018, 06:00 PM

Hello there, 

I meet the following issue.. I've created a custom theme in Visual Style Builder and I am trying to apply it in runtime using the following line: 

Telerik.WinControls.ThemeResolutionService.LoadPackageFile("C:/.../CustomTheme.tssp");
Telerik.WinControls.ThemeResolutionService.ApplicationThemeName = "CustomTheme";

The theme is being applied to most of the controls but not to all. I have solved this issue by subscribing to  "Telerik.WinControls.ThemeResolutionService.ApplicationThemeChanged" event and there I reset manually the properties that are not being overridden by the theme.

But I guess that it's not necessary and I am doing something wrong.

I will give an example of my issue:

If I add a new RadButton to my Form and leave its Fill.BackColor to 'Transparent', then the theme is being applied properly in runtime. But if I change its BackColor from WinForms Designer, then the theme does not override its value and needs reset in ApplicationThemeChanged event with the method: 

MyRadButton.ButtonElement.Fill.ResetValue(Telerik.WinControls.Primitives.FillPrimitive.BackColorProperty);

Any ideas?

3 Answers, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 23 Mar 2018, 12:55 PM
Hello, Maria, 

According to the provided information I am not sure how exactly you create your custom theme. However, I would like to note that when you specify some style settings for a certain state, it is necessary to reset this style for the normal state of the element. For example, if you apply green color when the mouse is over a button, make sure that you set a default color for the normal state. Thus, the button won't remain green when you hover it with the mouse and then move the mouse outside the button. 

The recommended approach is to use one of the already existing themes that is closest by design to yours. Thus, you can adjust only the desired states. Otherwise, create a theme from scratch would be time consuming. 

You can read more details about using the Visual Style Builder here:

1.     Loading predefined themes
2.     
Working with Repository Items
3.     
Saving and Loading Theme Files
4.     
Loading Themes from an External File
5.     
Loading Themes from a Resource
6.     
Applying Theme to a Control
7.     
http://tv.telerik.com/watch/winforms/visualstylebuilder/whats-new-visual-style-builder-q1-2010


I hope this information helps. If you have any additional questions, please let me know. 

Regards,
Dess
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Maria
Top achievements
Rank 1
answered on 23 Mar 2018, 04:59 PM

Thank you for your response.

I have studied the tutorials and have managed to modify the TelerikMetroBlue theme accordingly to my preferences. 

I don't have a problem with the events, like MouseOver etc, (actually I have managed to apply some of them). But there are times that a simple BackColor property is not being applied.

I have managed to apply it in some controls (RadPanels, etc) but in some others I need to call the

MyRadButton.ButtonElement.Fill.ResetValue(Telerik.WinControls.Primitives.FillPrimitive.BackColorProperty);

and it's not a flexible way...

 

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 27 Mar 2018, 01:14 PM
Hello, Maria, 
  
According to the provided information it seems that you need to reset the fill color in order to obtain the desired style in some controls. Probably, some style settings are not properly applied. That is why I would kindly ask you to submit a support ticket where you can provide a sample project with the custom theme that you have. Thus, our support staff will investigate the precise case and gladly assist you. 

Thank you for your cooperation.

Regards,
Dess
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Themes and Visual Style Builder
Asked by
Maria
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Maria
Top achievements
Rank 1
Share this question
or