Hi,
I have implemented dynamic theming within my MVVM/Prism application, and for now I am utilising the built-in Telerik themes. When the theme is changed the required assembly is downloaded from the server and the styles are applied to the UI through my ViewModel that contains the current theme.
This all works perfectly and the controls where I have set the StyleManager.Theme="{Binding CurrentTheme.Theme}" property are updated dynamically. I have set up some custom control templates, such as the below for the RadExpander, and these templates also include colours. I would like the theme to be able to change the colours contained within the template (Background, Border etc.) as well if at all possible. I have tried moving the statically referenced brushes into the Expander.xaml project of the Theme, but the parser is unable to identify them. I have also tried moving the control templates themselves into the Expander.xaml resource dictionary, but again no luck:
Is there a way I can apply custom control templates that utilise the Telerik theming mechanism?
Regards,
Chris
I have implemented dynamic theming within my MVVM/Prism application, and for now I am utilising the built-in Telerik themes. When the theme is changed the required assembly is downloaded from the server and the styles are applied to the UI through my ViewModel that contains the current theme.
This all works perfectly and the controls where I have set the StyleManager.Theme="{Binding CurrentTheme.Theme}" property are updated dynamically. I have set up some custom control templates, such as the below for the RadExpander, and these templates also include colours. I would like the theme to be able to change the colours contained within the template (Background, Border etc.) as well if at all possible. I have tried moving the statically referenced brushes into the Expander.xaml project of the Theme, but the parser is unable to identify them. I have also tried moving the control templates themselves into the Expander.xaml resource dictionary, but again no luck:
<
ControlTemplate
x:Key
=
"ExpanderHeaderTemplate"
TargetType
=
"Custom:RadExpanderHeader"
>
<
Grid
Background
=
"{TemplateBinding Background}"
>
<
Border
Style
=
"{StaticResource Border_GrayRoundedHeader}"
Padding
=
"5"
>
<
Grid
>
<
ContentControl
Content
=
"{TemplateBinding Content}"
ContentTemplate
=
"{TemplateBinding ContentTemplate}"
FontFamily
=
"{TemplateBinding FontFamily}"
FontSize
=
"{TemplateBinding FontSize}"
FontStretch
=
"{TemplateBinding FontStretch}"
FontStyle
=
"{TemplateBinding FontStyle}"
FontWeight
=
"{TemplateBinding FontWeight}"
Foreground
=
"{TemplateBinding Foreground}"
HorizontalAlignment
=
"Left"
HorizontalContentAlignment
=
"Left"
Margin
=
"{TemplateBinding Padding}"
x:Name
=
"content"
VerticalAlignment
=
"Center"
VerticalContentAlignment
=
"Center"
Visibility
=
"Visible"
Opacity
=
"1"
/>
<
Custom:RadExpanderDecorator
x:Name
=
"decorator"
ExpandDirection
=
"{TemplateBinding ExpandDirection}"
IsPressed
=
"{TemplateBinding IsPressed}"
IsHighlighted
=
"{TemplateBinding IsMouseOver}"
IsExpanded
=
"{TemplateBinding IsExpanded}"
Margin
=
"0,0,10,0"
Template
=
"{TemplateBinding DecoratorTemplate}"
HorizontalAlignment
=
"Right"
VerticalAlignment
=
"Center"
/>
<
Rectangle
x:Name
=
"FocusDecorator"
IsHitTestVisible
=
"false"
Opacity
=
"0"
StrokeThickness
=
"0"
Visibility
=
"Collapsed"
/>
</
Grid
>
</
Border
>
</
Grid
>
</
ControlTemplate
>
Is there a way I can apply custom control templates that utilise the Telerik theming mechanism?
Regards,
Chris