Should child controls use parent control theme?

3 posts, 1 answers
  1. Emily
    Emily avatar
    9 posts
    Member since:
    Feb 2016

    Posted 01 Mar Link to this post

    Hi All,

    I have a RadPanel on my form, and it contains several rad buttons, a toggle switch, etc. I noticed that in order to get a theme to be applied to the child controls, I have to set it individually on each one. I was expecting that if I set the theme on the parent panel, that the child controls would all use it as well. I just wanted to make sure that I'm not doing something wrong here...am I supposed to set the theme separately on all child controls within a panel? Thank you!

  2. Answer
    Hristo Merdjanov
    Admin
    Hristo Merdjanov avatar
    711 posts

    Posted 01 Mar Link to this post

    Hello Emily,

    Thank you for writing.

    Themes are set for each of the controls on the form individually. The static ThemeResolutionService class exposes a method for setting a theme on all child controls of a certain control: 
    ThemeResolutionService.ApplyThemeToControlTree(this.radPanel1, "TelerikMetro");

    The code snippet above will set the TelerikMetro theme to all of the controls within the panel. If it also suits your application you can set a default theme for your application which will be used by all controls: Using a Default Theme.

    I hope this helps. Should you have further questions please do not hesitate to write back.

    Regards,
    Hristo Merdjanov
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Emily
    Emily avatar
    9 posts
    Member since:
    Feb 2016

    Posted 01 Mar Link to this post

    That should do the trick. Thank you!
Back to Top