Overriding Theme for Specific Control After applying Customized Theme For Entire Application

2 posts, 0 answers
  1. Surya
    Surya avatar
    35 posts
    Member since:
    Nov 2011

    Posted 08 Dec 2011 Link to this post

    HI,

      i am using Customize Theme for my for entire  Windows Application . My Requirement for search textboxes i need Shaded Background Color As attached ShadedTextbox.png.

       After goggling i came to know that we can use 2 customize themes , one is for Entire Application and the other is for Search textboxes.
    I tried http://www.telerik.com/community/forums/winforms/buttons/override-button-color-with-theme.aspx , but i unable to achieved.

    Please look below sample code 
       Assembly lAssembly = Assembly.LoadFrom("RadTheme.dll");
                ThemeResolutionService.LoadPackageResource(lAssembly, "RadTheme.Theme.FenixTheme.tssp");
                ThemeResolutionService.LoadPackageResource(lAssembly, "RadTheme.Theme.FenixThemeTwo.tssp");


                //ThemeResolutionService.LoadPackageResource("RadThemeExample.Themes.FenixTheme.tssp");
                //ThemeResolutionService.LoadPackageResource("RadThemeExample.Themes.FenixThemeTwo.tssp");


                ThemeResolutionService.ApplicationThemeName = "FenixTheme";
                this.radTextBox1.ThemeName = "FenixThemeTwo";


    Please Find Attached Image SampleApp.png.

      


  2. Ivan Petrov
    Admin
    Ivan Petrov avatar
    701 posts

    Posted 12 Dec 2011 Link to this post

    Hello Surya,

    Thank you for writing.

    If you want to use two themes at the same time you cannot use ThemeResolutionService.ApplicationThemeName, because after you set this property the ThemeName property of each control is ignored and will not affect its theme. To use two themes you have to set the theme individually to each control using the ThemeName property. One thing that will help you is using ThemeResolutionService.ApplyThemeToControlTree and passing as parameters a form and the theme name you want to set to most of the controls. After that you can set the ThemeName property for the controls you want with a different theme to the desired theme name. One draw back of this method is that you will have to set the theme in all forms separately.

    I noticed that I have made an error in the forum thread you have followed by suggesting ApplicationThemeName at the bottom of the thread. Actually, I meant to write ApplyThemeToControlThree.
    Now this error is addressed. 

    I hope this will help. If you have further questions, I would be glad to assist.

    Regards,
    Ivan Petrov
    the Telerik team

    Q3’11 of RadControls for WinForms is available for download (see what's new). Get it today.

  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top