Sometimes properties need reset to be overridden by a theme

4 posts, 0 answers
  1. Maria
    Maria avatar
    4 posts
    Member since:
    Jan 2018

    Posted 21 Mar 2018 Link to this post

    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?

  2. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3175 posts

    Posted 23 Mar 2018 Link to this post

    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.
  3. Maria
    Maria avatar
    4 posts
    Member since:
    Jan 2018

    Posted 23 Mar 2018 Link to this post

    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...

     

  4. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3175 posts

    Posted 27 Mar 2018 Link to this post

    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.
Back to Top