Implicit theme code behind

4 posts, 0 answers
  1. B
    B avatar
    74 posts
    Member since:
    Jul 2011

    Posted 28 Apr 2014 Link to this post

    Hi,

    Because the StyleManager is "old" as you say, I'm working on replacing it with implicit themes, but I can't figure out how to apply the implicit theme to a control created in code behind.

    For example I have an implicit theme:

    <ResourceDictionary Source="/PowerBrowser;component/Themes/Telerik.Windows.Controls.xaml" />

    Which works fine when I have a RadExpander in xaml:

    <telerik:RadExpander IsExpanded="True">

    But when I create one in code behind:

    RadExpander expander = new RadExpander();

    The implicit them is not applied.

    Is there a way to apply the implicit theme to "expander"?

    Regards,

    Bayram

  2. B
    B avatar
    74 posts
    Member since:
    Jul 2011

    Posted 28 Apr 2014 Link to this post

    Ok, I got it working for RadExpander, apparently if I derive a class I have to add a BasedOn

    For RadExpander that works, but this doesnt seem to work for RadWindow, if I make a derived class and then add a BasedOn line it still uses the default Office Black style:

    <telerik:RadWindow x:Class="PowerBrowser.Common.Controls.GenSmallWindow"

    And

    <Style BasedOn="{StaticResource RadWindowStyle}"
           TargetType="pc:GenSmallWindow" />

    Builds and runs fine, but has Office Black isntead of Office 2013 style

    Regards,

    Bayram
  3. DevCraft banner
  4. B
    B avatar
    74 posts
    Member since:
    Jul 2011

    Posted 28 Apr 2014 in reply to B Link to this post

    Ok I found the problem, apparently you also have to add BasedOn for every derived class of every derived class. That is quite a lot of work. Especially since I have to do this again every Telerik update.

    Is there a way around this?

    Regards,

    Bayram
  5. B
    B avatar
    74 posts
    Member since:
    Jul 2011

    Posted 29 Apr 2014 in reply to B Link to this post

    I found a way to do this without changing the implicit theme itself, so I figure since I only have to do this once that is fine.
Back to Top