Custom Shape/Theme applied to a specific button

2 posts, 0 answers
  1. David
    David avatar
    3 posts
    Member since:
    Mar 2009

    Posted 22 Apr 2009 Link to this post

    Hi,

    On my form I have two buttons that I wish to have a custom shape, and the rest to be normal.
    How do I do this?
    I made custom shape by clicking the button, opening theme builder, setting custom shape, saving theme, adding theme as resource in project, adding theme manager, loading the theme from resource in theme manager.
    But then the shape is applied to all buttons on the form.
    How do I get custom shapes/look/feel/behaviour on just two of the buttons?

    Regards,
    David
  2. Victor
    Admin
    Victor avatar
    1351 posts

    Posted 24 Apr 2009 Link to this post

    Hi David,

    Thank you for writing.

    When you create a theme with Theme Builder (aka Visual Style Builder), it is output in an .xml file. When you load this xml file with RadThemeManager, by default the theme is not set to any control, but you can select the theme by choosing it's name from the ThemeName property in the button's smart tag. This way only this button will have the theme. The only way the theme can be applied to every button is when you set the ThemeResolutionService.ApplicationThemeName property or if you call ThemeResolutionService.ApplyThemeToControlTree(Control parent, string themeName) by passing your control container as the first argument and the your theme name as the second argument.
     
    I have attached a sample application with a theme added as a resource, like you described. Theme is applied to only one of the buttons.
     
    Please have a look at the project and write back if you need further assistance.

    Sincerely yours,
    Victor
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top