This is a migrated thread and some comments may be shown as answers.

Implicit theme code behind

3 Answers 65 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
B
Top achievements
Rank 2
B asked on 28 Apr 2014, 12:32 PM
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

3 Answers, 1 is accepted

Sort by
0
B
Top achievements
Rank 2
answered on 28 Apr 2014, 02:12 PM
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
0
B
Top achievements
Rank 2
answered on 28 Apr 2014, 03:10 PM
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
0
B
Top achievements
Rank 2
answered on 29 Apr 2014, 09:16 AM
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.
Tags
General Discussions
Asked by
B
Top achievements
Rank 2
Answers by
B
Top achievements
Rank 2
Share this question
or