Change the base color of the "Default" theme

6 posts, 0 answers
  1. Doug
    Doug avatar
    50 posts
    Member since:
    Jul 2012

    Posted 09 May 2013 Link to this post

    I've read posts about color blending and I think that is no longer available.  I would like to create some theme options for the user to pick from a color dialog (attached image) and apply that color as the color of the "Default" theme.  What is the way to do that now?

    Thank you,
    Gary
  2. Anton
    Admin
    Anton avatar
    167 posts

    Posted 14 May 2013 Link to this post

    Hello Gary,

    Thank you for writing.

    Yes, you are right that color blending is no longer supported. Currently, you have two options:

    1. To create several different themes with different predefined colors and user to be able to choose between them.
    2. To change the theme at runtime. The following code snippet demonstrates how to iterate through all repositories and how to access some specific style group at run time.
    //iterate through all repositories
    Theme theme = ThemeRepository.FindTheme("ControlDefault");
    if (theme != null)
    {
        foreach (StyleRepository repository in theme.Repositories)
        {
            
             
        }
    }
     
    //access some specific style group
    Theme controlDefaultTheme = ThemeRepository.FindTheme("ControlDefault");
    StyleGroup group = controlDefaultTheme.FindStyleGroup("Telerik.WinControls.UI.RadGridView");
     
    foreach (PropertySettingGroup settingGroup in group.PropertySettingGroups)
    {
        if (settingGroup.Selector.Value == "GridHeaderCellElement")
        {
            foreach (PropertySetting property in settingGroup.PropertySettings)
            {
                if (property.Name == "BackColor2")
                {
                     
                }
            }
        }
    }

    I hope this information helps.

    All the best,
    Anton
    the Telerik team
    RadChart for WinForms is obsolete. Now what?
  3. Doug
    Doug avatar
    50 posts
    Member since:
    Jul 2012

    Posted 28 May 2013 Link to this post

    I was thinking that I want to do option 1 and load "ControlDefault" into Visual Style Builder, change some colors, and save it as a new theme...several times to get a basic green, red, indigo, etc. themes.  I started down this path in the forum earlier and am just now returning to it.  Do I need to change colors on every control or is there some place to set colors that will affect all the controls?
  4. Anton
    Admin
    Anton avatar
    167 posts

    Posted 31 May 2013 Link to this post

    Hi Gary,

    Thank you writing back.

    There is no such property that you can change to change the color of each control from our suite. However, when we were creating our themes we were trying to set every property with repository. A repository is a predefined set of properties that can be applied to some primitive or element. These repositories are reused for more than one control. For example, we have fill repository that sets some blue color for background so, this repository is applied for every element in our controls that should display this color. So, the best way to change colors in the theme is to change the colors in the repositories. Each theme has hundreds of repositories, so this will be not fast and easy task, but is the most suitable way to achieve your goal.

    I hope this information helps.

    Regards,
    Anton
    Telerik
    RadChart for WinForms is obsolete. Now what?
  5. Fabrizio
    Fabrizio avatar
    6 posts
    Member since:
    May 2019

    Posted 1 day and 7 hours ago in reply to Anton Link to this post

    Hello

    Can you tell me if is it possible to retrieve the color theme of the selected row in a radgridview ? The "propertySetting" name is the same for all Theme ?

    Thank you

     

     

  6. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3174 posts

    Posted 1 day and 2 hours ago Link to this post

    Hello, Fabrizio,     

    I would like to note that the different themes in the Telerik UI for WinForms suite have their own implementation. You can't reply on the fact that the names of the repository settings will be identical in all themes. Usually, manipulating a theme at run time is not a recommended approach as it would include a lot of code for even simple customizations. 

    If you need to customize a theme, the easiest way to do it is by using Visual Style Builder. You can export the built-in themes, then load a certain theme as a starting point for the customizations, perform the style changes and save the custom theme.

    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. 

    Regards,
    Dess | Tech Support Engineer, Sr.
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top