Hi,
I'm trying to create a custom control
library using telerik controls as base clases, and creating a default
styleguide based on the default telerik styles for each control.
Basically,
what I have (as if I was extending from standard WPF controls) is a
ResourceDictionary (Generic.xaml) with a Targeted Style for each Custom
Control, using the 'BasedOn' property. Something like this:
<Style BasedOn="{StaticResource {x:Type ComboBox}}" |
TargetType="{x:Type local:MyComboBox}"> |
<Setter Property="Background" Value="Red" /> |
<Setter Property="Foreground" Value="DarkGray" /> |
</Style> |
Regrettably, it seems this doesn't work out of the box with
telerik, I mean, using RadComboBox as StaticResource. I've also tried using
the ThemeResourceKey with no luck:
<Style TargetType="{x:Type local:MyComboBox}" |
BasedOn="{StaticResource {telerik:ThemeResourceKey ThemeType=telerik:Office_BlackTheme, ElementType=Controls:RadComboBox}}"> |
<Setter Property="Background" Value="Red" /> |
<Setter Property="Foreground" Value="DarkGray" /> |
</Style> |
The MyComboBox file looks like this:
I also tried overriding the TargetType of the inherited control, again, no luck:
public class MyComboBox : RadComboBox |
{ |
static MyComboBox () |
{ |
DefaultStyleKeyProperty.OverrideMetadata(typeof(MyComboBox), new FrameworkPropertyMetadata(typeof(MyComboBox))); |
} |
} |
I also tried overriding the TargetType of the inherited control, again, no luck:
[LocalizabilityAttribute(LocalizationCategory.NeverLocalize)] |
[Ambient] |
public Type TargetType |
{ |
get { return typeof (RadComboBox);} |
} |
Any suggestions?
Thanks,
--
R.