Theme maintenance

4 posts, 0 answers
  1. A
    A avatar
    6 posts
    Member since:
    Apr 2012

    Posted 04 Mar 2014 Link to this post

    Hi,

    We are using Telerik controls (2012.3.1129.40) and use theme support. Everything is working fine - user can select theme to use and appearance of application will change, but there are 2 scenarios that cause us headache.

    Usecase 1:
    I've changed style of control, for example FilteringControl of the RadGridView. In fact I needed small change in layout, so I changed template for the control, but because layout and appearance options in themes are mixed colors are redefined to. Using 'StyleManager.Theme="{x:Static StyleManager.ApplicationTheme}"' trick I can make some parts of the control to look consistent (buttons, listboxes) with other application parts, but there are things like backgroung/border colors defined in the template, that should be changed according to the theme. So from now on, whenever theme is changed FilteringControls look is inconsistent. I could redefine template for all other themes (just to change 3-5 color properties), but how can I specify which template should be used for which theme?

    Usecase 2:
    We have custom controls, that should match in theme with the rest of application. I accept to 'copy-paste' whole template for another theme just to change 2-3 color properties, but again how can I tell to theme manager which template should be used according to the selected theme?

    Thank you


  2. Masha
    Admin
    Masha avatar
    355 posts

    Posted 07 Mar 2014 Link to this post

    Hello,

    It is not a good idea to use StyleManager to switching themes at runtime. When trying to switch an application theme through the StyleManager, RadControls pick up their theme once when they are created. After layout is created the application theme cannot be changed. To force the controls to change their theme, you need to reset or recreate the UI, so that the controls can pick up the new theme. This is the reason why with this approach you need to recreate your view.

    And this is why we strongly recommend using the implicit styling approach when you switching themes. This way you will have no problems to point which template to be used  when the theme is changed.

    I hope this information would be helpful.

    Regards,
    Masha
    Telerik

    DevCraft Q1'14 is here! Watch the online conference to see how this release solves your top-5 .NET challenges. Watch on demand now.

  3. UI for WPF is Visual Studio 2017 Ready
  4. A
    A avatar
    6 posts
    Member since:
    Apr 2012

    Posted 07 Mar 2014 in reply to Masha Link to this post

    Thank you for the reply,

    I guess using 'implicit styling' solves second issue - for each theme I will just create 'skins' for my control and will be adding 'skins' according to the style selected.

    What about 1st usecase - even with 'implicit styling' I have to modify 'skin's of FilteringControl for all themes, which quite tedious and laborious. My goal was just to 'tweak' layout of the control. What is the 'best-practice' for this scenario.
  5. Vanya Pavlova
    Admin
    Vanya Pavlova avatar
    2019 posts

    Posted 12 Mar 2014 Link to this post

    Hello,


    Thank you for getting back to us! The styles used in our themes are theme specific. This means that you have a separate style for each theme. FilteringControl is not different than the rest elements and components, as part of the suite. Even if you want to switch FilteringControl's style using StyleManager or Implicit styles you should have a separate modified style for each theme.  


    Regards,
    Vanya Pavlova
    Telerik
     

    DevCraft Q1'14 is here! Watch the online conference to see how this release solves your top-5 .NET challenges. Watch on demand now.

     
Back to Top